Search in sources :

Example 1 with PropagateResourceEventCommand

use of com.cloud.agent.api.PropagateResourceEventCommand in project cloudstack by apache.

the class ResourceManagerImpl method propagateResourceEvent.

public Boolean propagateResourceEvent(final long agentId, final ResourceState.Event event) throws AgentUnavailableException {
    final String msPeer = getPeerName(agentId);
    if (msPeer == null) {
        return null;
    }
    if (s_logger.isDebugEnabled()) {
        s_logger.debug("Propagating agent change request event:" + event.toString() + " to agent:" + agentId);
    }
    final Command[] cmds = new Command[1];
    cmds[0] = new PropagateResourceEventCommand(agentId, event);
    final String AnsStr = _clusterMgr.execute(msPeer, agentId, _gson.toJson(cmds), true);
    if (AnsStr == null) {
        throw new AgentUnavailableException(agentId);
    }
    final Answer[] answers = _gson.fromJson(AnsStr, Answer[].class);
    if (s_logger.isDebugEnabled()) {
        s_logger.debug("Result for agent change is " + answers[0].getResult());
    }
    return answers[0].getResult();
}
Also used : UnsupportedAnswer(com.cloud.agent.api.UnsupportedAnswer) GetGPUStatsAnswer(com.cloud.agent.api.GetGPUStatsAnswer) MaintainAnswer(com.cloud.agent.api.MaintainAnswer) GetHostStatsAnswer(com.cloud.agent.api.GetHostStatsAnswer) Answer(com.cloud.agent.api.Answer) PropagateResourceEventCommand(com.cloud.agent.api.PropagateResourceEventCommand) MaintainCommand(com.cloud.agent.api.MaintainCommand) StartupRoutingCommand(com.cloud.agent.api.StartupRoutingCommand) Command(com.cloud.agent.api.Command) StartupCommand(com.cloud.agent.api.StartupCommand) PropagateResourceEventCommand(com.cloud.agent.api.PropagateResourceEventCommand) GetGPUStatsCommand(com.cloud.agent.api.GetGPUStatsCommand) UpdateHostPasswordCommand(com.cloud.agent.api.UpdateHostPasswordCommand) GetHostStatsCommand(com.cloud.agent.api.GetHostStatsCommand) AgentUnavailableException(com.cloud.exception.AgentUnavailableException)

Aggregations

Answer (com.cloud.agent.api.Answer)1 Command (com.cloud.agent.api.Command)1 GetGPUStatsAnswer (com.cloud.agent.api.GetGPUStatsAnswer)1 GetGPUStatsCommand (com.cloud.agent.api.GetGPUStatsCommand)1 GetHostStatsAnswer (com.cloud.agent.api.GetHostStatsAnswer)1 GetHostStatsCommand (com.cloud.agent.api.GetHostStatsCommand)1 MaintainAnswer (com.cloud.agent.api.MaintainAnswer)1 MaintainCommand (com.cloud.agent.api.MaintainCommand)1 PropagateResourceEventCommand (com.cloud.agent.api.PropagateResourceEventCommand)1 StartupCommand (com.cloud.agent.api.StartupCommand)1 StartupRoutingCommand (com.cloud.agent.api.StartupRoutingCommand)1 UnsupportedAnswer (com.cloud.agent.api.UnsupportedAnswer)1 UpdateHostPasswordCommand (com.cloud.agent.api.UpdateHostPasswordCommand)1 AgentUnavailableException (com.cloud.exception.AgentUnavailableException)1