[pve-devel] [PATCH 1/2] enable virtio-scsi iothread hot-unplug

Alexandre Derumier aderumier at odiso.com
Sat Aug 20 10:02:28 CEST 2016


This was previously buggy in qemu 2.3 (crash the vm),
now it's working fine in qemu 2.6

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

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 2414fd8..b295ae4 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -3401,10 +3401,6 @@ 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};
-
         qemu_devicedel($vmid, $deviceid);
         qemu_drivedel($vmid, $deviceid);
 	qemu_deletescsihw($conf, $vmid, $deviceid);
@@ -3449,7 +3445,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