rhtyd commented on a change in pull request #3425: [WIP DO NOT MERGE] Better
tracking host maintanence success and failure
URL: https://github.com/apache/cloudstack/pull/3425#discussion_r348933547
##########
File path: server/src/main/java/com/cloud/ha/HighAvailabilityManagerImpl.java
##########
@@ -629,23 +636,31 @@ protected Long restart(final HaWorkVO work) {
public Long migrate(final HaWorkVO work) {
long vmId = work.getInstanceId();
-
long srcHostId = work.getHostId();
+
+ VMInstanceVO vm = _instanceDao.findById(vmId);
+ if (vm == null) {
+ return null;
+ }
+ s_logger.info("Migration attempt: for VM " + vm.getUuid() + "from host
id " + srcHostId +
+ ". Retry count: " + work.getTimesTried() + "/" + _maxRetries +
" times.");
try {
work.setStep(Step.Migrating);
_haDao.update(work.getId(), work);
- VMInstanceVO vm = _instanceDao.findById(vmId);
- if (vm == null) {
- return null;
- }
// First try starting the vm with its original planner, if it
doesn't succeed send HAPlanner as its an emergency.
_itMgr.migrateAway(vm.getUuid(), srcHostId);
return null;
} catch (InsufficientServerCapacityException e) {
- s_logger.warn("Insufficient capacity for migrating a VM.");
+ s_logger.warn("Migration attempt: Insufficient capacity for
migrating a VM " +
+ vm.getUuid() + " from source host id " + srcHostId +
+ ". Exception: " + e.getMessage());
_resourceMgr.maintenanceFailed(srcHostId);
return (System.currentTimeMillis() >> 10) + _migrateRetryInterval;
+ } catch (Exception e) {
Review comment:
Note - we need to check if on any exception, if `
_resourceMgr.maintenanceFailed(srcHostId);` should still be called?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services