From 65a55ff7b1f80835b8c7b0e6cc01dbeb8f1d7d1e Mon Sep 17 00:00:00 2001 From: anthony Date: Thu, 30 Dec 2010 11:50:13 -0800 Subject: [PATCH] bug 7215: it may be caused by following result 1. there is no hosts up in this cluster, then there is no host we can send remove from pool command. 2. pool-eject failed in above cases, the host is still removed from cloudstack, and alert is sent out to require run pool-eject manually status 7215: resolved fixed Conflicts: server/src/com/cloud/agent/manager/AgentManagerImpl.java --- .../com/cloud/agent/manager/AgentManagerImpl.java | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/server/src/com/cloud/agent/manager/AgentManagerImpl.java b/server/src/com/cloud/agent/manager/AgentManagerImpl.java index 9f9137a2dd4..87b95e1b6dc 100755 --- a/server/src/com/cloud/agent/manager/AgentManagerImpl.java +++ b/server/src/com/cloud/agent/manager/AgentManagerImpl.java @@ -107,6 +107,7 @@ import com.cloud.exception.ConnectionException; import com.cloud.exception.DiscoveryException; import com.cloud.exception.InsufficientServerCapacityException; import com.cloud.exception.InvalidParameterValueException; +import com.cloud.exception.InternalErrorException; import com.cloud.exception.OperationTimedoutException; import com.cloud.exception.UnsupportedVersionException; import com.cloud.ha.HighAvailabilityManager; @@ -866,13 +867,10 @@ public class AgentManagerImpl implements AgentManager, HandlerFactory, ResourceS if (host.getType() == Type.Routing && host.getHypervisorType() == HypervisorType.XenServer ) { if (host.getClusterId() != null) { List hosts = _hostDao.listBy(Type.Routing, host.getClusterId(), host.getPodId(), host.getDataCenterId()); + hosts.add(host); boolean success = true; for( HostVO thost: hosts ) { - long thostId = thost.getId(); - if( thostId == hostId ) { - continue; - } - + long thostId = thost.getId(); PoolEjectCommand eject = new PoolEjectCommand(host.getGuid()); Answer answer = easySend(thostId, eject); if( answer != null && answer.getResult()) { @@ -885,8 +883,11 @@ public class AgentManagerImpl implements AgentManager, HandlerFactory, ResourceS } } if( !success ){ - throw new CloudRuntimeException("Unable to delete host " + hostId + " due to unable to eject it from pool"); - } + String msg = "Unable to eject host " + host.getGuid() + " due to there is no host up in this cluster, please execute xe pool-eject host-uuid=" + + host.getGuid() + "in this host " + host.getPrivateIpAddress(); + s_logger.info(msg); + _alertMgr.sendAlert(AlertManager.ALERT_TYPE_HOST, host.getDataCenterId(), host.getPodId(),"Unable to eject host " + host.getGuid(), msg); + } } } txn.start();