bug 8609: when failed to start a VM in HA (due to domr is not migrated), a runtimeException is thrown out, caused HA for this VM is not resheduced.

status 8609: resolved fixed
This commit is contained in:
anthony 2011-02-16 14:17:56 -08:00
parent 2d262894d1
commit 80a328034c
2 changed files with 10 additions and 13 deletions

View File

@ -446,27 +446,24 @@ public class HighAvailabilityManagerImpl implements HighAvailabilityManager, Clu
if (s_logger.isDebugEnabled()) {
s_logger.debug("Rescheduling VM " + vm.toString() + " to try again in " + _restartRetryInterval);
}
vm = _itMgr.findById(vm.getType(), vm.getId());
work.setUpdateTime(vm.getUpdated());
work.setPreviousState(vm.getState());
return (System.currentTimeMillis() >> 10) + _restartRetryInterval;
} catch (final InsufficientCapacityException e) {
s_logger.warn("Unable to restart " + vm.toString() + " due to " + e.getMessage());
_alertMgr.sendAlert(alertType, vm.getDataCenterId(), vm.getPodId(), "Unable to restart " + vm.getName() + " which was running on host " + hostDesc, "Insufficient capacity to restart VM, name: " + vm.getName() + ", id: " + vmId + " which was running on host " + hostDesc);
return null;
} catch (final ResourceUnavailableException e) {
s_logger.warn("Unable to restart " + vm.toString() + " due to " + e.getMessage());
_alertMgr.sendAlert(alertType, vm.getDataCenterId(), vm.getPodId(), "Unable to restart " + vm.getName() + " which was running on host " + hostDesc, "The Storage is unavailable for trying to restart VM, name: " + vm.getName() + ", id: " + vmId + " which was running on host " + hostDesc);
return null;
} catch (ConcurrentOperationException e) {
s_logger.warn("Unable to restart " + vm.toString() + " due to " + e.getMessage());
_alertMgr.sendAlert(alertType, vm.getDataCenterId(), vm.getPodId(), "Unable to restart " + vm.getName() + " which was running on host " + hostDesc, "The Storage is unavailable for trying to restart VM, name: " + vm.getName() + ", id: " + vmId + " which was running on host " + hostDesc);
return null;
} catch (OperationTimedoutException e) {
s_logger.warn("Unable to restart " + vm.toString() + " due to " + e.getMessage());
_alertMgr.sendAlert(alertType, vm.getDataCenterId(), vm.getPodId(), "Unable to restart " + vm.getName() + " which was running on host " + hostDesc, "The Storage is unavailable for trying to restart VM, name: " + vm.getName() + ", id: " + vmId + " which was running on host " + hostDesc);
return null;
}
vm = _itMgr.findById(vm.getType(), vm.getId());
work.setUpdateTime(vm.getUpdated());
work.setPreviousState(vm.getState());
return (System.currentTimeMillis() >> 10) + _restartRetryInterval;
}

View File

@ -614,24 +614,25 @@ public class VirtualMachineManagerImpl implements VirtualMachineManager, Listene
avoids.addHost(destHostId);
continue;
} catch (ResourceUnavailableException e) {
s_logger.info("Unable to contact resource.", e);
if (!avoids.add(e)) {
if (e.getScope() == Volume.class || e.getScope() == Nic.class) {
throw e;
} else {
throw new CloudRuntimeException("Resource is not available to start the VM.", e);
s_logger.warn("unexpected ResourceUnavailableException : " + e.getScope().getName(), e);
throw e;
}
}
s_logger.info("Unable to contact resource.", e);
continue;
} catch (InsufficientCapacityException e) {
s_logger.info("Insufficient capacity ", e);
if (!avoids.add(e)) {
if (e.getScope() == Volume.class || e.getScope() == Nic.class) {
throw e;
} else {
throw new CloudRuntimeException("Insufficient capacity to start the VM.", e);
s_logger.warn("unexpected InsufficientCapacityException : " + e.getScope().getName(), e);
}
}
s_logger.info("Insufficient capacity ", e);
continue;
} catch (RuntimeException e) {
s_logger.warn("Failed to start instance " + vm, e);
@ -646,7 +647,6 @@ public class VirtualMachineManagerImpl implements VirtualMachineManager, Listene
} finally {
if (startedVm == null) {
changeState(vm, Event.OperationFailed, null, work, Step.Done);
throw new CloudRuntimeException("Unable to start " + vm);
}
}