You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by bf...@apache.org on 2013/02/27 17:37:48 UTC
[33/39] git commit: refs/heads/ui-regions - CLOUDSTACK-1410: >4.1
agents should be able to communicatie with <=4.1 management servers
CLOUDSTACK-1410: >4.1 agents should be able to communicatie with <=4.1 management servers
The recently added overcommit feature breaks compatibility between older management servers
and 4.2 agents.
This patch fixes that by falling back if needed.
Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/2e28f69d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/2e28f69d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/2e28f69d
Branch: refs/heads/ui-regions
Commit: 2e28f69d3ea540f29c2634c1726b2bb3d0689ec2
Parents: ddd507b
Author: Wido den Hollander <wi...@widodh.nl>
Authored: Wed Feb 27 16:11:04 2013 +0100
Committer: Wido den Hollander <wi...@widodh.nl>
Committed: Wed Feb 27 16:23:21 2013 +0100
----------------------------------------------------------------------
.../com/cloud/agent/api/to/VirtualMachineTO.java | 16 +++++++++++++++
.../kvm/resource/LibvirtComputingResource.java | 16 ++++++++++++++-
2 files changed, 31 insertions(+), 1 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/2e28f69d/api/src/com/cloud/agent/api/to/VirtualMachineTO.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/to/VirtualMachineTO.java b/api/src/com/cloud/agent/api/to/VirtualMachineTO.java
index bdd636e..99eac6b 100644
--- a/api/src/com/cloud/agent/api/to/VirtualMachineTO.java
+++ b/api/src/com/cloud/agent/api/to/VirtualMachineTO.java
@@ -28,8 +28,20 @@ public class VirtualMachineTO {
private BootloaderType bootloader;
Type type;
int cpus;
+
+ /**
+ 'speed' is still here since 4.0.X/4.1.X management servers do not support
+ the overcommit feature yet.
+
+ The overcommit feature sends minSpeed and maxSpeed
+
+ So this is here for backwards compatibility with 4.0.X/4.1.X management servers
+ and newer agents.
+ */
+ Integer speed;
Integer minSpeed;
Integer maxSpeed;
+
long minRam;
long maxRam;
String hostName;
@@ -103,6 +115,10 @@ public class VirtualMachineTO {
this.cpus = cpus;
}
+ public Integer getSpeed() {
+ return speed;
+ }
+
public Integer getMinSpeed() {
return minSpeed;
}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/2e28f69d/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
----------------------------------------------------------------------
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 99b8723..805de40 100755
--- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
+++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
@@ -2934,7 +2934,21 @@ ServerResource {
vm.addComp(grd);
CpuTuneDef ctd = new CpuTuneDef();
- ctd.setShares(vmTO.getCpus() * vmTO.getMinSpeed());
+ /**
+ A 4.0.X/4.1.X management server doesn't send the correct JSON
+ command for getMinSpeed, it only sends a 'speed' field.
+
+ So if getMinSpeed() returns null we fall back to getSpeed().
+
+ This way a >4.1 agent can work communicate a <=4.1 management server
+
+ This change is due to the overcommit feature in 4.2
+ */
+ if (vmTO.getMinSpeed() != null) {
+ ctd.setShares(vmTO.getCpus() * vmTO.getMinSpeed());
+ } else {
+ ctd.setShares(vmTO.getCpus() * vmTO.getSpeed());
+ }
vm.addComp(ctd);
FeaturesDef features = new FeaturesDef();