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 <maneesha.papireddygari@citrix.com>
This commit is contained in:
Prachi Damle 2014-11-20 15:55:37 -08:00 committed by Maneesha.P
parent 3df847dfbb
commit a3e87cfa95
1 changed files with 15 additions and 4 deletions

View File

@ -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());