Search in sources :

Example 1 with UnsupportedAnswer

use of com.cloud.legacymodel.communication.answer.UnsupportedAnswer in project cosmic by MissionCriticalCloud.

the class ResourceManagerImpl method getGPUStatistics.

@Override
public HashMap<String, HashMap<String, VgpuTypesInfo>> getGPUStatistics(final HostVO host) {
    final Answer answer = this._agentMgr.easySend(host.getId(), new GetGPUStatsCommand(host.getGuid(), host.getName()));
    if (answer != null && answer instanceof UnsupportedAnswer) {
        return null;
    }
    if (answer == null || !answer.getResult()) {
        final String msg = "Unable to obtain GPU stats for host " + host.getName();
        s_logger.warn(msg);
        return null;
    } else {
        // now construct the result object
        if (answer instanceof GetGPUStatsAnswer) {
            return ((GetGPUStatsAnswer) answer).getGroupDetails();
        }
    }
    return null;
}
Also used : GetGPUStatsCommand(com.cloud.legacymodel.communication.command.GetGPUStatsCommand) 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) UnsupportedAnswer(com.cloud.legacymodel.communication.answer.UnsupportedAnswer) GetGPUStatsAnswer(com.cloud.legacymodel.communication.answer.GetGPUStatsAnswer)

Example 2 with UnsupportedAnswer

use of com.cloud.legacymodel.communication.answer.UnsupportedAnswer in project cosmic by MissionCriticalCloud.

the class ResourceManagerImpl method getHostStatistics.

@Override
public HostStats getHostStatistics(final long hostId) {
    final Answer answer = this._agentMgr.easySend(hostId, new GetHostStatsCommand(this._hostDao.findById(hostId).getGuid(), this._hostDao.findById(hostId).getName(), hostId));
    if (answer != null && answer instanceof UnsupportedAnswer) {
        return null;
    }
    if (answer == null || !answer.getResult()) {
        final String msg = "Unable to obtain host " + hostId + " statistics. ";
        s_logger.warn(msg);
        return null;
    } else {
        // now construct the result object
        if (answer instanceof GetHostStatsAnswer) {
            return ((GetHostStatsAnswer) answer).getHostStats();
        }
    }
    return null;
}
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) UnsupportedAnswer(com.cloud.legacymodel.communication.answer.UnsupportedAnswer) GetHostStatsAnswer(com.cloud.legacymodel.communication.answer.GetHostStatsAnswer) GetHostStatsCommand(com.cloud.legacymodel.communication.command.GetHostStatsCommand)

Aggregations

Answer (com.cloud.legacymodel.communication.answer.Answer)2 GetGPUStatsAnswer (com.cloud.legacymodel.communication.answer.GetGPUStatsAnswer)2 GetHostStatsAnswer (com.cloud.legacymodel.communication.answer.GetHostStatsAnswer)2 MaintainAnswer (com.cloud.legacymodel.communication.answer.MaintainAnswer)2 UnsupportedAnswer (com.cloud.legacymodel.communication.answer.UnsupportedAnswer)2 GetGPUStatsCommand (com.cloud.legacymodel.communication.command.GetGPUStatsCommand)1 GetHostStatsCommand (com.cloud.legacymodel.communication.command.GetHostStatsCommand)1