diff --git a/server/src/com/cloud/ha/HighAvailabilityManagerImpl.java b/server/src/com/cloud/ha/HighAvailabilityManagerImpl.java index bec1e2a1319..ac7dbd17b8e 100644 --- a/server/src/com/cloud/ha/HighAvailabilityManagerImpl.java +++ b/server/src/com/cloud/ha/HighAvailabilityManagerImpl.java @@ -761,9 +761,25 @@ public class HighAvailabilityManagerImpl extends ManagerBase implements HighAvai work.setDateTaken(null); } + private long getRescheduleTime(WorkType workType) { + switch (workType) { + case Migration: + return ((System.currentTimeMillis() >> 10) + _migrateRetryInterval); + case HA: + return ((System.currentTimeMillis() >> 10) + _restartRetryInterval); + case Stop: + case CheckStop: + case ForceStop: + return ((System.currentTimeMillis() >> 10) + _stopRetryInterval); + case Destroy: + return ((System.currentTimeMillis() >> 10) + _restartRetryInterval); + } + return 0; + } + private void processWork(final HaWorkVO work) { + final WorkType wt = work.getWorkType(); try { - final WorkType wt = work.getWorkType(); Long nextTime = null; if (wt == WorkType.Migration) { nextTime = migrate(work); @@ -787,7 +803,7 @@ public class HighAvailabilityManagerImpl extends ManagerBase implements HighAvai } catch (Exception e) { s_logger.warn("Encountered unhandled exception during HA process, reschedule work", e); - long nextTime = (System.currentTimeMillis() >> 10) + _restartRetryInterval; + long nextTime = getRescheduleTime(wt); rescheduleWork(work, nextTime); // if restart failed in the middle due to exception, VM state may has been changed