[pve-devel] [PATCH qemu-server 5/5] fix #5440: hmp helpers: drive{add, del}: increase timeout

Fiona Ebner f.ebner at proxmox.com
Fri May 3 13:19:54 CEST 2024


The default timeout for HMP commands is 5 seconds.

While it should be rather fast to attach a new drive to QEMU, a busy
system might take longer, so future-proof and increase to 60 seconds.

On the other hand, detaching a drive needs to complete any pending IO
on it, so use the same 10 minutes timeout that's used for
drive-related QMP commands.

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

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 82e7d6a6..ba3d9f26 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -4377,7 +4377,7 @@ sub qemu_driveadd {
     my $io_uring = min_version($kvmver, 6, 0);
     my $drive = print_drive_commandline_full($storecfg, $vmid, $device, undef, $io_uring);
     $drive =~ s/\\/\\\\/g;
-    my $ret = PVE::QemuServer::Monitor::hmp_cmd($vmid, "drive_add auto \"$drive\"");
+    my $ret = PVE::QemuServer::Monitor::hmp_cmd($vmid, "drive_add auto \"$drive\"", 60);
 
     # If the command succeeds qemu prints: "OK"
     return 1 if $ret =~ m/OK/s;
@@ -4388,7 +4388,7 @@ sub qemu_driveadd {
 sub qemu_drivedel {
     my ($vmid, $deviceid) = @_;
 
-    my $ret = PVE::QemuServer::Monitor::hmp_cmd($vmid, "drive_del drive-$deviceid");
+    my $ret = PVE::QemuServer::Monitor::hmp_cmd($vmid, "drive_del drive-$deviceid", 10 * 60);
     $ret =~ s/^\s+//;
 
     return 1 if $ret eq "";
-- 
2.39.2





More information about the pve-devel mailing list