CLOUDSTACK-3551: scaling up VM to service offering with 2gbram

Fixed the type overflow of Ram value.
Signed off by : Nitin Mehta<nitin.mehta@citrix.com>
This commit is contained in:
Harikrishna Patnala 2013-07-18 11:41:29 +05:30 committed by Nitin Mehta
parent f5bd253b2b
commit b4662af0a9
3 changed files with 3 additions and 3 deletions

View File

@ -109,7 +109,7 @@ public class BareMetalPlanner extends AdapterBase implements DeploymentPlanner {
if (target == null) {
s_logger.warn("Cannot find host with tag " + hostTag + " use capacity from service offering");
cpu_requested = offering.getCpu() * offering.getSpeed();
ram_requested = offering.getRamSize() * 1024 * 1024;
ram_requested = offering.getRamSize() * 1024L * 1024L;
} else {
cpu_requested = target.getCpus() * target.getSpeed().intValue();
ram_requested = target.getTotalMemory();

View File

@ -485,7 +485,7 @@ public class CapacityManagerImpl extends ManagerBase implements CapacityManager,
if(_vmSnapshotDao.listByParent(vmSnapshotVO.getId()).size() == 0)
pathCount++;
if(vmSnapshotVO.getType() == VMSnapshot.Type.DiskAndMemory)
memorySnapshotSize += (offering.getRamSize() * 1024 * 1024);
memorySnapshotSize += (offering.getRamSize() * 1024L * 1024L);
}
if(pathCount <= 1)
totalSize = totalSize + memorySnapshotSize;

View File

@ -3363,7 +3363,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
Float cpuOvercommitRatio = Float.parseFloat(_configServer.getConfigValue(Config.CPUOverprovisioningFactor.key(), Config.ConfigurationParameterScope.cluster.toString(), hostVo.getClusterId()));
long minMemory = (long) (newServiceOffering.getRamSize()/memoryOvercommitRatio);
ScaleVmCommand reconfigureCmd = new ScaleVmCommand(vm.getInstanceName(), newServiceOffering.getCpu(),
(int) (newServiceOffering.getSpeed()/cpuOvercommitRatio), newServiceOffering.getSpeed(), minMemory * 1024 * 1024, newServiceOffering.getRamSize() * 1024 * 1024, newServiceOffering.getLimitCpuUse(), isDynamicallyScalable);
(int) (newServiceOffering.getSpeed()/cpuOvercommitRatio), newServiceOffering.getSpeed(), minMemory * 1024L * 1024L, newServiceOffering.getRamSize() * 1024L * 1024L, newServiceOffering.getLimitCpuUse(), isDynamicallyScalable);
Long dstHostId = vm.getHostId();
ItWorkVO work = new ItWorkVO(UUID.randomUUID().toString(), _nodeId, State.Running, vm.getType(), vm.getId());