From ba77d3b4314cee6154ca0ce64f992856cd33f239 Mon Sep 17 00:00:00 2001 From: Alex Huang Date: Wed, 16 Feb 2011 15:11:47 -0800 Subject: [PATCH] bug 8529: Fixed the issue that if fencing didn't work, ha still thinks it has been fenced --- .../cloud/ha/HighAvailabilityManagerImpl.java | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/server/src/com/cloud/ha/HighAvailabilityManagerImpl.java b/server/src/com/cloud/ha/HighAvailabilityManagerImpl.java index bd20eb9bdc1..903fac45070 100644 --- a/server/src/com/cloud/ha/HighAvailabilityManagerImpl.java +++ b/server/src/com/cloud/ha/HighAvailabilityManagerImpl.java @@ -385,22 +385,27 @@ public class HighAvailabilityManagerImpl implements HighAvailabilityManager { } boolean fenced = false; - if (alive == null || !alive) { - fenced = true; + if (alive == null) { s_logger.debug("Fencing off VM that we don't know the state of"); Enumeration enfb = _fenceBuilders.enumeration(); while (enfb.hasMoreElements()) { - final FenceBuilder fb = enfb.nextElement(); + FenceBuilder fb = enfb.nextElement(); Boolean result = fb.fenceOff(vm, host); - if (result != null && !result) { - fenced = false; + if (s_logger.isDebugEnabled()) { + s_logger.debug("Fencer " + fb.getName() + " returned " + result); + } + if (result != null && result) { + fenced = true; + break; } } + } else if (!alive) { + fenced = true; } - if (alive== null && !fenced) { + if (!fenced) { s_logger.debug("We were unable to fence off the VM " + vm.toString()); - _alertMgr.sendAlert(alertType, vm.getDataCenterId(), vm.getPodId(), "Unable to restart " + vm.getName() + " which was running on host " + hostDesc, "Insufficient capcity to restart VM, name: " + vm.getName() + ", id: " + vmId + " which was running on host " + hostDesc); + _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 (System.currentTimeMillis() >> 10) + _restartRetryInterval; }