]> git.proxmox.com Git - qemu-server.git/commitdiff
fix logic of deleting balloon
authorDominik Csapak <d.csapak@proxmox.com>
Mon, 14 May 2018 12:03:04 +0000 (14:03 +0200)
committerWolfgang Bumiller <w.bumiller@proxmox.com>
Tue, 22 May 2018 11:20:16 +0000 (13:20 +0200)
Deleting the balloon config entry means resetting it to its
default. This means having a balloon device but not actually
doing any ballooning with it (iow. resetting the VM's
'balloon' value to its specified memory.).
Hotplugging a balloon device (coming from explicit '0' to
any other value (including deleting it)) is not possible.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
PVE/QemuServer.pm

index 6756abdbe6bccd48ac39f8e405aba67658230254..2a07bcecd87ec56bffc793db24eaf96bb4ae120b 100644 (file)
@@ -4297,7 +4297,10 @@ sub vmconfig_hotplug_pending {
                qemu_cpu_hotplug($vmid, $conf, undef);
             } elsif ($opt eq 'balloon') {
                # enable balloon device is not hotpluggable
-               die "skip\n" if !defined($conf->{balloon}) || $conf->{balloon};
+               die "skip\n" if defined($conf->{balloon}) && $conf->{balloon} == 0;
+               # 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+)$/) {