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

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


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

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index a97d43d..c32134d 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -2282,6 +2282,13 @@ sub vm_deviceplug {
     my ($storecfg, $conf, $vmid, $deviceid, $device) = @_;
     return if !check_running($vmid) || !$conf->{hotplug} || $conf->{$deviceid};
     
+    if($deviceid =~ m/^(lsi)(\d+)$/) {
+       my $pciaddr = print_pci_addr($deviceid);
+       my $devicefull = "lsi,id=$deviceid$pciaddr";
+       qemu_deviceadd($vmid,$devicefull);
+       qemu_deviceaddverify($vmid,$deviceid);
+    }
+
 }
 
 sub vm_deviceunplug {
@@ -2364,6 +2371,19 @@ sub qemu_devicedelverify {
     die "error on hot-unplugging device $deviceid";
 }
 
+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})) {
+       vm_deviceplug($storecfg,$conf, $vmid, $lsiid);
+    }
+}
+
 sub vm_start {
     my ($storecfg, $vmid, $statefile, $skiplock) = @_;
 
-- 
1.7.2.5




More information about the pve-devel mailing list