Search in sources :

Example 1 with StoragePoolResponse

use of com.cloud.api.response.StoragePoolResponse in project CloudStack-archive by CloudStack-extras.

the class PreparePrimaryStorageForMaintenanceCmd method execute.

@Override
public void execute() throws ResourceUnavailableException, InsufficientCapacityException {
    StoragePool result = _storageService.preparePrimaryStorageForMaintenance(getId());
    if (result != null) {
        StoragePoolResponse response = _responseGenerator.createStoragePoolResponse(result);
        response.setResponseName("storagepool");
        this.setResponseObject(response);
    } else {
        throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to prepare primary storage for maintenance");
    }
}
Also used : StoragePoolResponse(com.cloud.api.response.StoragePoolResponse) StoragePool(com.cloud.storage.StoragePool) ServerApiException(com.cloud.api.ServerApiException)

Example 2 with StoragePoolResponse

use of com.cloud.api.response.StoragePoolResponse in project CloudStack-archive by CloudStack-extras.

the class UpdateStoragePoolCmd method execute.

@Override
public void execute() {
    StoragePool result = _storageService.updateStoragePool(this);
    if (result != null) {
        StoragePoolResponse response = _responseGenerator.createStoragePoolResponse(result);
        response.setResponseName(getCommandName());
        this.setResponseObject(response);
    } else {
        throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update storage pool");
    }
}
Also used : StoragePoolResponse(com.cloud.api.response.StoragePoolResponse) StoragePool(com.cloud.storage.StoragePool) ServerApiException(com.cloud.api.ServerApiException)

Example 3 with StoragePoolResponse

use of com.cloud.api.response.StoragePoolResponse in project CloudStack-archive by CloudStack-extras.

the class ListStoragePoolsCmd method execute.

@Override
public void execute() {
    List<? extends StoragePool> pools = _mgr.searchForStoragePools(this);
    ListResponse<StoragePoolResponse> response = new ListResponse<StoragePoolResponse>();
    List<StoragePoolResponse> poolResponses = new ArrayList<StoragePoolResponse>();
    for (StoragePool pool : pools) {
        StoragePoolResponse poolResponse = _responseGenerator.createStoragePoolResponse(pool);
        poolResponse.setObjectName("storagepool");
        poolResponses.add(poolResponse);
    }
    response.setResponses(poolResponses);
    response.setResponseName(getCommandName());
    this.setResponseObject(response);
}
Also used : StoragePoolResponse(com.cloud.api.response.StoragePoolResponse) StoragePool(com.cloud.storage.StoragePool) ListResponse(com.cloud.api.response.ListResponse) ArrayList(java.util.ArrayList)

Example 4 with StoragePoolResponse

use of com.cloud.api.response.StoragePoolResponse in project cosmic by MissionCriticalCloud.

the class PreparePrimaryStorageForMaintenanceCmd method execute.

@Override
public void execute() throws ResourceUnavailableException, InsufficientCapacityException {
    final StoragePool result = _storageService.preparePrimaryStorageForMaintenance(getId());
    if (result != null) {
        final StoragePoolResponse response = _responseGenerator.createStoragePoolResponse(result);
        response.setResponseName("storagepool");
        this.setResponseObject(response);
    } else {
        throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to prepare primary storage for maintenance");
    }
}
Also used : StoragePoolResponse(com.cloud.api.response.StoragePoolResponse) StoragePool(com.cloud.storage.StoragePool) ServerApiException(com.cloud.api.ServerApiException)

Example 5 with StoragePoolResponse

use of com.cloud.api.response.StoragePoolResponse in project cosmic by MissionCriticalCloud.

the class CancelPrimaryStorageMaintenanceCmd method execute.

@Override
public void execute() throws ResourceUnavailableException {
    final StoragePool result = _storageService.cancelPrimaryStorageForMaintenance(this);
    if (result != null) {
        final StoragePoolResponse response = _responseGenerator.createStoragePoolResponse(result);
        response.setResponseName(getCommandName());
        this.setResponseObject(response);
    } else {
        throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to cancel primary storage maintenance");
    }
}
Also used : StoragePoolResponse(com.cloud.api.response.StoragePoolResponse) StoragePool(com.cloud.storage.StoragePool) ServerApiException(com.cloud.api.ServerApiException)

Aggregations

StoragePoolResponse (com.cloud.api.response.StoragePoolResponse)15 StoragePool (com.cloud.storage.StoragePool)10 ServerApiException (com.cloud.api.ServerApiException)8 ArrayList (java.util.ArrayList)5 StoragePoolJoinVO (com.cloud.api.query.vo.StoragePoolJoinVO)3 ListResponse (com.cloud.api.response.ListResponse)3 ResourceInUseException (com.cloud.exception.ResourceInUseException)2 ResourceUnavailableException (com.cloud.exception.ResourceUnavailableException)2 StorageStats (com.cloud.storage.StorageStats)2 UnknownHostException (java.net.UnknownHostException)2 Hashtable (java.util.Hashtable)2 List (java.util.List)2 DataStore (com.cloud.engine.subsystem.api.storage.DataStore)1 DataStoreDriver (com.cloud.engine.subsystem.api.storage.DataStoreDriver)1