Search in sources :

Example 1 with GetGPUStatsAnswer

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

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<String, HashMap<String, VgpuTypesInfo>>();
    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.agent.api.GetGPUStatsAnswer) HashMap(java.util.HashMap) Connection(com.xensource.xenapi.Connection) VgpuTypesInfo(com.cloud.agent.api.VgpuTypesInfo)

Example 2 with GetGPUStatsAnswer

use of com.cloud.agent.api.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.agent.api.GetGPUStatsAnswer) HashMap(java.util.HashMap) Connection(com.xensource.xenapi.Connection)

Example 3 with GetGPUStatsAnswer

use of com.cloud.agent.api.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 = _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.agent.api.GetGPUStatsCommand) 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) UnsupportedAnswer(com.cloud.agent.api.UnsupportedAnswer) GetGPUStatsAnswer(com.cloud.agent.api.GetGPUStatsAnswer)

Example 4 with GetGPUStatsAnswer

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

the class ResourceManagerImpl method getGPUStatistics.

@Override
public HashMap<String, HashMap<String, VgpuTypesInfo>> getGPUStatistics(final HostVO host) {
    final Answer answer = _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 = String.format("Unable to obtain GPU stats for %s", host);
        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.agent.api.GetGPUStatsCommand) UnsupportedAnswer(com.cloud.agent.api.UnsupportedAnswer) GetGPUStatsAnswer(com.cloud.agent.api.GetGPUStatsAnswer) MaintainAnswer(com.cloud.agent.api.MaintainAnswer) GetHostStatsAnswer(com.cloud.agent.api.GetHostStatsAnswer) GetVncPortAnswer(com.cloud.agent.api.GetVncPortAnswer) Answer(com.cloud.agent.api.Answer) UnsupportedAnswer(com.cloud.agent.api.UnsupportedAnswer) GetGPUStatsAnswer(com.cloud.agent.api.GetGPUStatsAnswer)

Aggregations

GetGPUStatsAnswer (com.cloud.agent.api.GetGPUStatsAnswer)4 Answer (com.cloud.agent.api.Answer)2 GetGPUStatsCommand (com.cloud.agent.api.GetGPUStatsCommand)2 GetHostStatsAnswer (com.cloud.agent.api.GetHostStatsAnswer)2 MaintainAnswer (com.cloud.agent.api.MaintainAnswer)2 UnsupportedAnswer (com.cloud.agent.api.UnsupportedAnswer)2 Connection (com.xensource.xenapi.Connection)2 HashMap (java.util.HashMap)2 GetVncPortAnswer (com.cloud.agent.api.GetVncPortAnswer)1 VgpuTypesInfo (com.cloud.agent.api.VgpuTypesInfo)1