Search in sources :

Example 1 with ApiCallRc

use of com.linbit.linstor.api.model.ApiCallRc in project cloudstack by apache.

the class LinstorPrimaryDataStoreDriverImpl method deleteSnapshot.

private void deleteSnapshot(@Nonnull DataStore dataStore, @Nonnull String rscDefName, @Nonnull String snapshotName) {
    StoragePoolVO storagePool = _storagePoolDao.findById(dataStore.getId());
    DevelopersApi linstorApi = LinstorUtil.getLinstorAPI(storagePool.getHostAddress());
    try {
        ApiCallRcList answers = linstorApi.resourceSnapshotDelete(rscDefName, snapshotName);
        if (answers.hasError()) {
            for (ApiCallRc answer : answers) {
                s_logger.error(answer.getMessage());
            }
            throw new CloudRuntimeException("Linstor: Unable to delete snapshot: " + rscDefName);
        }
    } catch (ApiException apiEx) {
        s_logger.error("Linstor: ApiEx - " + apiEx.getMessage());
        throw new CloudRuntimeException(apiEx.getBestMessage(), apiEx);
    }
}
Also used : ApiCallRcList(com.linbit.linstor.api.model.ApiCallRcList) CloudRuntimeException(com.cloud.utils.exception.CloudRuntimeException) VMTemplateStoragePoolVO(com.cloud.storage.VMTemplateStoragePoolVO) StoragePoolVO(org.apache.cloudstack.storage.datastore.db.StoragePoolVO) DevelopersApi(com.linbit.linstor.api.DevelopersApi) ApiCallRc(com.linbit.linstor.api.model.ApiCallRc) ApiException(com.linbit.linstor.api.ApiException)

Aggregations

VMTemplateStoragePoolVO (com.cloud.storage.VMTemplateStoragePoolVO)1 CloudRuntimeException (com.cloud.utils.exception.CloudRuntimeException)1 ApiException (com.linbit.linstor.api.ApiException)1 DevelopersApi (com.linbit.linstor.api.DevelopersApi)1 ApiCallRc (com.linbit.linstor.api.model.ApiCallRc)1 ApiCallRcList (com.linbit.linstor.api.model.ApiCallRcList)1 StoragePoolVO (org.apache.cloudstack.storage.datastore.db.StoragePoolVO)1