Search in sources :

Example 1 with OvsProvider

use of com.cloud.network.OvsProvider in project cloudstack by apache.

the class ListOvsElementsCmd method execute.

@Override
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException {
    List<? extends OvsProvider> providers = _service.get(0).searchForOvsElement(this);
    ListResponse<OvsProviderResponse> response = new ListResponse<OvsProviderResponse>();
    List<OvsProviderResponse> providerResponses = new ArrayList<OvsProviderResponse>();
    for (OvsProvider provider : providers) {
        OvsProviderResponse providerResponse = _responseGenerator.createOvsProviderResponse(provider);
        providerResponses.add(providerResponse);
    }
    response.setResponses(providerResponses);
    response.setResponseName(getCommandName());
    this.setResponseObject(response);
}
Also used : ListResponse(org.apache.cloudstack.api.response.ListResponse) OvsProvider(com.cloud.network.OvsProvider) ArrayList(java.util.ArrayList) OvsProviderResponse(org.apache.cloudstack.api.response.OvsProviderResponse)

Example 2 with OvsProvider

use of com.cloud.network.OvsProvider in project cloudstack by apache.

the class ConfigureOvsElementCmd method execute.

@Override
public void execute() throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException {
    CallContext.current().setEventDetails("Ovs element: " + id);
    OvsProvider result = _service.get(0).configure(this);
    if (result != null) {
        OvsProviderResponse ovsResponse = _responseGenerator.createOvsProviderResponse(result);
        ovsResponse.setResponseName(getCommandName());
        this.setResponseObject(ovsResponse);
    } else {
        throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to configure the ovs provider");
    }
}
Also used : OvsProvider(com.cloud.network.OvsProvider) ServerApiException(org.apache.cloudstack.api.ServerApiException) OvsProviderResponse(org.apache.cloudstack.api.response.OvsProviderResponse)

Aggregations

OvsProvider (com.cloud.network.OvsProvider)2 OvsProviderResponse (org.apache.cloudstack.api.response.OvsProviderResponse)2 ArrayList (java.util.ArrayList)1 ServerApiException (org.apache.cloudstack.api.ServerApiException)1 ListResponse (org.apache.cloudstack.api.response.ListResponse)1