[pve-devel] [PATCH 3/6] vmconfig_hotplug_pending : implement unplug

Alexandre Derumier aderumier at odiso.com
Mon Nov 17 16:43:38 CET 2014


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

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index b948de8..27e6957 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -3524,6 +3524,19 @@ sub vmconfig_hotplug_pending {
     #return if !$conf->{hotplug};  #some changes can't be done also without hotplug
 
     # fixme: implement disk/network hotplug here
+
+    #unplug first
+    my @delete = PVE::Tools::split_list($conf->{pending}->{delete});
+    foreach my $opt (@delete) { 
+	#unplug
+	if ($opt eq 'tablet') {
+	    warn "error hotplug $opt" if !PVE::QemuServer::vm_deviceplug(undef, $conf, $vmid, $opt);
+	} else {
+	    warn "error hot-unplug $opt" if !PVE::QemuServer::vm_deviceunplug($vmid, $conf, $opt);
+	}
+    }
+
+    #hotplug
     foreach my $opt (keys %{$conf->{pending}}) {
 	if ($opt =~ m/^net(\d+)$/) { 
 	    vmconfig_update_net($storecfg, $conf, $vmid, $opt);
-- 
1.7.10.4




More information about the pve-devel mailing list