CLOUDSTACK-9626: Instance fails to start after unsuccesful compute

offering  upgrade.
This commit is contained in:
Sudhansu 2016-11-29 10:48:04 +05:30
parent f231c8cd98
commit 542a2112ba
1 changed files with 5 additions and 3 deletions

View File

@ -1759,13 +1759,15 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
} finally {
if (!success) {
_itMgr.upgradeVmDb(vmId, currentServiceOffering.getId()); // rollback
if (newServiceOffering.isDynamic()) {
removeCustomOfferingDetails(vmId);
}
// Decrement CPU and Memory count accordingly.
if (newCpu > currentCpu) {
_resourceLimitMgr.decrementResourceCount(caller.getAccountId(), ResourceType.cpu, new Long(newCpu - currentCpu));
}
//restoring old service offering will take care of removing new SO.
if(currentServiceOffering.isDynamic()){
saveCustomOfferingDetails(vmId, currentServiceOffering);
}
if (memoryDiff > 0) {
_resourceLimitMgr.decrementResourceCount(caller.getAccountId(), ResourceType.memory, new Long(memoryDiff));