From cfc817c710995dd254fa8c36361471edf4ab4ca7 Mon Sep 17 00:00:00 2001 From: Derumier Alexandre Date: Fri, 20 Jan 2012 11:42:06 +0100 Subject: [PATCH] add lsi controller hotplug Signed-off-by: Derumier Alexandre --- PVE/QemuServer.pm | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm index eb077f10..ab7698ec 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) = @_;