You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by pr...@apache.org on 2013/03/14 23:35:17 UTC
[32/50] [abbrv] git commit: refs/heads/affinity_groups -
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/2e50af22
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/2e50af22
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/2e50af22
Branch: refs/heads/affinity_groups
Commit: 2e50af22dcefa0e4ac69e4bfaf25a01496769077
Parents: e69fe41
Author: Wido den Hollander <wi...@widodh.nl>
Authored: Wed Feb 27 16:11:04 2013 +0100
Committer: Prachi Damle <pr...@cloud.com>
Committed: Thu Mar 14 15:13:18 2013 -0700
----------------------------------------------------------------------
.../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/2e50af22/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/2e50af22/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();