]> git.proxmox.com Git - qemu-server.git/commitdiff
virtio disk hot-unplug: drive_del after device_del
authorAlexandre Derumier <aderumier@odiso.com>
Wed, 6 Mar 2013 15:22:43 +0000 (16:22 +0100)
committerDietmar Maurer <dietmar@proxmox.com>
Thu, 7 Mar 2013 07:37:49 +0000 (08:37 +0100)
we need to remove drive after device has correctly by remove.

With this patch:

Windows : if drive is locked/"mounted", the hot-unplug fail and disk is accessible (100% safe)

Linux: without hotplug module : the hot-unplug fail and disk is accessible (100% safe)

Linux : with hotplug module : the hot-unplug work, but no verification is done is the drive is mounted

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
PVE/QemuServer.pm

index 4e66cae35347e940168c05574d1cc14027b92182..eba9aedbfe87cea05341be49a2025ee8a6aad1d6 100644 (file)
@@ -2605,9 +2605,9 @@ sub vm_deviceunplug {
     die "can't unplug bootdisk" if $conf->{bootdisk} && $conf->{bootdisk} eq $deviceid;
 
     if ($deviceid =~ m/^(virtio)(\d+)$/) {
-        return undef if !qemu_drivedel($vmid, $deviceid);
         qemu_devicedel($vmid, $deviceid);
         return undef if !qemu_devicedelverify($vmid, $deviceid);
+        return undef if !qemu_drivedel($vmid, $deviceid);
     }
 
     if ($deviceid =~ m/^(lsi)(\d+)$/) {