[pve-devel] [PATCH] allow manual ballooning if shares is not enabled

Alexandre Derumier aderumier at odiso.com
Thu Dec 20 15:06:34 CET 2012


Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
---
 PVE/API2/Qemu.pm |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm
index 09ab1e7..9bdbc0a 100644
--- a/PVE/API2/Qemu.pm
+++ b/PVE/API2/Qemu.pm
@@ -897,9 +897,15 @@ __PACKAGE__->register_method({
 
 		    &$vmconfig_update_net($rpcenv, $authuser, $conf, $storecfg, $vmid, 
 					  $opt, $param->{$opt});
-
 		} else {
 
+		    if ($opt eq 'balloon' && ((!$conf->{shares}) || ($conf->{shares} && $conf->{shares} == 0))) { 
+
+			my $balloontarget = $param->{$opt};
+			$balloontarget = $conf->{memory} if $param->{$opt} == 0;
+			PVE::QemuServer::vm_mon_cmd_nocheck($vmid, "balloon", value => $balloontarget*1024*1024);
+		    }
+
 		    $conf->{$opt} = $param->{$opt};
 		    PVE::QemuServer::update_config_nolock($vmid, $conf, 1);
 		}
-- 
1.7.10.4




More information about the pve-devel mailing list