Available CPU Count incorrect when creating KVM from CLI

Bug #1947087 reported by Mk4UmHa
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
MAAS
High
Alberto Donato

Bug Description

Debian MAAS 3.1.0~beta3 installed inside LXD Container.

When creating VM from CLI the available CPU Count is incorrect which stops me from creating more VMs.

Fresh 20.04 install on bare metal.

UI Creation of KVM is OK but not from CLI.

    "available": {
        "cores": 80,
        "memory": 772649,
        "local_storage": 5952253325312
    },
    "architectures": [
        "amd64/generic"
    ],
    "used": {
        "cores": 0,
        "memory": 0,
        "local_storage": 0
    },
    "total": {
        "cores": 80,
        "memory": 772649,
        "local_storage": 5952253325312
    },

Create one VM with 24 Cores and 128GB Memory through UI.

    "total": {
        "cores": 80,
        "memory": 772649,
        "local_storage": 5952253325312
    "used": {
        "cores": 24,
        "memory": 130048,
        "local_storage": 100000000000
    },
    "available": {
        "cores": 56,
        "memory": 642601,
        "local_storage": 5852253325312
    },

Create one VM with 24 Cores and 128GB Memory through CLI and Available is incorrect.

maas $PROFILE vm-host compose $VM_HOST_ID cores=24 memory=131072 architecture="amd64/generic" "storage=mylabel:64(default),mylabel:1000(default),mylabel:1000(default)"

    "used": {
        "cores": 72,
        "memory": 393216,
        "local_storage": 2064000000000
    },
    "total": {
        "cores": 80,
        "memory": 772649,
        "local_storage": 5952253325312
    "available": {
        "cores": 8,
        "memory": 379433,
        "local_storage": 3888253325312

Related branches

Mk4UmHa (mk4umha)
description: updated
Revision history for this message
Mk4UmHa (mk4umha) wrote :

I created two VM's with the UI with the following.

8 cores
128GB

Then I see the used core count is wrong, which says available is only 16.

"used": {
        "cores": 64,
        "memory": 1040384,
        "local_storage": 728000000000
    },
    "total": {
        "cores": 80,
        "memory": 772649,
        "local_storage": 5952253325312
    },
    "available": {
        "cores": 16,
        "memory": -267735,
        "local_storage": 5224253325312
    },

Revision history for this message
Christian Grabowski (cgrabowski) wrote :

Can you please provide whether this is a LXD VM host or Virsh VM host? And what version of LXD if a LXD VM Host?

Changed in maas:
status: New → Incomplete
Revision history for this message
Mk4UmHa (mk4umha) wrote :

Hi,

It's a virsh VM host.

Revision history for this message
Mk4UmHa (mk4umha) wrote :

BTW, the Virsh host was deployed via MAAS as a KVM Host using Ubuntu 20.04.

Revision history for this message
Alberto Donato (ack) wrote :

could you please provide the output of `maas $profile vm-host read $vmhost_id`

Revision history for this message
Mk4UmHa (mk4umha) wrote :

Here you go!

Success.
Machine-readable output follows:
{
    "used": {
        "cores": 64,
        "memory": 1040384,
        "local_storage": 728000000000
    },
    "type": "virsh",
    "version": "6.0.0",
    "pool": {
        "name": "default",
        "description": "Default pool",
        "id": 0,
        "resource_uri": "/MAAS/api/2.0/resourcepool/0/"
    },
    "tags": [
        "pod-console-logging",
        "virtual"
    ],
    "id": 62,
    "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": 5952253325312
    },
    "name": "7920r2",
    "architectures": [
        "amd64/generic"
    ],
    "storage_pools": [
        {
            "id": "760c012a-4846-4d8d-a204-d9f4f5cff24e",
            "name": "maas",
            "type": "dir",
            "path": "/var/lib/libvirt/maas-images",
            "total": 5952253325312,
            "used": 728000000000,
            "available": 5224253325312,
            "default": true
        }
    ],
    "capabilities": [
        "composable",
        "dynamic_local_storage",
        "over_commit",
        "storage_pools"
    ],
    "available": {
        "cores": 16,
        "memory": -267735,
        "local_storage": 5224253325312
    },
    "cpu_over_commit_ratio": 1.0,
    "default_macvlan_mode": null,
    "resource_uri": "/MAAS/api/2.0/vm-hosts/62/"
}

Revision history for this message
Mk4UmHa (mk4umha) wrote :

ScreenShot of the Available Cores in the UI vs the JSON output.

Revision history for this message
Alberto Donato (ack) wrote :

Could you also include a screenshot of the VMhost details page?

Revision history for this message
Alberto Donato (ack) wrote :

Also, does refreshing the VM host change anything?

Revision history for this message
Mk4UmHa (mk4umha) wrote (last edit ):

I've refreshed on all my hosts and it doesn't match the UI count on CPU or Memory availability at all, we can do a zoom call for debugging if you're interested.

Revision history for this message
Mk4UmHa (mk4umha) wrote :

I have a 2nd MAAS deployment running on a clean MAAS installation and added an existing Host running 20.04 with virsh to manage, and when creating the Virtual Machines, it shows the same behavior.

Revision history for this message
Alberto Donato (ack) wrote :

Could you please paste the output of the following query on the maas database:

select * from maasserver_virtualmachine where bmc_id=$vmhost_id;

Changed in maas:
status: Incomplete → New
status: New → Incomplete
Revision history for this message
Mk4UmHa (mk4umha) wrote :

maasdb=# select * from maasserver_virtualmachine where bmc_id=62;
 id | created | updated | identifier | pinned_cores | unpinned_cores | memory | hugepages_backed | bmc_id | machine_id | project
----+-------------------------------+------------------------------+------------+--------------+----------------+--------+------------------+--------+------------+---------
 62 | 2021-10-13 22:49:34.808538-05 | 2021-10-13 22:49:34.81064-05 | cloudian1 | {} | 8 | 130048 | f | 62 | 115 |
 63 | 2021-10-13 22:50:34.797719-05 | 2021-10-13 22:50:34.79936-05 | cloudian2 | {} | 8 | 130048 | f | 62 | 116 |
(2 rows)

maasdb=#

Alberto Donato (ack)
Changed in maas:
status: Incomplete → Triaged
milestone: none → 3.1.0
importance: Undecided → High
Alberto Donato (ack)
Changed in maas:
assignee: nobody → Alberto Donato (ack)
Alberto Donato (ack)
Changed in maas:
status: Triaged → In Progress
Changed in maas:
status: In Progress → Fix Committed
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers