mirror of https://github.com/apache/cloudstack.git
Bug 11522 - New agent manager
move umanageHost to ResourceManager
This commit is contained in:
parent
7c5d3597a9
commit
98900717dd
|
|
@ -164,15 +164,6 @@ public interface AgentManager extends Manager {
|
|||
* @return hosts currently connected.
|
||||
*/
|
||||
Set<Long> getConnectedHosts();
|
||||
|
||||
/**
|
||||
* Obtains statistics for a host; vCPU utilisation, memory utilisation, and network utilisation
|
||||
*
|
||||
* @param hostId
|
||||
* @return HostStat
|
||||
*/
|
||||
|
||||
boolean disconnect(long hostId);
|
||||
|
||||
HostStats getHostStatistics(long hostId);
|
||||
|
||||
|
|
|
|||
|
|
@ -740,12 +740,6 @@ public class AgentManagerImpl implements AgentManager, HandlerFactory, Manager {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean disconnect(final long hostId) {
|
||||
disconnect(hostId, Event.PrepareUnmanaged, false);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateStatus(HostVO host, Status.Event event) {
|
||||
_hostDao.updateStatus(host, event, _nodeId);
|
||||
|
|
|
|||
|
|
@ -206,20 +206,6 @@ public class ClusteredAgentManagerImpl extends AgentManagerImpl implements Clust
|
|||
return new ClusteredAgentHandler(type, link, data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean disconnect(final long hostId) {
|
||||
try {
|
||||
Boolean result = _clusterMgr.propagateAgentEvent(hostId, Event.PrepareUnmanaged);
|
||||
|
||||
if (result != null) {
|
||||
return result;
|
||||
}
|
||||
} catch (AgentUnavailableException e) {
|
||||
return false;
|
||||
}
|
||||
return super.disconnect(hostId);
|
||||
}
|
||||
|
||||
protected AgentAttache createAttache(long id) {
|
||||
s_logger.debug("create forwarding ClusteredAgentAttache for " + id);
|
||||
final AgentAttache attache = new ClusteredAgentAttache(this, id);
|
||||
|
|
|
|||
|
|
@ -75,4 +75,6 @@ public interface ResourceManager {
|
|||
public boolean executeUserRequest(long hostId, ResourceState.Event event) throws AgentUnavailableException;
|
||||
|
||||
boolean updateResourceState(Host host, Event event, long msId) throws NoTransitionException;
|
||||
|
||||
boolean umanageHost(long hostId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -890,7 +890,7 @@ public class ResourceManagerImpl implements ResourceManager, ResourceService, Ma
|
|||
|
||||
for( HostVO host : hosts ) {
|
||||
if ( host.getStatus().equals(Status.Up )) {
|
||||
_agentMgr.disconnect(host.getId());
|
||||
umanageHost(host.getId());
|
||||
}
|
||||
}
|
||||
int retry = 10;
|
||||
|
|
@ -1672,5 +1672,26 @@ public class ResourceManagerImpl implements ResourceManager, ResourceService, Ma
|
|||
throw new CloudRuntimeException("Received an resource event we are not handling now, " + event);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean doUmanageHost(long hostId) {
|
||||
_agentMgr.disconnect(hostId, Status.Event.AgentDisconnected);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean umanageHost(long hostId) {
|
||||
try {
|
||||
Boolean result = _clusterMgr.propagateResourceEvent(hostId, ResourceState.Event.Unmanaged);
|
||||
|
||||
if (result != null) {
|
||||
return result;
|
||||
}
|
||||
} catch (AgentUnavailableException e) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return doUmanageHost(hostId);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue