Search in sources :

Example 1 with CinderVolumeExpandJob

use of com.emc.storageos.volumecontroller.impl.cinder.job.CinderVolumeExpandJob in project coprhd-controller by CoprHD.

the class CinderStorageDevice method doExpandVolume.

/*
     * (non-Javadoc)
     * 
     * @see com.emc.storageos.volumecontroller.BlockStorageDevice#doExpandVolume
     * (com.emc.storageos.db.client.model.StorageSystem,
     * com.emc.storageos.db.client.model.StoragePool,
     * com.emc.storageos.db.client.model.Volume,
     * java.lang.Long,
     * com.emc.storageos.volumecontroller.TaskCompleter)
     */
@Override
public void doExpandVolume(StorageSystem storageSystem, StoragePool storagePool, Volume volume, Long size, TaskCompleter taskCompleter) throws DeviceControllerException {
    try {
        log.info(String.format("Expand Volume Start - Array:%s, Pool:%s, Volume:%s", storageSystem.getSerialNumber(), storagePool.getNativeGuid(), volume.getId()));
        CinderEndPointInfo ep = CinderUtils.getCinderEndPoint(storageSystem.getActiveProviderURI(), dbClient);
        log.info("Getting the cinder APi for the provider with id " + storageSystem.getActiveProviderURI());
        CinderApi cinderApi = cinderApiFactory.getApi(storageSystem.getActiveProviderURI(), ep);
        String volumeId = volume.getNativeId();
        if (null != volumeId) {
            log.info("Expanding volume with the id " + volumeId + " on Openstack cinder node");
            cinderApi.expandVolume(volumeId, CinderUtils.convertToGB(size));
            CinderJob expandVolumeJob = new CinderVolumeExpandJob(volumeId, volume.getLabel(), volume.getStorageController(), CinderConstants.ComponentType.volume.name(), ep, taskCompleter, storagePool.getId());
            ControllerServiceImpl.enqueueJob(new QueueJob(expandVolumeJob));
        }
        log.info(String.format("Expand Volume End - Array:%s, Pool:%s, Volume:%s", storageSystem.getSerialNumber(), storagePool.getNativeGuid(), volume.getId()));
    } catch (CinderException ce) {
        String message = String.format("Exception when trying to expand volume on Array %s, Pool:%s, Volume:%s", storageSystem.getSerialNumber(), storagePool.getNativeGuid(), volume.getId());
        log.error(message, ce);
        ServiceError error = DeviceControllerErrors.cinder.operationFailed("doExpandVolume", ce.getMessage());
        taskCompleter.error(dbClient, error);
    } catch (final Exception e) {
        log.error("Problem in doExpandVolume: ", e);
        ServiceError serviceError = DeviceControllerErrors.cinder.operationFailed("doExpandVolume", e.getMessage());
        taskCompleter.error(dbClient, serviceError);
    }
}
Also used : CinderException(com.emc.storageos.cinder.errorhandling.CinderException) CinderVolumeExpandJob(com.emc.storageos.volumecontroller.impl.cinder.job.CinderVolumeExpandJob) ServiceError(com.emc.storageos.svcs.errorhandling.model.ServiceError) CinderEndPointInfo(com.emc.storageos.cinder.CinderEndPointInfo) CinderApi(com.emc.storageos.cinder.api.CinderApi) QueueJob(com.emc.storageos.volumecontroller.impl.job.QueueJob) CinderJob(com.emc.storageos.volumecontroller.impl.cinder.job.CinderJob) CinderException(com.emc.storageos.cinder.errorhandling.CinderException) InternalException(com.emc.storageos.svcs.errorhandling.resources.InternalException) DatabaseException(com.emc.storageos.db.exceptions.DatabaseException) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException)

Aggregations

CinderEndPointInfo (com.emc.storageos.cinder.CinderEndPointInfo)1 CinderApi (com.emc.storageos.cinder.api.CinderApi)1 CinderException (com.emc.storageos.cinder.errorhandling.CinderException)1 DatabaseException (com.emc.storageos.db.exceptions.DatabaseException)1 DeviceControllerException (com.emc.storageos.exceptions.DeviceControllerException)1 ServiceError (com.emc.storageos.svcs.errorhandling.model.ServiceError)1 InternalException (com.emc.storageos.svcs.errorhandling.resources.InternalException)1 CinderJob (com.emc.storageos.volumecontroller.impl.cinder.job.CinderJob)1 CinderVolumeExpandJob (com.emc.storageos.volumecontroller.impl.cinder.job.CinderVolumeExpandJob)1 QueueJob (com.emc.storageos.volumecontroller.impl.job.QueueJob)1