Skip to content

Commit 7ca27f6

Browse files
Marcus Sorensenchaturvedia
authored andcommitted
CLOUDSTACK-5968 create vm.memballoon.disable agent parameter
(cherry picked from commit e624632) Signed-off-by: Animesh Chaturvedi <animesh@apache.org>
1 parent 85868d8 commit 7ca27f6

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,7 @@ protected String getDefaultScriptsDir() {
374374
private boolean _can_bridge_firewall;
375375
protected String _localStoragePath;
376376
protected String _localStorageUUID;
377+
protected boolean _noMemBalloon = false;
377378
protected String _guestCpuMode;
378379
protected String _guestCpuModel;
379380
private final Map <String, String> _pifs = new HashMap<String, String>();
@@ -749,6 +750,11 @@ public boolean configure(String name, Map<String, Object> params)
749750
value = (String) params.get("cmds.timeout");
750751
_cmdsTimeout = NumbersUtil.parseInt(value, 7200) * 1000;
751752

753+
value = (String) params.get("vm.memballoon.disable");
754+
if (Boolean.parseBoolean(value)) {
755+
_noMemBalloon = true;
756+
}
757+
752758
value = (String) params.get("host.reserved.mem.mb");
753759
_dom0MinMem = NumbersUtil.parseInt(value, 0) * 1024 * 1024;
754760

@@ -3489,7 +3495,7 @@ protected LibvirtVMDef createVMFromSpec(VirtualMachineTO vmTO) {
34893495

34903496
GuestResourceDef grd = new GuestResourceDef();
34913497

3492-
if (vmTO.getMinRam() != vmTO.getMaxRam()){
3498+
if (vmTO.getMinRam() != vmTO.getMaxRam() && !_noMemBalloon) {
34933499
grd.setMemBalloning(true);
34943500
grd.setCurrentMem(vmTO.getMinRam()/1024);
34953501
grd.setMemorySize(vmTO.getMaxRam()/1024);

plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtVMDef.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,8 @@ public String toString() {
166166
}
167167
if (_memBalloning){
168168
resBuidler.append("<devices>\n" + "<memballoon model='virtio'/>\n" + "</devices>\n");
169+
} else {
170+
resBuidler.append("<devices>\n" + "<memballoon model='none'/>\n" + "</devices>\n");
169171
}
170172
if (_vcpu != -1) {
171173
resBuidler.append("<vcpu>" + _vcpu + "</vcpu>\n");

0 commit comments

Comments
 (0)