Search in sources :

Example 1 with PropagateResourceEventCommand

use of com.cloud.legacymodel.communication.command.PropagateResourceEventCommand in project cosmic by MissionCriticalCloud.

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 = this._clusterMgr.execute(msPeer, agentId, this._gson.toJson(cmds), true);
    if (AnsStr == null) {
        throw new AgentUnavailableException(agentId);
    }
    final Answer[] answers = this._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.legacymodel.communication.answer.UnsupportedAnswer) GetHostStatsAnswer(com.cloud.legacymodel.communication.answer.GetHostStatsAnswer) Answer(com.cloud.legacymodel.communication.answer.Answer) GetGPUStatsAnswer(com.cloud.legacymodel.communication.answer.GetGPUStatsAnswer) MaintainAnswer(com.cloud.legacymodel.communication.answer.MaintainAnswer) PropagateResourceEventCommand(com.cloud.legacymodel.communication.command.PropagateResourceEventCommand) StartupCommand(com.cloud.legacymodel.communication.command.startup.StartupCommand) GetHostStatsCommand(com.cloud.legacymodel.communication.command.GetHostStatsCommand) MaintainCommand(com.cloud.legacymodel.communication.command.MaintainCommand) UpdateHostPasswordCommand(com.cloud.legacymodel.communication.command.UpdateHostPasswordCommand) Command(com.cloud.legacymodel.communication.command.Command) PropagateResourceEventCommand(com.cloud.legacymodel.communication.command.PropagateResourceEventCommand) StartupRoutingCommand(com.cloud.legacymodel.communication.command.startup.StartupRoutingCommand) GetGPUStatsCommand(com.cloud.legacymodel.communication.command.GetGPUStatsCommand) AgentUnavailableException(com.cloud.legacymodel.exceptions.AgentUnavailableException)

Aggregations

Answer (com.cloud.legacymodel.communication.answer.Answer)1 GetGPUStatsAnswer (com.cloud.legacymodel.communication.answer.GetGPUStatsAnswer)1 GetHostStatsAnswer (com.cloud.legacymodel.communication.answer.GetHostStatsAnswer)1 MaintainAnswer (com.cloud.legacymodel.communication.answer.MaintainAnswer)1 UnsupportedAnswer (com.cloud.legacymodel.communication.answer.UnsupportedAnswer)1 Command (com.cloud.legacymodel.communication.command.Command)1 GetGPUStatsCommand (com.cloud.legacymodel.communication.command.GetGPUStatsCommand)1 GetHostStatsCommand (com.cloud.legacymodel.communication.command.GetHostStatsCommand)1 MaintainCommand (com.cloud.legacymodel.communication.command.MaintainCommand)1 PropagateResourceEventCommand (com.cloud.legacymodel.communication.command.PropagateResourceEventCommand)1 UpdateHostPasswordCommand (com.cloud.legacymodel.communication.command.UpdateHostPasswordCommand)1 StartupCommand (com.cloud.legacymodel.communication.command.startup.StartupCommand)1 StartupRoutingCommand (com.cloud.legacymodel.communication.command.startup.StartupRoutingCommand)1 AgentUnavailableException (com.cloud.legacymodel.exceptions.AgentUnavailableException)1