Search in sources :

Example 1 with HypervisorCapabilitiesResponse

use of org.apache.cloudstack.api.response.HypervisorCapabilitiesResponse in project cloudstack by apache.

the class UpdateHypervisorCapabilitiesCmd method execute.

@Override
public void execute() {
    HypervisorCapabilities result = _mgr.updateHypervisorCapabilities(this);
    if (result != null) {
        HypervisorCapabilitiesResponse response = _responseGenerator.createHypervisorCapabilitiesResponse(result);
        response.setResponseName(getCommandName());
        this.setResponseObject(response);
    } else {
        throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update hypervisor capabilities");
    }
}
Also used : ServerApiException(org.apache.cloudstack.api.ServerApiException) HypervisorCapabilities(com.cloud.hypervisor.HypervisorCapabilities) HypervisorCapabilitiesResponse(org.apache.cloudstack.api.response.HypervisorCapabilitiesResponse)

Example 2 with HypervisorCapabilitiesResponse

use of org.apache.cloudstack.api.response.HypervisorCapabilitiesResponse in project cloudstack by apache.

the class ApiResponseHelper method createHypervisorCapabilitiesResponse.

@Override
public HypervisorCapabilitiesResponse createHypervisorCapabilitiesResponse(HypervisorCapabilities hpvCapabilities) {
    HypervisorCapabilitiesResponse hpvCapabilitiesResponse = new HypervisorCapabilitiesResponse();
    hpvCapabilitiesResponse.setId(hpvCapabilities.getUuid());
    hpvCapabilitiesResponse.setHypervisor(hpvCapabilities.getHypervisorType());
    hpvCapabilitiesResponse.setHypervisorVersion(hpvCapabilities.getHypervisorVersion());
    hpvCapabilitiesResponse.setIsSecurityGroupEnabled(hpvCapabilities.isSecurityGroupEnabled());
    hpvCapabilitiesResponse.setMaxGuestsLimit(hpvCapabilities.getMaxGuestsLimit());
    hpvCapabilitiesResponse.setMaxDataVolumesLimit(hpvCapabilities.getMaxDataVolumesLimit());
    hpvCapabilitiesResponse.setMaxHostsPerCluster(hpvCapabilities.getMaxHostsPerCluster());
    hpvCapabilitiesResponse.setIsStorageMotionSupported(hpvCapabilities.isStorageMotionSupported());
    hpvCapabilitiesResponse.setVmSnapshotEnabled(hpvCapabilities.isVmSnapshotEnabled());
    return hpvCapabilitiesResponse;
}
Also used : HypervisorCapabilitiesResponse(org.apache.cloudstack.api.response.HypervisorCapabilitiesResponse)

Example 3 with HypervisorCapabilitiesResponse

use of org.apache.cloudstack.api.response.HypervisorCapabilitiesResponse in project cloudstack by apache.

the class ListHypervisorCapabilitiesCmd method execute.

@Override
public void execute() {
    Pair<List<? extends HypervisorCapabilities>, Integer> hpvCapabilities = _mgr.listHypervisorCapabilities(getId(), getHypervisor(), getKeyword(), this.getStartIndex(), this.getPageSizeVal());
    ListResponse<HypervisorCapabilitiesResponse> response = new ListResponse<HypervisorCapabilitiesResponse>();
    List<HypervisorCapabilitiesResponse> hpvCapabilitiesResponses = new ArrayList<HypervisorCapabilitiesResponse>();
    for (HypervisorCapabilities capability : hpvCapabilities.first()) {
        HypervisorCapabilitiesResponse hpvCapabilityResponse = _responseGenerator.createHypervisorCapabilitiesResponse(capability);
        hpvCapabilityResponse.setObjectName("hypervisorCapabilities");
        hpvCapabilitiesResponses.add(hpvCapabilityResponse);
    }
    response.setResponses(hpvCapabilitiesResponses, hpvCapabilities.second());
    response.setResponseName(getCommandName());
    this.setResponseObject(response);
}
Also used : ListResponse(org.apache.cloudstack.api.response.ListResponse) HypervisorCapabilities(com.cloud.hypervisor.HypervisorCapabilities) ArrayList(java.util.ArrayList) List(java.util.List) ArrayList(java.util.ArrayList) HypervisorCapabilitiesResponse(org.apache.cloudstack.api.response.HypervisorCapabilitiesResponse)

Aggregations

HypervisorCapabilitiesResponse (org.apache.cloudstack.api.response.HypervisorCapabilitiesResponse)3 HypervisorCapabilities (com.cloud.hypervisor.HypervisorCapabilities)2 ArrayList (java.util.ArrayList)1 List (java.util.List)1 ServerApiException (org.apache.cloudstack.api.ServerApiException)1 ListResponse (org.apache.cloudstack.api.response.ListResponse)1