API: missing information

Eric Delaet

Member
Sep 23, 2020
14
1
8
48
Hello,

I'm trying to get the machine details from the API from my Proxmox 7.0-11.

The machine has 2 disks (first one is 60GB, the second 40GB).

Via pvesh I execute the following command. But only one disk is reported (the second one). Do I make a mistake in querying hardware details? Or how do I find the total amount of assigned storage for a VM?

# pvesh get /pools/TestPool --output-format json | python -m json.tool
{
"cpu": 0.0351813858713055,
"disk": 0,
"diskread": 307923615744,
"diskwrite": 932530951168,
"id": "qemu/134",
"maxcpu": 2,
"maxdisk": 42949672960,
"maxmem": 4294967296,
"mem": 1578446848,
"name": "VM003",
"netin": 24739015965,
"netout": 948083298,
"node": "pm02",
"status": "running",
"template": 0,
"type": "qemu",
"uptime": 4378494,
"vmid": 134
},

When I lookup the vmid via cluster resources (pvesh get /cluster/resources), it is even reported as 0 bytes, although the storage pools are reported correctly.

Is this a bug?
 
Hi,
Hello,

I'm trying to get the machine details from the API from my Proxmox 7.0-11.

The machine has 2 disks (first one is 60GB, the second 40GB).

Via pvesh I execute the following command. But only one disk is reported (the second one). Do I make a mistake in querying hardware details? Or how do I find the total amount of assigned storage for a VM?
The description of the API property maxdisk is Root disk size in bytes., so it only reports the boot disk size.

When I lookup the vmid via cluster resources (pvesh get /cluster/resources), it is even reported as 0 bytes, although the storage pools are reported correctly.
Did you look at disk or maxdisk? For disk it's currently always zero, because the information about disk usage within the VM is just not readily available (or costly to get). There is a feature request to improve it using the qemu guest agent.
 
Hi,

The description of the API property maxdisk is Root disk size in bytes., so it only reports the boot disk size.


Did you look at disk or maxdisk? For disk it's currently always zero, because the information about disk usage within the VM is just not readily available (or costly to get). There is a feature request to improve it using the qemu guest agent.

Thanks for the explanation.

For some of my vm's, it reports the root disk (i understand that this is the first disk) indeed. But for another vm, it reports the size of the second disk (so the size of ide1 instead of ide0), not the root disk. So that still looks like a bug I think. Maybe it has something to do because those disks are IDE and not virtio, because here they are reported correctly.

So as I understand there is currently not a way to show *all* the virtual disks of a vm via the api?

About the second question, thanks, I will follow the thread of the feature request.
 
Thanks for the explanation.

For some of my vm's, it reports the root disk (i understand that this is the first disk) indeed. But for another vm, it reports the size of the second disk (so the size of ide1 instead of ide0), not the root disk. So that still looks like a bug I think. Maybe it has something to do because those disks are IDE and not virtio, because here they are reported correctly.
Could you share the VM's configuration?

So as I understand there is currently not a way to show *all* the virtual disks of a vm via the api?
Just the disks? I don't think there is. You can extract them from the configuration. API path: /nodes/{node}/qemu/{vmid}/config.
 
Hello,

Here is the config (the .conf file under /etc/pve/qemu-server).
As you see above, 40G is reported via the api.

bios: ovmf
boot: order=ide1;ide2;net0
cores: 2
efidisk0: stor01:vm-134-disk-0,size=1M
ide0: stor01:vm-134-disk-1,size=60G
ide1: stor01:vm-134-disk-2,size=40G
ide2: none,media=cdrom
machine: pc-i440fx-6.0
memory: 4096
name: VM003
net0: vmxnet3=72:51:77:BF:67:CF,bridge=vmbr7,firewall=1
numa: 0
ostype: win8
scsihw: virtio-scsi-pci
smbios1: uuid=a3a4d5b1-a6e6-4e1f-af6f-fecd37eaae28
sockets: 1
vmgenid: 29e49d00-b0df-4830-b478-2d27421fe3f9

[PENDING]
agent: 1
ostype: win10
 
Hello,

Here is the config (the .conf file under /etc/pve/qemu-server).
As you see above, 40G is reported via the api.

bios: ovmf
boot: order=ide1;ide2;net0
cores: 2
efidisk0: stor01:vm-134-disk-0,size=1M
ide0: stor01:vm-134-disk-1,size=60G
ide1: stor01:vm-134-disk-2,size=40G
ide2: none,media=cdrom
machine: pc-i440fx-6.0
memory: 4096
name: VM003
net0: vmxnet3=72:51:77:BF:67:CF,bridge=vmbr7,firewall=1
numa: 0
ostype: win8
scsihw: virtio-scsi-pci
smbios1: uuid=a3a4d5b1-a6e6-4e1f-af6f-fecd37eaae28
sockets: 1
vmgenid: 29e49d00-b0df-4830-b478-2d27421fe3f9

[PENDING]
agent: 1
ostype: win10
What's reported is the size of the boot disk and that is ide1 as set in the boot: property.
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!