mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
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.
This commit is contained in:
parent
a06530ddd8
commit
3381c38cc7
@ -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
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user