]> git.proxmox.com Git - qemu-server.git/commitdiff
fix balloon pending update
authorAlexandre Derumier <aderumier@odiso.com>
Fri, 2 Jan 2015 14:16:01 +0000 (15:16 +0100)
committerDietmar Maurer <dietmar@proxmox.com>
Wed, 7 Jan 2015 07:39:08 +0000 (08:39 +0100)
Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
PVE/QemuServer.pm

index 38eca4b6088e304bcc3a5457c52042ab1b6ff48e..f5e9dab61dca85085d921842a6e1e8daaa5b29df 100644 (file)
@@ -3652,6 +3652,10 @@ sub vmconfig_hotplug_pending {
            } elsif ($opt eq 'cores') {
                die "skip\n" if !$hotplug;
                qemu_cpu_hotplug($vmid, $conf, 1);
+            } elsif ($opt eq 'balloon') {
+               #enable balloon device is not hotpluggable
+               die "skip\n" if ((defined($conf->{balloon})) && ($conf->{balloon} == 0));
+            } elsif ($opt eq 'shares') {
            } elsif ($opt =~ m/^net(\d+)$/) {
                die "skip\n" if !$hotplug;
                vm_deviceunplug($vmid, $conf, $opt);
@@ -3689,10 +3693,15 @@ sub vmconfig_hotplug_pending {
                die "skip\n" if !$hotplug;
                qemu_cpu_hotplug($vmid, $conf, $value);
            } elsif ($opt eq 'balloon') {
-               die "skip\n" if !(defined($conf->{shares}) && ($conf->{shares} == 0));
+               # disable balloning device is not hotpluggable
+               die "skip\n" if ((defined($conf->{pending}->{balloon})) && ($conf->{pending}->{balloon} == 0));
+               # enable balloning device is not hotpluggable
+               die "skip\n" if ((defined($conf->{balloon})) && ($conf->{balloon} == 0));
                # allow manual ballooning if shares is set to zero
-               my $balloon = $conf->{pending}->{balloon} || $conf->{memory} || $defaults->{memory};
-               vm_mon_cmd($vmid, "balloon", value => $balloon*1024*1024);
+               if (!(defined($conf->{shares}) && ($conf->{shares} == 0))) {
+                   my $balloon = $conf->{pending}->{balloon} || $conf->{memory} || $defaults->{memory};
+                   vm_mon_cmd($vmid, "balloon", value => $balloon*1024*1024);
+               }
            } elsif ($opt =~ m/^net(\d+)$/) { 
                # some changes can be done without hotplug
                vmconfig_update_net($storecfg, $conf, $vmid, $opt, $value);