Repository: cloudstack Updated Branches: refs/heads/master a9ace22fb -> 90feab18e
Bug-ID:CS-27160: Restore VM (Re-install VM) with enable.storage.migration set to false fails, later fails to start up VM too Reviewed-By: Anthony Changes: - Try to reuse the storage pools for READY disks if the pool fits the deployment plan - Try to use the last_host if it has free capacity but no reserved capacity Signed-off-by: Maneesha.P <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/a3e87cfa Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/a3e87cfa Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/a3e87cfa Branch: refs/heads/master Commit: a3e87cfa951a4905d8d5259840d6c751684df1d6 Parents: 3df847d Author: Prachi Damle <[email protected]> Authored: Thu Nov 20 15:55:37 2014 -0800 Committer: Maneesha.P <[email protected]> Committed: Thu Aug 6 00:19:18 2015 +0530 ---------------------------------------------------------------------- .../deploy/DeploymentPlanningManagerImpl.java | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a3e87cfa/server/src/com/cloud/deploy/DeploymentPlanningManagerImpl.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/deploy/DeploymentPlanningManagerImpl.java b/server/src/com/cloud/deploy/DeploymentPlanningManagerImpl.java index 57abb92..75bc4b5 100644 --- a/server/src/com/cloud/deploy/DeploymentPlanningManagerImpl.java +++ b/server/src/com/cloud/deploy/DeploymentPlanningManagerImpl.java @@ -400,10 +400,21 @@ StateListener<State, VirtualMachine.Event, VirtualMachine> { "memoryOvercommitRatio"); Float cpuOvercommitRatio = Float.parseFloat(cluster_detail_cpu.getValue()); Float memoryOvercommitRatio = Float.parseFloat(cluster_detail_ram.getValue()); - if (_capacityMgr.checkIfHostHasCapacity(host.getId(), cpu_requested, ram_requested, true, - cpuOvercommitRatio, memoryOvercommitRatio, true) - && _capacityMgr.checkIfHostHasCpuCapability(host.getId(), offering.getCpu(), - offering.getSpeed())) { + + boolean hostHasCpuCapability, hostHasCapacity = false; + hostHasCpuCapability = _capacityMgr.checkIfHostHasCpuCapability(host.getId(), offering.getCpu(), offering.getSpeed()); + + if (hostHasCpuCapability) { + // first check from reserved capacity + hostHasCapacity = _capacityMgr.checkIfHostHasCapacity(host.getId(), cpu_requested, ram_requested, true, cpuOvercommitRatio, memoryOvercommitRatio, true); + + // if not reserved, check the free capacity + if (!hostHasCapacity) + hostHasCapacity = _capacityMgr.checkIfHostHasCapacity(host.getId(), cpu_requested, ram_requested, false, cpuOvercommitRatio, memoryOvercommitRatio, true); + } + + if (hostHasCapacity + && hostHasCpuCapability) { s_logger.debug("The last host of this VM is UP and has enough capacity"); s_logger.debug("Now checking for suitable pools under zone: " + host.getDataCenterId() + ", pod: " + host.getPodId() + ", cluster: " + host.getClusterId());
