CLOUDSTACK-249: Add hostId to failed VM deploy alerts Signed-off-by: Rohit Yadav <bhais...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/71835018 Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/71835018 Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/71835018 Branch: refs/heads/regions Commit: 71835018e53c4d60b228392535c2a04fce7a76aa Parents: 4ad38f8 Author: Andrew Bayer <andrew.ba...@gmail.com> Authored: Mon Jan 28 15:27:09 2013 -0800 Committer: Rohit Yadav <bhais...@apache.org> Committed: Mon Jan 28 15:27:09 2013 -0800 ---------------------------------------------------------------------- server/src/com/cloud/vm/UserVmManagerImpl.java | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/71835018/server/src/com/cloud/vm/UserVmManagerImpl.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/vm/UserVmManagerImpl.java b/server/src/com/cloud/vm/UserVmManagerImpl.java index 5891056..ecf1242 100644 --- a/server/src/com/cloud/vm/UserVmManagerImpl.java +++ b/server/src/com/cloud/vm/UserVmManagerImpl.java @@ -1593,14 +1593,14 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager } // used for vm transitioning to error state - private void updateVmStateForFailedVmCreation(Long vmId) { + private void updateVmStateForFailedVmCreation(Long vmId, Long hostId) { UserVmVO vm = _vmDao.findById(vmId); if (vm != null) { if (vm.getState().equals(State.Stopped)) { - s_logger.debug("Destroying vm " + vm + " as it failed to create"); + s_logger.debug("Destroying vm " + vm + " as it failed to create on Host with Id:" + hostId); try { _itMgr.stateTransitTo(vm, VirtualMachine.Event.OperationFailedToError, null); } catch (NoTransitionException e1) { @@ -1618,7 +1618,7 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager s_logger.warn("Unable to delete volume:" + volume.getId() + " for vm:" + vmId + " whilst transitioning to error state"); } } - String msg = "Failed to deploy Vm with Id: " + vmId; + String msg = "Failed to deploy Vm with Id: " + vmId + ", on Host with Id: " + hostId; _alertMgr.sendAlert(AlertManager.ALERT_TYPE_USERVM, vm.getDataCenterIdToDeployIn(), vm.getPodIdToDeployIn(), msg, msg); _resourceLimitMgr.decrementResourceCount(vm.getAccountId(), ResourceType.user_vm); @@ -2550,9 +2550,9 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager Pair<UserVmVO, Map<VirtualMachineProfile.Param, Object>> vmParamPair = null; try { vmParamPair = startVirtualMachine(vmId, hostId, additonalParams); - vm = vmParamPair.first();; + vm = vmParamPair.first(); } finally { - updateVmStateForFailedVmCreation(vm.getId()); + updateVmStateForFailedVmCreation(vm.getId(), hostId); } // Check that the password was passed in and is valid