From: Fiona Ebner <f.ebner@proxmox.com>
To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>
Subject: Re: [pve-devel] [PATCH qemu-server 03/13] blockdev: vm_devices_list : fix block-query
Date: Tue, 17 Jun 2025 16:44:16 +0200 [thread overview]
Message-ID: <32bb3b1b-f74c-459f-9454-a451ba46059f@proxmox.com> (raw)
In-Reply-To: <mailman.205.1748937402.395.pve-devel@lists.proxmox.com>
Am 03.06.25 um 09:55 schrieb Alexandre Derumier via pve-devel:
>
> Look at qdev value, as cdrom drives can be empty
> without any inserted media
>
> Signed-off-by: Alexandre Derumier <alexandre.derumier@groupe-cyllene.com>
> ---
> PVE/QemuServer.pm | 17 ++++++++++++++---
> 1 file changed, 14 insertions(+), 3 deletions(-)
>
> diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
> index a27dcabb..b15b05aa 100644
> --- a/PVE/QemuServer.pm
> +++ b/PVE/QemuServer.pm
> @@ -4061,11 +4061,22 @@ sub vm_devices_list {
> $devices_to_check = $to_check;
> }
>
> + # block devices need to be queried at qdev level, as a device
> + # don't always have a blockdev drive media attached (cdrom for example).
> + # Also top node of the graph could have a different name than the device
> + # (we still use "drive-$deviceid" for throttle filter, but it's not 100% safe
> + # if we change that in the future
> my $resblock = mon_cmd($vmid, 'query-block');
> foreach my $block (@$resblock) {
> - if($block->{device} =~ m/^drive-(\S+)/){
But this is already looking at the device ID, not the block node
name. AFAICS, the function does always work for -drive, but never for
-blockdev, regardless of the presence of a media. So I'm a bit confused
by the comment and commit message.
That said, the change itself looks good to me. I slightly adapted it and
will pick it up for v2 of the preparatory series with the following
commit message:
vm devices list: prepare querying block device names for -blockdev
Look at the 'qdev' value, because the 'device' property is not
initialized with '-blockdev'. This can be seen in the QEMU source code
(the device property is the name of the block backend and blk->name is
assigned a value only in a code path reached via drive_new()). This
most likely was done to avoid confusion/clashes, since with
'-blockdev', the node that's inserted for a front-end device can
change and then both the block backend and the node would be named
the same, but not connected.
> - $devices->{$1} = 1;
> - }
> + my $qdev_id = $block->{qdev};
> + if ($qdev_id =~ m|^/machine/peripheral/(virtio(\d+))/virtio-backend$|) {
> + $qdev_id = $1;
> + } elsif ($qdev_id =~ m|^/machine/system.flash0$|) {
> + $qdev_id = 'pflash0';
> + } elsif ($qdev_id =~ m|^/machine/system.flash1$|) {
> + $qdev_id = 'efidisk0';
> + }
> + $devices->{$qdev_id} = 1 if $qdev_id;
> }
>
> my $resmice = mon_cmd($vmid, 'query-mice');
> --
> 2.39.5
>
>
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
next prev parent reply other threads:[~2025-06-17 14:44 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20250603075558.627850-1-alexandre.derumier@groupe-cyllene.com>
2025-06-03 7:55 ` [pve-devel] [PATCH pve-qemu 1/1] add fake 10.0 Alexandre Derumier via pve-devel
2025-06-03 7:55 ` [pve-devel] [PATCH qemu-server 01/13] blockdev: cmdline: add blockdev syntax support Alexandre Derumier via pve-devel
2025-06-05 13:23 ` Fiona Ebner
2025-06-05 14:17 ` Fabian Grünbichler
2025-06-05 14:39 ` DERUMIER, Alexandre via pve-devel
[not found] ` <ee4940c99e9866910405b492dad15c68718c49ea.camel@groupe-cyllene.com>
2025-06-06 7:50 ` Fiona Ebner
2025-06-06 8:27 ` Fabian Grünbichler
2025-06-06 9:54 ` DERUMIER, Alexandre via pve-devel
2025-06-06 8:50 ` Fiona Ebner
2025-06-06 9:42 ` DERUMIER, Alexandre via pve-devel
[not found] ` <0605a27428cfb920ffefc51abdfec050a0a6b535.camel@groupe-cyllene.com>
2025-06-06 10:57 ` DERUMIER, Alexandre via pve-devel
2025-06-10 14:03 ` Fiona Ebner
2025-06-11 6:37 ` DERUMIER, Alexandre via pve-devel
[not found] ` <405662415075c0248618833b512b58258f80e0f7.camel@groupe-cyllene.com>
2025-06-11 7:24 ` Fiona Ebner
2025-06-11 14:02 ` DERUMIER, Alexandre via pve-devel
[not found] ` <733f5eefb25b76a0794a84d4f93ada8d70aea7be.camel@groupe-cyllene.com>
2025-06-11 14:13 ` Fiona Ebner
2025-06-12 5:20 ` DERUMIER, Alexandre via pve-devel
2025-06-03 7:55 ` [pve-devel] [PATCH pve-storage 1/9] common: add qemu_img_create an preallocation_cmd_option Alexandre Derumier via pve-devel
2025-06-03 7:55 ` [pve-devel] [PATCH qemu-server 02/13] blockdev: add support for ovmf && efidisk Alexandre Derumier via pve-devel
2025-06-03 7:55 ` [pve-devel] [PATCH pve-storage 2/9] common: add qemu_img_create_qcow2_backed Alexandre Derumier via pve-devel
2025-06-03 7:55 ` [pve-devel] [PATCH qemu-server 03/13] blockdev: vm_devices_list : fix block-query Alexandre Derumier via pve-devel
2025-06-17 14:44 ` Fiona Ebner [this message]
2025-06-03 7:55 ` [pve-devel] [PATCH pve-storage 3/9] common: add qemu_img_info helper Alexandre Derumier via pve-devel
2025-06-03 7:55 ` [pve-devel] [PATCH qemu-server 04/13] blockdev: add support to qemu_driveadd && qemu_drivedel Alexandre Derumier via pve-devel
2025-06-03 7:55 ` [pve-devel] [PATCH pve-storage 4/9] common: add qemu_img_measure Alexandre Derumier via pve-devel
2025-06-03 7:55 ` [pve-devel] [PATCH qemu-server 05/13] blockdev: add support to qemu_block_set_io_throttle Alexandre Derumier via pve-devel
2025-06-03 7:55 ` [pve-devel] [PATCH pve-storage 5/9] rename_volume: add source && target snap Alexandre Derumier via pve-devel
2025-06-03 7:55 ` [pve-devel] [PATCH qemu-server 06/13] blockdev: add support for cdrom media eject/insert Alexandre Derumier via pve-devel
2025-06-03 7:55 ` [pve-devel] [PATCH pve-storage 6/9] storage: volume_snapshot: add $running param + api bump Alexandre Derumier via pve-devel
2025-06-03 7:55 ` [pve-devel] [PATCH qemu-server 07/13] blockdev: add support for block_resize Alexandre Derumier via pve-devel
2025-06-03 7:55 ` [pve-devel] [PATCH pve-storage 7/9] qcow2: add external snapshot support Alexandre Derumier via pve-devel
2025-06-03 7:55 ` [pve-devel] [PATCH qemu-server 08/13] blockdev: add support for nbd_export: block-export-add Alexandre Derumier via pve-devel
2025-06-03 7:55 ` [pve-devel] [PATCH pve-storage 8/9] lvmplugin: add qcow2 snapshot Alexandre Derumier via pve-devel
2025-06-03 7:55 ` [pve-devel] [PATCH qemu-server 09/13] blockdev: add blockdev_mirror Alexandre Derumier via pve-devel
2025-06-03 7:55 ` [pve-devel] [PATCH pve-storage 9/9] storage: add volume_support_qemu_snapshot Alexandre Derumier via pve-devel
2025-06-03 7:55 ` [pve-devel] [PATCH qemu-server 10/13] blockdev: change aio on target if io_uring is not default Alexandre Derumier via pve-devel
2025-06-03 7:55 ` [pve-devel] [PATCH qemu-server 11/13] qemu_img convert : add external snapshot support Alexandre Derumier via pve-devel
2025-06-03 7:55 ` [pve-devel] [PATCH qemu-server 12/13] blockdev: add backing_chain support Alexandre Derumier via pve-devel
2025-06-03 7:55 ` [pve-devel] [PATCH qemu-server 13/13] qcow2: add external snapshot support Alexandre Derumier via pve-devel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=32bb3b1b-f74c-459f-9454-a451ba46059f@proxmox.com \
--to=f.ebner@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal