the global variable is now called QEMU_FASTPLUG_OPTIONS.
we can also check them earlier during the pending delete loop to speed
up the change.

Signed-off-by: Oguz Bektas <o.bek...@proxmox.com>
---
 PVE/QemuServer.pm | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 328a0d1..1dc116b 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -4801,7 +4801,7 @@ sub set_migration_caps {
     vm_mon_cmd_nocheck($vmid, "migrate-set-capabilities", capabilities => 
$cap_ref);
 }
 
-my $fast_plug_option = {
+my $QEMU_FASTPLUG_OPTIONS = {
     'lock' => 1,
     'name' => 1,
     'onboot' => 1,
@@ -4834,9 +4834,8 @@ sub vmconfig_hotplug_pending {
 
     my $changes = 0;
     foreach my $opt (keys %{$conf->{pending}}) { # add/change
-       if ($fast_plug_option->{$opt}) {
-           $conf->{$opt} = $conf->{pending}->{$opt};
-           delete $conf->{pending}->{$opt};
+       if ($QEMU_FASTPLUG_OPTIONS->{$opt}) {
+           $conf->{$opt} = delete $conf->{pending}->{$opt};
            $changes = 1;
        }
     }
@@ -4853,7 +4852,10 @@ sub vmconfig_hotplug_pending {
        next if $selection && !$selection->{$opt};
        my $force = $pending_delete_hash->{$opt}->{force};
        eval {
-           if ($opt eq 'hotplug') {
+           if ($QEMU_FASTPLUG_OPTIONS->{$opt}) {
+               # pass
+           }
+           elsif ($opt eq 'hotplug') {
                die "skip\n" if ($conf->{hotplug} =~ /memory/);
            } elsif ($opt eq 'tablet') {
                die "skip\n" if !$hotplug_features->{usb};
@@ -4880,8 +4882,6 @@ sub vmconfig_hotplug_pending {
                # here we reset the ballooning value to memory
                my $balloon = $conf->{memory} || $defaults->{memory};
                vm_mon_cmd($vmid, "balloon", value => $balloon*1024*1024);
-           } elsif ($fast_plug_option->{$opt}) {
-               # do nothing
            } elsif ($opt =~ m/^net(\d+)$/) {
                die "skip\n" if !$hotplug_features->{network};
                vm_deviceunplug($vmid, $conf, $opt);
-- 
2.20.1

_______________________________________________
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to