Skip to content

Commit a7f3e1e

Browse files
Edison Susudison
authored andcommitted
CLOUDSTACK-4300: possible fix: cputune feature is only available after 0.9.0, so start vm can fail on rhel 6.1
1 parent c09bbd3 commit a7f3e1e

1 file changed

Lines changed: 15 additions & 13 deletions

File tree

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

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3382,23 +3382,25 @@ protected LibvirtVMDef createVMFromSpec(VirtualMachineTO vmTO) {
33823382
cmd.setModel(_guestCpuModel);
33833383
vm.addComp(cmd);
33843384

3385-
CpuTuneDef ctd = new CpuTuneDef();
3386-
/**
3387-
A 4.0.X/4.1.X management server doesn't send the correct JSON
3388-
command for getMinSpeed, it only sends a 'speed' field.
3385+
if (_hypervisorLibvirtVersion >= 9000) {
3386+
CpuTuneDef ctd = new CpuTuneDef();
3387+
/**
3388+
A 4.0.X/4.1.X management server doesn't send the correct JSON
3389+
command for getMinSpeed, it only sends a 'speed' field.
33893390
3390-
So if getMinSpeed() returns null we fall back to getSpeed().
3391+
So if getMinSpeed() returns null we fall back to getSpeed().
33913392
3392-
This way a >4.1 agent can work communicate a <=4.1 management server
3393+
This way a >4.1 agent can work communicate a <=4.1 management server
33933394
3394-
This change is due to the overcommit feature in 4.2
3395-
*/
3396-
if (vmTO.getMinSpeed() != null) {
3397-
ctd.setShares(vmTO.getCpus() * vmTO.getMinSpeed());
3398-
} else {
3399-
ctd.setShares(vmTO.getCpus() * vmTO.getSpeed());
3395+
This change is due to the overcommit feature in 4.2
3396+
*/
3397+
if (vmTO.getMinSpeed() != null) {
3398+
ctd.setShares(vmTO.getCpus() * vmTO.getMinSpeed());
3399+
} else {
3400+
ctd.setShares(vmTO.getCpus() * vmTO.getSpeed());
3401+
}
3402+
vm.addComp(ctd);
34003403
}
3401-
vm.addComp(ctd);
34023404

34033405
FeaturesDef features = new FeaturesDef();
34043406
features.addFeatures("pae");

0 commit comments

Comments
 (0)