Search in sources :

Example 1 with HypervisorCapabilities

use of com.cloud.hypervisor.HypervisorCapabilities in project CloudStack-archive by CloudStack-extras.

the class UpdateHypervisorCapabilitiesCmd method execute.

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

Example 2 with HypervisorCapabilities

use of com.cloud.hypervisor.HypervisorCapabilities 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 3 with HypervisorCapabilities

use of com.cloud.hypervisor.HypervisorCapabilities in project cosmic by MissionCriticalCloud.

the class ListHypervisorCapabilitiesCmd method execute.

// ///////////////////////////////////////////////////
// ///////////////// Accessors ///////////////////////
// ///////////////////////////////////////////////////
@Override
public void execute() {
    final Pair<List<? extends HypervisorCapabilities>, Integer> hpvCapabilities = _mgr.listHypervisorCapabilities(getId(), getHypervisor(), getKeyword(), this.getStartIndex(), this.getPageSizeVal());
    final ListResponse<HypervisorCapabilitiesResponse> response = new ListResponse<>();
    final List<HypervisorCapabilitiesResponse> hpvCapabilitiesResponses = new ArrayList<>();
    for (final HypervisorCapabilities capability : hpvCapabilities.first()) {
        final 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(com.cloud.api.response.ListResponse) HypervisorCapabilities(com.cloud.hypervisor.HypervisorCapabilities) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) HypervisorCapabilitiesResponse(com.cloud.api.response.HypervisorCapabilitiesResponse)

Example 4 with HypervisorCapabilities

use of com.cloud.hypervisor.HypervisorCapabilities in project cosmic by MissionCriticalCloud.

the class UpdateHypervisorCapabilitiesCmd method execute.

// ///////////////////////////////////////////////////
// ///////////////// Accessors ///////////////////////
// ///////////////////////////////////////////////////
@Override
public void execute() {
    final HypervisorCapabilities result = _mgr.updateHypervisorCapabilities(getId(), getMaxGuestsLimit());
    if (result != null) {
        final 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(com.cloud.api.ServerApiException) HypervisorCapabilities(com.cloud.hypervisor.HypervisorCapabilities) HypervisorCapabilitiesResponse(com.cloud.api.response.HypervisorCapabilitiesResponse)

Example 5 with HypervisorCapabilities

use of com.cloud.hypervisor.HypervisorCapabilities in project CloudStack-archive by CloudStack-extras.

the class ListHypervisorCapabilitiesCmd method execute.

@Override
public void execute() {
    List<? extends HypervisorCapabilities> 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) {
        HypervisorCapabilitiesResponse hpvCapabilityResponse = _responseGenerator.createHypervisorCapabilitiesResponse(capability);
        hpvCapabilityResponse.setObjectName("hypervisorCapabilities");
        hpvCapabilitiesResponses.add(hpvCapabilityResponse);
    }
    response.setResponses(hpvCapabilitiesResponses);
    response.setResponseName(getCommandName());
    this.setResponseObject(response);
}
Also used : ListResponse(com.cloud.api.response.ListResponse) HypervisorCapabilities(com.cloud.hypervisor.HypervisorCapabilities) ArrayList(java.util.ArrayList) HypervisorCapabilitiesResponse(com.cloud.api.response.HypervisorCapabilitiesResponse)

Aggregations

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