bug 8463: Decrease the resource_count if vm fails to Start and goes to ERROR state.

status 8463: resolved fixed
This commit is contained in:
nit 2011-02-08 16:22:57 +05:30
parent 2a6bef2750
commit a3b1609199
2 changed files with 5 additions and 3 deletions

View File

@ -2081,11 +2081,11 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager
if (group != null) {
boolean addToGroup = addInstanceToGroup(Long.valueOf(id), group);
if (!addToGroup) {
throw new CloudRuntimeException("Unable to assing Vm to the group " + group);
throw new CloudRuntimeException("Unable to assign Vm to the group " + group);
}
}
} catch (Exception ex) {
throw new CloudRuntimeException("Unable to assing Vm to the group " + group);
throw new CloudRuntimeException("Unable to assign Vm to the group " + group);
}
return vm;

4
server/src/com/cloud/vm/VirtualMachineManagerImpl.java Normal file → Executable file
View File

@ -62,6 +62,7 @@ import com.cloud.capacity.CapacityManager;
import com.cloud.cluster.ClusterManager;
import com.cloud.configuration.Config;
import com.cloud.configuration.ConfigurationManager;
import com.cloud.configuration.ResourceCount.ResourceType;
import com.cloud.configuration.dao.ConfigurationDao;
import com.cloud.consoleproxy.ConsoleProxyManager;
import com.cloud.dc.DataCenter;
@ -619,7 +620,8 @@ public class VirtualMachineManagerImpl implements VirtualMachineManager, StateLi
}
if (dest == null) {
throw new InsufficientServerCapacityException("Unable to create a deployment for " + vmProfile, DataCenter.class, plan.getDataCenterId());
_accountMgr.decrementResourceCount(vm.getAccountId(), ResourceType.user_vm);
throw new InsufficientServerCapacityException("Unable to create a deployment for " + vmProfile, DataCenter.class, plan.getDataCenterId());
}
long destHostId = dest.getHost().getId();