[pve-devel] [PATCH qemu-server 2/3] fix logic of deleting balloon

Dominik Csapak d.csapak at proxmox.com
Mon May 14 14:03:04 CEST 2018


deleting balloon means to skip ballooning or to add a balloning device
skipping ballooning is ok (with a reset to memory),
but it is not possible to hotplug a ballooning device
so we have to reverse the logic here, and possibly reset the ballooning value

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 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.11.0





More information about the pve-devel mailing list