From 1f219ef546eea5fb728c93d99973dbd1c183457b Mon Sep 17 00:00:00 2001 From: Alexandre Derumier Date: Wed, 6 Mar 2013 16:22:43 +0100 Subject: [PATCH] virtio disk hot-unplug: drive_del after device_del 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 --- PVE/QemuServer.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm index 4e66cae3..eba9aedb 100644 --- a/PVE/QemuServer.pm +++ b/PVE/QemuServer.pm @@ -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+)$/) {