Can't create new KVMs

Version 3.1.0~beta1

When ever I use the maas CLI or UI to create more VM’s I run into CPU allocation errors like this even though I have more than enough resources.

My KVM resources are as shown.

Hi,
I tried to reproduce this in our local environment running the same version MAAS: 3.1.0~beta1 , and worked fine (I tested it with both: libvirt and LXD). I composed several machines.

May you test with a different nodes? Or add more information about your setup?

Thanks

Hi there…

I installed MAAS in LXC container as a debian package and not from the snap package as that didn’t work inside LXC.

I boot the baremetal to the MAAS and set it as 20.04 and Libvirt.

I don’t have any other nodes to play on, just those two :(.

I wonder if it’s a Debian instance vs the Snap?

Here’s the cli vm-hosts read example, check out the “available” section.

    {
    "memory_over_commit_ratio": 1.5,
    "cpu_over_commit_ratio": 2.0,
    "pool": {
        "name": "default",
        "description": "Default pool",
        "id": 0,
        "resource_uri": "/MAAS/api/2.0/resourcepool/0/"
    },
    "used": {
        "cores": 120,
        "memory": 851959,
        "local_storage": 6356000000000
    },
    "type": "virsh",
    "tags": [
        "virtual",
        "pod-console-logging"
    ],
    "id": 61,
    "zone": {
        "name": "default",
        "description": "",
        "id": 1,
        "resource_uri": "/MAAS/api/2.0/zones/default/"
    },
    "architectures": [
        "amd64/generic"
    ],
    "version": "6.0.0",
    "capabilities": [
        "composable",
        "dynamic_local_storage",
        "over_commit",
        "storage_pools"
    ],
    "total": {
        "cores": 56,
        "memory": 772650,
        "local_storage": 17954603577344
    },
    "available": {
        "cores": -64,
        "memory": -79309,
        "local_storage": 11598603577344
    },
    "host": {
        "system_id": "gbr6wf",
        "__incomplete__": true
    },
    "storage_pools": [
        {
            "id": "d7091fd4-86e0-4a21-a293-82345ee09861",
            "name": "maas",
            "type": "dir",
            "path": "/var/lib/libvirt/maas-images",
            "total": 5952253325312,
            "used": 0,
            "available": 5952253325312,
            "default": true
        },
        {
            "id": "40c6fcbc-1ef8-4404-be68-141489e4cf70",
            "name": "default",
            "type": "dir",
            "path": "/share/libvirt-storage",
            "total": 12002350252032,
            "used": 6356000000000,
            "available": 5646350252032,
            "default": false
        }
    ],
    "name": "7920r1",
    "default_macvlan_mode": "",
    "resource_uri": "/MAAS/api/2.0/vm-hosts/61/"
}


        "memory_over_commit_ratio": 1.5,
    "cpu_over_commit_ratio": 2.0,
    "pool": {
        "name": "default",
        "description": "Default pool",
        "id": 0,
        "resource_uri": "/MAAS/api/2.0/resourcepool/0/"
    },
    "used": {
        "cores": 168,
        "memory": 819200,
        "local_storage": 1312000000000
    },
    "type": "virsh",
    "tags": [
        "virtual",
        "pod-console-logging"
    ],
    "id": 60,
    "zone": {
        "name": "default",
        "description": "",
        "id": 1,
        "resource_uri": "/MAAS/api/2.0/zones/default/"
    },
    "architectures": [
        "amd64/generic"
    ],
    "version": "6.0.0",
    "capabilities": [
        "composable",
        "dynamic_local_storage",
        "over_commit",
        "storage_pools"
    ],
    "total": {
        "cores": 80,
        "memory": 772649,
        "local_storage": 17954603577344
    },
    "available": {
        "cores": -88,
        "memory": -46551,
        "local_storage": 16642603577344
    },

Thanks!

Hi, so its strange the “used” section. Is this a fresh deployed machine, right?

May you try to use this command maas $PROFILE vm-host $id refresh, and then vm-host read again?

Sorry, I put in two servers, the second one has 80 used and I can’t create more VMs on it either with similar problem.

I mainly added the second server to show that available is also wacky on it.

I went ahead and deleted all the KVMs… it doesn’t look like the over commit math is correct in the API, but it’s correct in the UI.

"available": {
  "cores": 56,
  "memory": 772650,
  "local_storage": 17954603577344
},


"available": {    
  "cores": 80,     
  "memory": 772649,                                                                              
  "local_storage": 17954603577344
},

I did the refresh as you asked to both my hosts.

maas $PROFILE vm-host refresh 60

Here’s the first one without VMs.

{
    "storage_pools": [
        {
            "id": "d7091fd4-86e0-4a21-a293-82345ee09861",
            "name": "maas",
            "type": "dir",
            "path": "/var/lib/libvirt/maas-images",
            "total": 5952253325312,
            "used": 0,
            "available": 5952253325312,
            "default": true
        },
        {
            "id": "40c6fcbc-1ef8-4404-be68-141489e4cf70",
            "name": "default",
            "type": "dir",
            "path": "/share/libvirt-storage",
            "total": 12002350252032,
            "used": 0,
            "available": 12002350252032,
            "default": false
        }
    ],
    "version": "6.0.0",
    "type": "virsh",
    "memory_over_commit_ratio": 1.5,
    "id": 61,
    "name": "7920r1",
    "capabilities": [
        "composable",
        "dynamic_local_storage",
        "over_commit",
        "storage_pools"
    ],
    "tags": [
        "pod-console-logging",
        "virtual"
    ],
    "cpu_over_commit_ratio": 2.0,
    "pool": {
        "name": "default",
        "description": "Default pool",
        "id": 0,
        "resource_uri": "/MAAS/api/2.0/resourcepool/0/"
    },
    "default_macvlan_mode": "",
    "host": {
        "system_id": "gbr6wf",
        "__incomplete__": true
    },
    "used": {
        "cores": 0,
        "memory": 0,
        "local_storage": 0
    },
    "zone": {
        "name": "default",
        "description": "",
        "id": 1,
        "resource_uri": "/MAAS/api/2.0/zones/default/"
    },
    "available": {
        "cores": 56,
        "memory": 772650,
        "local_storage": 17954603577344
    },
    "architectures": [
        "amd64/generic"
    ],
    "total": {
        "cores": 56,
        "memory": 772650,
        "local_storage": 17954603577344
    },
    "resource_uri": "/MAAS/api/2.0/vm-hosts/61/"
}

Here’s the second one that has VMS

{
    "storage_pools": [
        {
            "id": "d086229a-79c4-41b2-9e8e-d4c4e66136fd",
            "name": "maas",
            "type": "dir",
            "path": "/var/lib/libvirt/maas-images",
            "total": 5952253325312,
            "used": 0,
            "available": 5952253325312,
            "default": true
        },
        {
            "id": "929ab84d-3fcd-41f9-9913-cb8047ef86f4",
            "name": "default",
            "type": "dir",
            "path": "/share/libvirt-storage",
            "total": 12002350252032,
            "used": 492000000000,
            "available": 11510350252032,
            "default": false
        }
    ],
    "version": "6.0.0",
    "type": "virsh",
    "memory_over_commit_ratio": 1.5,
    "id": 60,
    "name": "7920r2",
    "capabilities": [
        "composable",
        "dynamic_local_storage",
        "over_commit",
        "storage_pools"
    ],
    "tags": [
        "pod-console-logging",
        "virtual"
    ],
    "cpu_over_commit_ratio": 2.0,
    "pool": {
        "name": "default",
        "description": "Default pool",
        "id": 0,
        "resource_uri": "/MAAS/api/2.0/resourcepool/0/"
    },
    "default_macvlan_mode": "",
    "host": {
        "system_id": "atd7rb",
        "__incomplete__": true
    },
    "used": {
        "cores": 144,
        "memory": 786432,
        "local_storage": 492000000000
    },
    "zone": {
        "name": "default",
        "description": "",
        "id": 1,
        "resource_uri": "/MAAS/api/2.0/zones/default/"
    },
    "available": {
        "cores": -64,
        "memory": -13783,
        "local_storage": 17462603577344
    },
    "architectures": [
        "amd64/generic"
    ],
    "total": {
        "cores": 80,
        "memory": 772649,
        "local_storage": 17954603577344
    },
    "resource_uri": "/MAAS/api/2.0/vm-hosts/60/"
}

I just set the overcommit back to 1 on CPU and Memory. Created 1 VM with 24 cores.

Used section says that 72 cores are in use… the math isn’t adding up.

{
    "id": 60,
    "capabilities": [
        "composable",
        "dynamic_local_storage",
        "over_commit",
        "storage_pools"
    ],
    "default_macvlan_mode": "",
    "zone": {
        "name": "default",
        "description": "",
        "id": 1,
        "resource_uri": "/MAAS/api/2.0/zones/default/"
    },
    "memory_over_commit_ratio": 1.0,
    "host": {
        "system_id": "atd7rb",
        "__incomplete__": true
    },
    "total": {
        "cores": 80,
        "memory": 772649,
        "local_storage": 17954603577344
    },
    "version": "6.0.0",
    "storage_pools": [
        {
            "id": "d086229a-79c4-41b2-9e8e-d4c4e66136fd",
            "name": "maas",
            "type": "dir",
            "path": "/var/lib/libvirt/maas-images",
            "total": 5952253325312,
            "used": 0,
            "available": 5952253325312,
            "default": true
        },
        {
            "id": "929ab84d-3fcd-41f9-9913-cb8047ef86f4",
            "name": "default",
            "type": "dir",
            "path": "/share/libvirt-storage",
            "total": 12002350252032,
            "used": 2064000000000,
            "available": 9938350252032,
            "default": false
        }
    ],
    "used": {
        "cores": 72,
        "memory": 393216,
        "local_storage": 2064000000000
    },
    "pool": {
        "name": "default",
        "description": "Default pool",
        "id": 0,
        "resource_uri": "/MAAS/api/2.0/resourcepool/0/"
    },
    "name": "7920r2",
    "type": "virsh",
    "tags": [
        "pod-console-logging",
        "virtual"
    ],
    "available": {
        "cores": 8,
        "memory": 379433,
        "local_storage": 15890603577344
    },
    "cpu_over_commit_ratio": 1.0,
    "architectures": [
        "amd64/generic"
    ],
    "resource_uri": "/MAAS/api/2.0/vm-hosts/60/"
}

OK,

I narrowed it down, the UI creation of the VM shows correct CPU Available…

The CLI command to create the VM shows miscalculated available CPUs…