From 75b51053cc1cc09b5bc9cb9821ce03c51b8b24eb Mon Sep 17 00:00:00 2001 From: Dominik Csapak Date: Mon, 14 May 2018 14:03:04 +0200 Subject: [PATCH] fix logic of deleting balloon 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 --- PVE/QemuServer.pm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm index 6756abd..2a07bce 100644 --- a/PVE/QemuServer.pm +++ b/PVE/QemuServer.pm @@ -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+)$/) { -- 2.39.2