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

Derumier Alexandre aderumier at odiso.com
Fri Dec 23 08:09:47 CET 2011


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

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index c32134d..610a7f2 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -2289,6 +2289,13 @@ sub vm_deviceplug {
        qemu_deviceaddverify($vmid,$deviceid);
     }
 
+    if($deviceid =~ m/^(scsi)(\d+)$/) {
+       qemu_findorcreatelsi($storecfg,$conf, $vmid,$device);
+       qemu_driveadd($storecfg, $vmid, $device);
+       my $devicefull = print_drivedevice_full($storecfg, $vmid, $device);
+       qemu_deviceadd($vmid,$devicefull);
+    }
+
 }
 
 sub vm_deviceunplug {
@@ -2298,6 +2305,11 @@ sub vm_deviceunplug {
 
     die "can't unplug bootdisk" if $conf->{bootdisk} eq $deviceid;
 
+    if($deviceid =~ m/^(scsi)(\d+)$/) {
+       qemu_devicedel($vmid,$deviceid);
+       qemu_drivedel($vmid,$deviceid);
+    }  
+
 }
 
 
-- 
1.7.2.5




More information about the pve-devel mailing list