[pve-devel] [PATCH qemu-server 18/31] blockdev: add change_medium() helper

Fiona Ebner f.ebner at proxmox.com
Tue Jul 1 12:05:02 CEST 2025


Am 30.06.25 um 16:42 schrieb DERUMIER, Alexandre via pve-devel:
>>> After a cloudinit regenerate, or if I swap a cdrom image to a new
>>> cdrom
>>> image,
>>>
>>> the old format && file blockdev are not removed,  and the new
>>> blockdevs
>>> have autogenerated nodenames

I cannot reproduce this here, could you share the exact commands and
machine configuration?

For medium change:

> [I] root at pve9a1 ~# qm create 500 --ide0 sani:iso/virtio-win-0.1.271.iso,media=cdrom
> [I] root at pve9a1 ~# qm start 500
> [I] root at pve9a1 ~# echo '{"execute": "qmp_capabilities"}{"execute": "query-named-block-nodes"}' | socat - /var/run/qemu-server/500.qmp | jq | grep \"node-name
>       "node-name": "drive-ide0",
>       "node-name": "f549bd09aa572d2ae134301979d01b3",
>       "node-name": "e549bd09aa572d2ae134301979d01b3",
> [I] root at pve9a1 ~# qm set 500 --ide0 sani:iso/virtio-win-0.1.266.iso,media=cdrom
> update VM 500: -ide0 sani:iso/virtio-win-0.1.266.iso,media=cdrom
> [I] root at pve9a1 ~# echo '{"execute": "qmp_capabilities"}{"execute": "query-named-block-nodes"}' | socat - /var/run/qemu-server/500.qmp | jq | grep \"node-name
>       "node-name": "drive-ide0",
>       "node-name": "ffb79807a199dd8817137fa5e247d9d",
>       "node-name": "efb79807a199dd8817137fa5e247d9d",

For cloudinit regenerate:

> [I] root at pve9a1 ~# qm create 500 --ide0 dir:cloudinit
> Formatting '/mnt/pve/dir/images/500/vm-500-cloudinit.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off preallocation=metadata compression_type=zlib size=4194304 lazy_refcounts=off refcount_bits=16
> ide0: successfully created disk 'dir:500/vm-500-cloudinit.qcow2,media=cdrom'
> [I] root at pve9a1 ~# qm start 500
> Use of uninitialized value in split at /usr/share/perl5/PVE/QemuServer/Cloudinit.pm line 115.
> generating cloud-init ISO
> [I] root at pve9a1 ~# echo '{"execute": "qmp_capabilities"}{"execute": "query-named-block-nodes"}' | socat - /var/run/qemu-server/500.qmp | jq | grep \"node-name
>       "node-name": "drive-ide0",
>       "node-name": "fc72045ad74e7732964db954986226f",
>       "node-name": "ec72045ad74e7732964db954986226f",
> [I] root at pve9a1 ~# qm set 500 --ciuser foobar
> update VM 500: -ciuser foobar
> [I] root at pve9a1 ~# pvesh create /nodes/pve9a1/qemu/500/cloudinit
> No 'create' handler defined for '/nodes/pve9a1/qemu/500/cloudinit'
> [I] root at pve9a1 ~ [1]# pvesh set /nodes/pve9a1/qemu/500/cloudinit
> Use of uninitialized value in split at /usr/share/perl5/PVE/QemuServer/Cloudinit.pm line 115.
> generating cloud-init ISO
> [I] root at pve9a1 ~# echo '{"execute": "qmp_capabilities"}{"execute": "query-named-block-nodes"}' | socat - /var/run/qemu-server/500.qmp | jq | grep \"node-name
>       "node-name": "drive-ide0",
>       "node-name": "fc72045ad74e7732964db954986226f",
>       "node-name": "ec72045ad74e7732964db954986226f",

For me, it replaces and regenerates just fine. Is the issue somehow in
combination with file=none like you reported in the other mail?

> not sure if it's a qemu bug, but I think this is why I have use open-
> tray, 	remove-medium, inser-medium, close-tray
> 
> https://lists.proxmox.com/pipermail/pve-devel/2025-April/070595.html

See the next patch, the blockdev_change_medium() helper is adapted from
yours :)




More information about the pve-devel mailing list