Search in sources :

Example 6 with ImageStoreResponse

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

the class AddSecondaryStorageCmd method execute.

// ///////////////////////////////////////////////////
// ///////////////// Accessors ///////////////////////
// ///////////////////////////////////////////////////
@Override
public void execute() {
    try {
        final ImageStore result = _storageService.discoverImageStore(null, getUrl(), "NFS", getZoneId(), null);
        ImageStoreResponse storeResponse = null;
        if (result != null) {
            storeResponse = _responseGenerator.createImageStoreResponse(result);
            storeResponse.setResponseName(getCommandName());
            storeResponse.setObjectName("secondarystorage");
            setResponseObject(storeResponse);
        } else {
            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add secondary storage");
        }
    } catch (final DiscoveryException ex) {
        s_logger.warn("Exception: ", ex);
        throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage());
    }
}
Also used : ImageStoreResponse(com.cloud.api.response.ImageStoreResponse) ServerApiException(com.cloud.api.ServerApiException) DiscoveryException(com.cloud.exception.DiscoveryException) ImageStore(com.cloud.storage.ImageStore)

Aggregations

ImageStoreResponse (com.cloud.api.response.ImageStoreResponse)6 ImageStore (com.cloud.storage.ImageStore)4 ServerApiException (com.cloud.api.ServerApiException)3 DiscoveryException (com.cloud.exception.DiscoveryException)2 ResponseGenerator (com.cloud.api.ResponseGenerator)1 ImageStoreJoinVO (com.cloud.api.query.vo.ImageStoreJoinVO)1 ImageStoreDetailResponse (com.cloud.api.response.ImageStoreDetailResponse)1 StorageService (com.cloud.storage.StorageService)1 ArrayList (java.util.ArrayList)1 Hashtable (java.util.Hashtable)1 Test (org.junit.Test)1