You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by bh...@apache.org on 2017/09/29 06:16:12 UTC

[cloudstack] branch master updated: CLOUDSTACK-10073: KVM host RAM overprovisioning (#2266)

This is an automated email from the ASF dual-hosted git repository.

bhaisaab pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cloudstack.git


The following commit(s) were added to refs/heads/master by this push:
     new 3381c38  CLOUDSTACK-10073: KVM host RAM overprovisioning (#2266)
3381c38 is described below

commit 3381c38cc73f3e52b2f02107db8f74c9294de712
Author: Bitworks Software, Ltd <bw...@users.noreply.github.com>
AuthorDate: Fri Sep 29 13:16:09 2017 +0700

    CLOUDSTACK-10073: KVM host RAM overprovisioning (#2266)
    
    Commit enables a new feature for KVM hypervisor which purpose is to increase virtually amount of RAM available beyond the actual limit.
    There is a new parameter in agent.properties: host.overcommit.mem.mb which enables adding specified amount of RAM to actually available. It is necessary to utilize KSM and ZSwap features which extend RAM with deduplication and compression.
---
 agent/conf/agent.properties                                   |  8 ++++++--
 .../hypervisor/kvm/resource/LibvirtComputingResource.java     | 11 +++++++++--
 2 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/agent/conf/agent.properties b/agent/conf/agent.properties
index 22741b5..0354ace 100644
--- a/agent/conf/agent.properties
+++ b/agent/conf/agent.properties
@@ -176,11 +176,15 @@ hypervisor.type=kvm
 # vm.rng.rate.period=1000
 # The number of milliseconds in which the guest is allowed to obtain the bytes
 # specified above.
-
+#
 # router.aggregation.command.each.timeout=600
 # timeout value for aggregation commands send to virtual router
 #
-
+# host.overcommit.mem.mb = 0
+# allows to increase amount of ram available on host virtually to utilize Zswap, KSM features
+# and modern fast SSD/3D XPoint devices. Specified amount of MBs is added to the memory agent 
+# reports to the Management Server
+# Default: 0
 #
 # vm.watchdog.model=i6300esb
 # The model of Watchdog timer to present to the Guest
diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
index 104d435..7794249 100644
--- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
+++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
@@ -304,6 +304,8 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
 
     private long _dom0MinMem;
 
+    private long _dom0OvercommitMem;
+
     protected boolean _disconnected = true;
     protected int _cmdsTimeout;
     protected int _stopTimeout;
@@ -849,6 +851,11 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
         // Reserve 1GB unless admin overrides
         _dom0MinMem = NumbersUtil.parseInt(value, 1024) * 1024 * 1024L;
 
+        value = (String)params.get("host.overcommit.mem.mb");
+        // Support overcommit memory for host if host uses ZSWAP, KSM and other memory
+        // compressing technologies
+        _dom0OvercommitMem = NumbersUtil.parseInt(value, 0) * 1024 * 1024L;
+
         value = (String) params.get("kvmclock.disable");
         if (Boolean.parseBoolean(value)) {
             _noKvmClock = true;
@@ -2782,12 +2789,12 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
         info.add((int)cpus);
         info.add(speed);
         // Report system's RAM as actual RAM minus host OS reserved RAM
-        ram = ram - _dom0MinMem;
+        ram = ram - _dom0MinMem + _dom0OvercommitMem;
         info.add(ram);
         info.add(cap);
         info.add(_dom0MinMem);
         info.add(cpuSockets);
-        s_logger.debug("cpus=" + cpus + ", speed=" + speed + ", ram=" + ram + ", _dom0MinMem=" + _dom0MinMem + ", cpu sockets=" + cpuSockets);
+        s_logger.debug("cpus=" + cpus + ", speed=" + speed + ", ram=" + ram + ", _dom0MinMem=" + _dom0MinMem + ", _dom0OvercommitMem=" + _dom0OvercommitMem + ", cpu sockets=" + cpuSockets);
 
         return info;
     }

-- 
To stop receiving notification emails like this one, please contact
['"commits@cloudstack.apache.org" <co...@cloudstack.apache.org>'].