mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-03 04:12:31 +01:00
Bug 9534 : implement CPU cap
Changes specific for Xen hypervisor, and DB upgrade. Changes for vmware chcked-in already in commit 1c310a0d2ae81108386f0dd5c2e899ff00fee9e9, e71112e2f587f5d6c9c6d5337cfeb1f239f29633. KVM will not support this feature.
This commit is contained in:
parent
aae67e5d8d
commit
4fbcb02573
@ -246,7 +246,6 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
|
||||
|
||||
protected IAgentControl _agentControl;
|
||||
|
||||
int _userVMCap = 0;
|
||||
final int _maxWeight = 256;
|
||||
|
||||
protected final XenServerHost _host = new XenServerHost();
|
||||
@ -791,10 +790,9 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
|
||||
|
||||
Integer speed = vmSpec.getSpeed();
|
||||
if (speed != null) {
|
||||
int utilization = _userVMCap; //cpu_cap
|
||||
//Configuration cpu.uservm.cap is not available in default installation. Using this parameter is not encouraged
|
||||
|
||||
int cpuWeight = _maxWeight; //cpu_weight
|
||||
int utilization = 0; // max CPU cap, default is unlimited
|
||||
|
||||
// weight based allocation
|
||||
cpuWeight = (int)((speed*0.99) / _host.speed * _maxWeight);
|
||||
@ -802,6 +800,10 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
|
||||
cpuWeight = _maxWeight;
|
||||
}
|
||||
|
||||
if (vmSpec.getLimitCpuUse()) {
|
||||
utilization = (int)((speed*0.99) / _host.speed * 100);
|
||||
}
|
||||
|
||||
vcpuParams.put("weight", Integer.toString(cpuWeight));
|
||||
vcpuParams.put("cap", Integer.toString(utilization));
|
||||
|
||||
|
||||
@ -4,6 +4,8 @@
|
||||
|
||||
ALTER TABLE `cloud`.`mshost` ADD COLUMN `runid` bigint NOT NULL DEFAULT 0 COMMENT 'run id, combined with msid to form a cluster session';
|
||||
ALTER TABLE `cloud`.`mshost` ADD COLUMN `state` varchar(10) NOT NULL default 'Down';
|
||||
ALTER TABLE `cloud`.`vm_instance` ADD COLUMN `limit_cpu_use` tinyint(1) NOT NULL DEFAULT 0 ;
|
||||
ALTER TABLE `cloud`.`service_offering` ADD COLUMN `limit_cpu_use` tinyint(1) NOT NULL DEFAULT 0 ;
|
||||
|
||||
DROP TABLE IF EXISTS `cloud`.`certificate`;
|
||||
CREATE TABLE `cloud`.`keystore` (
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user