Updated Branches:
  refs/heads/master ade13bb77 -> 8ef097ef6

CLOUDSTACK-3669:  Bringing down the dynamic scalable check (for VM whether it 
has xstools or vmware tools in it) to the management layer.
Signed off by : Nitin Mehta <nitin.me...@citrix.com>


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/8ef097ef
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/8ef097ef
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/8ef097ef

Branch: refs/heads/master
Commit: 8ef097ef6e73134c09b05c967ece6b795d857581
Parents: ade13bb
Author: Harikrishna Patnala <harikrishna.patn...@citrix.com>
Authored: Mon Jul 29 15:10:43 2013 +0530
Committer: Nitin Mehta <nitin.me...@citrix.com>
Committed: Mon Jul 29 15:16:21 2013 +0530

----------------------------------------------------------------------
 core/src/com/cloud/agent/api/ScaleVmCommand.java          |  3 +--
 .../cloud/hypervisor/xen/resource/CitrixResourceBase.java |  4 ----
 server/src/com/cloud/vm/UserVmManagerImpl.java            |  4 ++++
 server/src/com/cloud/vm/VirtualMachineManagerImpl.java    | 10 +---------
 .../test/com/cloud/vm/VirtualMachineManagerImplTest.java  |  2 +-
 5 files changed, 7 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8ef097ef/core/src/com/cloud/agent/api/ScaleVmCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/ScaleVmCommand.java 
b/core/src/com/cloud/agent/api/ScaleVmCommand.java
index 83cdcac..b361485 100644
--- a/core/src/com/cloud/agent/api/ScaleVmCommand.java
+++ b/core/src/com/cloud/agent/api/ScaleVmCommand.java
@@ -41,7 +41,7 @@ public class ScaleVmCommand extends Command {
        }
 
        public ScaleVmCommand(String vmName, int cpus,
-                       Integer minSpeed, Integer maxSpeed, long minRam, long 
maxRam, boolean limitCpuUse, boolean isDynamicallyScalable) {
+                       Integer minSpeed, Integer maxSpeed, long minRam, long 
maxRam, boolean limitCpuUse) {
                super();
                this.vmName = vmName;
                this.cpus = cpus;
@@ -50,7 +50,6 @@ public class ScaleVmCommand extends Command {
                this.minRam = minRam;
                this.maxRam = maxRam;
                this.vm = new VirtualMachineTO(1L, vmName, null, cpus, 
minSpeed, maxSpeed, minRam, maxRam, null, null, false, limitCpuUse, null);
-        vm.setEnableDynamicallyScaleVm(isDynamicallyScalable);
                /*vm.setName(vmName);
                vm.setCpus(cpus);
                vm.setRam(minRam, maxRam);*/

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8ef097ef/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
----------------------------------------------------------------------
diff --git 
a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
 
b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
index 7173f0b..4ab4100 100644
--- 
a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
+++ 
b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
@@ -688,10 +688,6 @@ public abstract class CitrixResourceBase implements 
ServerResource, HypervisorRe
                 throw new CloudRuntimeException("Unable to scale the vm: " + 
vmName + " as DMC - Dynamic memory control is not enabled for the XenServer:" + 
_host.uuid + " ,check your license and hypervisor version.");
             }
 
-            if(!vmSpec.isEnableDynamicallyScaleVm()) {
-                throw new CloudRuntimeException("Unable to Scale the vm: " + 
vmName + "as vm does not have xs tools to support dynamic scaling");
-            }
-
             // stop vm which is running on this host or is in halted state
             Iterator<VM> iter = vms.iterator();
             while ( iter.hasNext() ) {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8ef097ef/server/src/com/cloud/vm/UserVmManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/vm/UserVmManagerImpl.java 
b/server/src/com/cloud/vm/UserVmManagerImpl.java
index 34f3de2..c950b4b 100755
--- a/server/src/com/cloud/vm/UserVmManagerImpl.java
+++ b/server/src/com/cloud/vm/UserVmManagerImpl.java
@@ -1189,6 +1189,10 @@ public class UserVmManagerImpl extends ManagerBase 
implements UserVmManager, Vir
             if(!enableDynamicallyScaleVm){
                throw new PermissionDeniedException("Dynamically scaling 
virtual machines is disabled for this zone, please contact your admin");
             }
+            UserVmDetailVO vmDetailVO = _vmDetailsDao.findDetail(vmId, 
VirtualMachine.IsDynamicScalingEnabled);
+            if (vmDetailVO == null || 
!Boolean.parseBoolean(vmDetailVO.getValue())) {
+                throw new CloudRuntimeException("Unable to Scale the vm: " + 
vmInstance.getUuid() + " as vm does not have xs tools to support dynamic 
scaling");
+            }
 
             while (retry-- != 0) { // It's != so that it can match -1.
                 try{

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8ef097ef/server/src/com/cloud/vm/VirtualMachineManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/vm/VirtualMachineManagerImpl.java 
b/server/src/com/cloud/vm/VirtualMachineManagerImpl.java
index 1fb118f..a49a297 100755
--- a/server/src/com/cloud/vm/VirtualMachineManagerImpl.java
+++ b/server/src/com/cloud/vm/VirtualMachineManagerImpl.java
@@ -3275,14 +3275,6 @@ public class VirtualMachineManagerImpl extends 
ManagerBase implements VirtualMac
     public VMInstanceVO reConfigureVm(VMInstanceVO vm, ServiceOffering 
oldServiceOffering, boolean reconfiguringOnExistingHost) throws 
ResourceUnavailableException,
             ConcurrentOperationException {
 
-        UserVmDetailVO vmDetailVO = _uservmDetailsDao.findDetail(vm.getId(), 
VirtualMachine.IsDynamicScalingEnabled);
-        Boolean isDynamicallyScalable;
-        if (vmDetailVO == null) {
-            isDynamicallyScalable = false;
-        } else {
-            isDynamicallyScalable = (vmDetailVO.getValue()).equals("true");
-        }
-
         long newServiceofferingId = vm.getServiceOfferingId();
         ServiceOffering newServiceOffering = 
_configMgr.getServiceOffering(newServiceofferingId);
         HostVO hostVo = _hostDao.findById(vm.getHostId());
@@ -3294,7 +3286,7 @@ public class VirtualMachineManagerImpl extends 
ManagerBase implements VirtualMac
         long minMemory = (long)(newServiceOffering.getRamSize() / 
memoryOvercommitRatio);
         ScaleVmCommand reconfigureCmd = new 
ScaleVmCommand(vm.getInstanceName(), newServiceOffering.getCpu(),
                 (int)(newServiceOffering.getSpeed() / cpuOvercommitRatio), 
newServiceOffering.getSpeed(), minMemory * 1024L * 1024L,
-                newServiceOffering.getRamSize() * 1024L * 1024L, 
newServiceOffering.getLimitCpuUse(), isDynamicallyScalable);
+                newServiceOffering.getRamSize() * 1024L * 1024L, 
newServiceOffering.getLimitCpuUse());
 
         Long dstHostId = vm.getHostId();
         ItWorkVO work = new ItWorkVO(UUID.randomUUID().toString(), _nodeId, 
State.Running, vm.getType(), vm.getId());

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8ef097ef/server/test/com/cloud/vm/VirtualMachineManagerImplTest.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/vm/VirtualMachineManagerImplTest.java 
b/server/test/com/cloud/vm/VirtualMachineManagerImplTest.java
index 56b14cd..7882b19 100644
--- a/server/test/com/cloud/vm/VirtualMachineManagerImplTest.java
+++ b/server/test/com/cloud/vm/VirtualMachineManagerImplTest.java
@@ -278,7 +278,7 @@ public class VirtualMachineManagerImplTest {
         
when(_configServer.getConfigValue(Config.CPUOverprovisioningFactor.key(), 
Config.ConfigurationParameterScope.cluster.toString(), 1L)).thenReturn("1.0");
         ScaleVmCommand reconfigureCmd = new ScaleVmCommand("myVmName", 
newServiceOffering.getCpu(),
                 newServiceOffering.getSpeed(), newServiceOffering.getSpeed(), 
newServiceOffering.getRamSize(), newServiceOffering.getRamSize(),
-                newServiceOffering.getLimitCpuUse(), true);
+                newServiceOffering.getLimitCpuUse());
         Answer answer = new ScaleVmAnswer(reconfigureCmd, true, "details");
         when(_agentMgr.send(2l, reconfigureCmd)).thenReturn(null);
         _vmMgr.reConfigureVm(_vmInstance, getSvcoffering(256), false);

Reply via email to