Search in sources :

Example 1 with GetGPUStatsAnswer

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

the class XenServer620SP1GetGPUStatsCommandWrapper method execute.

@Override
public Answer execute(final GetGPUStatsCommand command, final XenServer620SP1Resource xenServer620SP1Resource) {
    final Connection conn = xenServer620SP1Resource.getConnection();
    HashMap<String, HashMap<String, VgpuTypesInfo>> groupDetails = new HashMap<>();
    try {
        groupDetails = xenServer620SP1Resource.getGPUGroupDetails(conn);
    } catch (final Exception e) {
        final String msg = "Unable to get GPU stats" + e.toString();
        s_logger.warn(msg, e);
        return new GetGPUStatsAnswer(command, false, msg);
    }
    return new GetGPUStatsAnswer(command, groupDetails);
}
Also used : GetGPUStatsAnswer(com.cloud.legacymodel.communication.answer.GetGPUStatsAnswer) HashMap(java.util.HashMap) Connection(com.xensource.xenapi.Connection)

Example 2 with GetGPUStatsAnswer

use of com.cloud.legacymodel.communication.answer.GetGPUStatsAnswer 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)

Aggregations

GetGPUStatsAnswer (com.cloud.legacymodel.communication.answer.GetGPUStatsAnswer)2 Answer (com.cloud.legacymodel.communication.answer.Answer)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 GetGPUStatsCommand (com.cloud.legacymodel.communication.command.GetGPUStatsCommand)1 Connection (com.xensource.xenapi.Connection)1 HashMap (java.util.HashMap)1