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);
}
}
Aggregations