[pve-devel] [PATCH 6/8] add scsi disk hotplug/unplug

Derumier Alexandre aderumier at odiso.com
Fri Jan 20 11:42:07 CET 2012


Signed-off-by: Derumier Alexandre <aderumier at odiso.com>
---
 PVE/QemuServer.pm |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index ab7698e..0d521d6 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -2303,6 +2303,16 @@ sub vm_deviceplug {
         return undef if(!qemu_deviceaddverify($vmid, $deviceid));
     }
 
+    if ($deviceid =~ m/^(scsi)(\d+)$/) {
+        return undef if !qemu_findorcreatelsi($storecfg,$conf, $vmid, $device);
+        return undef if !qemu_driveadd($storecfg, $vmid, $device);
+        my $devicefull = print_drivedevice_full($storecfg, $vmid, $device);
+        if(!qemu_deviceadd($vmid, $devicefull)) {
+           qemu_drivedel($vmid, $deviceid);
+           return undef;
+        }
+    }
+
     return 1;
 }
 
@@ -2323,6 +2333,11 @@ sub vm_deviceunplug {
         return undef if !qemu_devicedel($vmid, $deviceid);
     }
 
+    if ($deviceid =~ m/^(scsi)(\d+)$/) {
+        return undef if !qemu_devicedel($vmid, $deviceid);
+        return undef if !qemu_drivedel($vmid, $deviceid);
+    }
+
     return 1;
 }
 
-- 
1.7.2.5




More information about the pve-devel mailing list