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

Wolfgang Bumiller w.bumiller at proxmox.com
Tue May 22 13:24:20 CEST 2018


On Mon, May 14, 2018 at 02:03:04PM +0200, Dominik Csapak wrote:
> 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

Can I reword this like this?

    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 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