mirror of
				https://github.com/apache/cloudstack.git
				synced 2025-10-26 08:42:29 +01:00 
			
		
		
		
	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.mehta@citrix.com>
This commit is contained in:
		
							parent
							
								
									ade13bb773
								
							
						
					
					
						commit
						8ef097ef6e
					
				| @ -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);*/ | ||||
|  | ||||
| @ -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() ) { | ||||
|  | ||||
| @ -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{ | ||||
|  | ||||
| @ -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()); | ||||
|  | ||||
| @ -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); | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user