[pve-devel] [PATCH 5/8] add lsi controller hotplug

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


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

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index eb077f1..ab7698e 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -2295,6 +2295,14 @@ sub vm_deviceplug {
            return undef;
         }
     }
+
+    if ($deviceid =~ m/^(lsi)(\d+)$/) {
+        my $pciaddr = print_pci_addr($deviceid);
+        my $devicefull = "lsi,id=$deviceid$pciaddr";
+        qemu_deviceadd($vmid, $devicefull);
+        return undef if(!qemu_deviceaddverify($vmid, $deviceid));
+    }
+
     return 1;
 }
 
@@ -2310,6 +2318,11 @@ sub vm_deviceunplug {
         qemu_devicedel($vmid, $deviceid);
         return undef if !qemu_devicedelverify($vmid, $deviceid);
     }
+
+    if ($deviceid =~ m/^(lsi)(\d+)$/) {
+        return undef if !qemu_devicedel($vmid, $deviceid);
+    }
+
     return 1;
 }
 
@@ -2389,6 +2402,20 @@ sub qemu_devicedelverify {
     return undef;
 }
 
+sub qemu_findorcreatelsi {
+    my ($storecfg, $conf, $vmid, $device) = @_;
+
+    my $maxdev = 7;
+    my $controller = int($device->{index} / $maxdev);
+    my $lsiid="lsi$controller";
+    my $devices_list = vm_devices_list($vmid);
+
+    if(!defined($devices_list->{$lsiid})) {
+       return undef if !vm_deviceplug($storecfg, $conf, $vmid, $lsiid);
+    }
+    return 1;
+}
+
 sub vm_start {
     my ($storecfg, $vmid, $statefile, $skiplock) = @_;
 
-- 
1.7.2.5



More information about the pve-devel mailing list