Search in sources :

Example 1 with VNXeExpandVolumeJob

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

the class VNXUnityBlockStorageDevice method doExpandVolume.

@Override
public void doExpandVolume(StorageSystem storage, StoragePool pool, Volume volume, Long size, TaskCompleter taskCompleter) throws DeviceControllerException {
    logger.info(String.format("Expand Volume Start - Array: %s, Pool: %s, Volume: %s, New size: %d", storage.getSerialNumber(), pool.getNativeGuid(), volume.getLabel(), size));
    String cgName = volume.getReplicationGroupInstance();
    String consistencyGroupId = null;
    try {
        VNXeApiClient apiClient = getVnxUnityClient(storage);
        if (NullColumnValueGetter.isNotNullValue(cgName)) {
            consistencyGroupId = apiClient.getConsistencyGroupIdByName(cgName);
            VNXeUtils.getCGLock(workflowService, storage, cgName, taskCompleter.getOpId());
        }
        VNXeCommandJob commandJob = apiClient.expandLun(volume.getNativeId(), size, consistencyGroupId);
        VNXeExpandVolumeJob expandVolumeJob = new VNXeExpandVolumeJob(commandJob.getId(), storage.getId(), taskCompleter);
        ControllerServiceImpl.enqueueJob(new QueueJob(expandVolumeJob));
    } catch (VNXeException e) {
        logger.error("Expand volume got the exception", e);
        taskCompleter.error(dbClient, e);
    } catch (Exception ex) {
        logger.error("Expand volume got the exception", ex);
        ServiceError error = DeviceControllerErrors.vnxe.jobFailed("ExpandVolume", ex.getMessage());
        taskCompleter.error(dbClient, error);
    }
}
Also used : VNXeCommandJob(com.emc.storageos.vnxe.models.VNXeCommandJob) ServiceError(com.emc.storageos.svcs.errorhandling.model.ServiceError) VNXeApiClient(com.emc.storageos.vnxe.VNXeApiClient) VNXeException(com.emc.storageos.vnxe.VNXeException) VNXeExpandVolumeJob(com.emc.storageos.volumecontroller.impl.vnxe.job.VNXeExpandVolumeJob) QueueJob(com.emc.storageos.volumecontroller.impl.job.QueueJob) VNXeException(com.emc.storageos.vnxe.VNXeException) DatabaseException(com.emc.storageos.db.exceptions.DatabaseException) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) ControllerException(com.emc.storageos.volumecontroller.ControllerException)

Example 2 with VNXeExpandVolumeJob

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

the class VNXeStorageDevice method doExpandVolume.

@Override
public void doExpandVolume(StorageSystem storage, StoragePool pool, Volume volume, Long size, TaskCompleter taskCompleter) throws DeviceControllerException {
    _logger.info(String.format("Expand Volume Start - Array: %s, Pool: %s, Volume: %s, New size: %d", storage.getSerialNumber(), pool.getNativeGuid(), volume.getLabel(), size));
    String consistencyGroupId = null;
    URI consistencyGroupURI = volume.getConsistencyGroup();
    if (consistencyGroupURI != null) {
        BlockConsistencyGroup consistencyGroup = _dbClient.queryObject(BlockConsistencyGroup.class, consistencyGroupURI);
        if (consistencyGroup != null) {
            consistencyGroupId = consistencyGroup.getCgNameOnStorageSystem(storage.getId());
        }
    }
    try {
        VNXeApiClient apiClient = getVnxeClient(storage);
        VNXeCommandJob commandJob = apiClient.expandLun(volume.getNativeId(), size, consistencyGroupId);
        VNXeExpandVolumeJob expandVolumeJob = new VNXeExpandVolumeJob(commandJob.getId(), storage.getId(), taskCompleter);
        ControllerServiceImpl.enqueueJob(new QueueJob(expandVolumeJob));
    } catch (VNXeException e) {
        _logger.error("Expand volume got the exception", e);
        taskCompleter.error(_dbClient, e);
    } catch (Exception ex) {
        _logger.error("Expand volume got the exception", ex);
        ServiceError error = DeviceControllerErrors.vnxe.jobFailed("ExpandVolume", ex.getMessage());
        taskCompleter.error(_dbClient, error);
    }
}
Also used : VNXeCommandJob(com.emc.storageos.vnxe.models.VNXeCommandJob) ServiceError(com.emc.storageos.svcs.errorhandling.model.ServiceError) VNXeApiClient(com.emc.storageos.vnxe.VNXeApiClient) VNXeException(com.emc.storageos.vnxe.VNXeException) URI(java.net.URI) VNXeExpandVolumeJob(com.emc.storageos.volumecontroller.impl.vnxe.job.VNXeExpandVolumeJob) QueueJob(com.emc.storageos.volumecontroller.impl.job.QueueJob) VNXeException(com.emc.storageos.vnxe.VNXeException) DatabaseException(com.emc.storageos.db.exceptions.DatabaseException) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) ControllerException(com.emc.storageos.volumecontroller.ControllerException) BlockConsistencyGroup(com.emc.storageos.db.client.model.BlockConsistencyGroup)

Aggregations

DatabaseException (com.emc.storageos.db.exceptions.DatabaseException)2 DeviceControllerException (com.emc.storageos.exceptions.DeviceControllerException)2 ServiceError (com.emc.storageos.svcs.errorhandling.model.ServiceError)2 VNXeApiClient (com.emc.storageos.vnxe.VNXeApiClient)2 VNXeException (com.emc.storageos.vnxe.VNXeException)2 VNXeCommandJob (com.emc.storageos.vnxe.models.VNXeCommandJob)2 ControllerException (com.emc.storageos.volumecontroller.ControllerException)2 QueueJob (com.emc.storageos.volumecontroller.impl.job.QueueJob)2 VNXeExpandVolumeJob (com.emc.storageos.volumecontroller.impl.vnxe.job.VNXeExpandVolumeJob)2 BlockConsistencyGroup (com.emc.storageos.db.client.model.BlockConsistencyGroup)1 URI (java.net.URI)1