[pve-devel] [PATCH 2/3] enable virtio-scsi iothread hot-unplug for qemu 2.7 v3

Alexandre Derumier aderumier at odiso.com
Mon Oct 17 12:20:44 CEST 2016


changelog: check current running qemu process

Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
---
 PVE/QemuServer.pm | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 6376323..e4c385f 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -3516,9 +3516,11 @@ sub vm_deviceunplug {
 
     } elsif ($deviceid =~ m/^(scsi)(\d+)$/) {
 
-	#qemu 2.3 segfault on drive_del with virtioscsi + iothread
-	my $device = parse_drive($deviceid, $conf->{$deviceid});
-	die "virtioscsi with iothread is not hot-unplugglable currently" if $device->{iothread};
+	my $kvmver = get_running_qemu_version($vmid);
+	if (!qemu_machine_feature_enabled (undef, $kvmver, 2, 7)) {
+	    my $device = parse_drive($deviceid, $conf->{$deviceid});
+	    die "virtioscsi with iothread is hot-unplugglable since qemu 2.7" if $device->{iothread};
+	}
 
         qemu_devicedel($vmid, $deviceid);
         qemu_drivedel($vmid, $deviceid);
@@ -3564,7 +3566,10 @@ sub qemu_iothread_add {
 sub qemu_iothread_del {
     my($conf, $vmid, $deviceid) = @_;
 
-    my $device = parse_drive($deviceid, $conf->{$deviceid});
+    my $drive = $deviceid;
+    $drive =~ s/virtioscsi/scsi/;
+    my $device = parse_drive($drive, $conf->{$drive});
+
     if ($device->{iothread}) {
 	my $iothreads = vm_iothreads_list($vmid);
 	qemu_objectdel($vmid, "iothread-$deviceid") if $iothreads->{"iothread-$deviceid"};
-- 
2.1.4




More information about the pve-devel mailing list