public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH qemu-server 1/2] qmp: verify device deletion: allow specifying timeout
@ 2025-07-22  9:30 Fiona Ebner
  2025-07-22  9:30 ` [pve-devel] [PATCH qemu-server 2/2] qmp: device unplug: bump timeout for removing virtio scsi controller Fiona Ebner
  2025-07-25 12:15 ` [pve-devel] applied-series: [PATCH qemu-server 1/2] qmp: verify device deletion: allow specifying timeout Fabian Grünbichler
  0 siblings, 2 replies; 3+ messages in thread
From: Fiona Ebner @ 2025-07-22  9:30 UTC (permalink / raw)
  To: pve-devel

The default timeout is not appropriate in all cases, e.g. removing a
VirtIO SCSI controller can take more than 5 seconds.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
---
 src/PVE/QemuServer.pm | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/PVE/QemuServer.pm b/src/PVE/QemuServer.pm
index d7398648..9f327955 100644
--- a/src/PVE/QemuServer.pm
+++ b/src/PVE/QemuServer.pm
@@ -4126,12 +4126,14 @@ sub qemu_deviceaddverify {
 }
 
 sub qemu_devicedelverify {
-    my ($vmid, $deviceid) = @_;
+    my ($vmid, $deviceid, $timeout) = @_;
+
+    $timeout //= 5;
 
     # need to verify that the device is correctly removed as device_del
     # is async and empty return is not reliable
 
-    for (my $i = 0; $i <= 5; $i++) {
+    for (my $i = 0; $i <= $timeout; $i++) {
         my $devices_list = vm_devices_list($vmid);
         return 1 if !defined($devices_list->{$deviceid});
         sleep 1;
-- 
2.47.2



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [pve-devel] [PATCH qemu-server 2/2] qmp: device unplug: bump timeout for removing virtio scsi controller
  2025-07-22  9:30 [pve-devel] [PATCH qemu-server 1/2] qmp: verify device deletion: allow specifying timeout Fiona Ebner
@ 2025-07-22  9:30 ` Fiona Ebner
  2025-07-25 12:15 ` [pve-devel] applied-series: [PATCH qemu-server 1/2] qmp: verify device deletion: allow specifying timeout Fabian Grünbichler
  1 sibling, 0 replies; 3+ messages in thread
From: Fiona Ebner @ 2025-07-22  9:30 UTC (permalink / raw)
  To: pve-devel

It's possible to run into the default timeout of 5 seconds with quite
a simple and generic Debian 12, kernel 6.1 test VM. Detaching happened
right after doing a lot of IO on the associated drive.

In testing, detaching the drive itself was immediate, and detaching
the VirtIO SCSI controller always took 6 seconds. Use 15 seconds, so
that it's more than twice the value to be on the safe side for the
future.

For completeness, the VM configuration:

agent: 0
boot: order=scsi0
cores: 2
cpu: host
hotplug: disk,network,usb
ide2: none,media=cdrom
machine: q35
memory: 6144
name: Copy-of-VM-Copy-of-VM-apache
net0: virtio=BC:24:11:49:0F:85,bridge=vnet0,firewall=1
numa: 1
ostype: l26
scsi0: sharedlvm:vm-103-disk-0.qcow2,iothread=1,size=4304M
scsi1: sharedlvm:vm-103-disk-1.qcow2,iothread=1,size=4G
scsi2: sharedlvm:vm-103-disk-2.qcow2,iothread=1,size=4G
scsi3: zfs:vm-103-disk-0,size=4G
scsihw: virtio-scsi-single
smbios1: uuid=f3f9952f-aab9-45ef-933d-ee01df474b26
sockets: 2
startup: order=2
vmgenid: 529f6974-6fc8-4196-9fb2-9639f55d31d6

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
---
 src/PVE/QemuServer.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/PVE/QemuServer.pm b/src/PVE/QemuServer.pm
index 9f327955..67b86ff4 100644
--- a/src/PVE/QemuServer.pm
+++ b/src/PVE/QemuServer.pm
@@ -4011,7 +4011,7 @@ sub vm_deviceunplug {
         qemu_iothread_del($vmid, $deviceid, $device);
     } elsif ($deviceid =~ m/^(virtioscsi|scsihw)(\d+)$/) {
         qemu_devicedel($vmid, $deviceid);
-        qemu_devicedelverify($vmid, $deviceid);
+        qemu_devicedelverify($vmid, $deviceid, 15);
     } elsif ($deviceid =~ m/^(scsi)(\d+)$/) {
         my $device = parse_drive($deviceid, $conf->{$deviceid});
 
-- 
2.47.2



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [pve-devel] applied-series: [PATCH qemu-server 1/2] qmp: verify device deletion: allow specifying timeout
  2025-07-22  9:30 [pve-devel] [PATCH qemu-server 1/2] qmp: verify device deletion: allow specifying timeout Fiona Ebner
  2025-07-22  9:30 ` [pve-devel] [PATCH qemu-server 2/2] qmp: device unplug: bump timeout for removing virtio scsi controller Fiona Ebner
@ 2025-07-25 12:15 ` Fabian Grünbichler
  1 sibling, 0 replies; 3+ messages in thread
From: Fabian Grünbichler @ 2025-07-25 12:15 UTC (permalink / raw)
  To: pve-devel, Fiona Ebner


On Tue, 22 Jul 2025 11:30:33 +0200, Fiona Ebner wrote:
> The default timeout is not appropriate in all cases, e.g. removing a
> VirtIO SCSI controller can take more than 5 seconds.
> 
> 

Applied, thanks!

[1/2] qmp: verify device deletion: allow specifying timeout
      commit: 6d212deaadb83edaffc37b4163ea21c4b9201bae
[2/2] qmp: device unplug: bump timeout for removing virtio scsi controller
      commit: 71623e5abcab4485ed2c8bec2fede3d7a5bb6483

Best regards,
-- 
Fabian Grünbichler <f.gruenbichler@proxmox.com>


_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-07-25 12:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-07-22  9:30 [pve-devel] [PATCH qemu-server 1/2] qmp: verify device deletion: allow specifying timeout Fiona Ebner
2025-07-22  9:30 ` [pve-devel] [PATCH qemu-server 2/2] qmp: device unplug: bump timeout for removing virtio scsi controller Fiona Ebner
2025-07-25 12:15 ` [pve-devel] applied-series: [PATCH qemu-server 1/2] qmp: verify device deletion: allow specifying timeout Fabian Grünbichler

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal