[pve-devel] [PATCH 3/7] vmconfig_hotplug_pending : implement unplug
Alexandre Derumier
aderumier at odiso.com
Tue Nov 18 13:39:48 CET 2014
Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
---
PVE/QemuServer.pm | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 1d0d4a4..61e53a7 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -3484,6 +3484,24 @@ 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) {
+ if ($opt eq 'tablet') {
+ if(PVE::QemuServer::vm_deviceplug(undef, $conf, $vmid, $opt)){
+ delete $conf->{$opt};
+ vmconfig_undelete_pending_option($conf, $opt);
+ }
+ } else {
+ if(PVE::QemuServer::vm_deviceunplug($vmid, $conf, $opt)){
+ delete $conf->{$opt};
+ vmconfig_undelete_pending_option($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