Search in sources :

Example 1 with BlockSnapshotExpandCompleter

use of com.emc.storageos.volumecontroller.impl.block.taskcompleter.BlockSnapshotExpandCompleter in project coprhd-controller by CoprHD.

the class BlockDeviceController method expandBlockSnapshot.

@Override
public void expandBlockSnapshot(URI storageURI, URI snapshotURI, Long newSize, String opId) throws ControllerException {
    Volume volumeObj = null;
    try {
        StorageSystem storageObj = _dbClient.queryObject(StorageSystem.class, storageURI);
        BlockSnapshot snapObj = _dbClient.queryObject(BlockSnapshot.class, snapshotURI);
        volumeObj = _dbClient.queryObject(Volume.class, snapObj.getParent().getURI());
        _log.info("expandBlockSnapshot start - Array: {} Pool:{} BlockSnapshot:{}, OldSize: {}, NewSize: {}", storageURI.toString(), volumeObj.getPool().toString(), snapshotURI.toString(), snapObj.getProvisionedCapacity(), newSize);
        StoragePool poolObj = _dbClient.queryObject(StoragePool.class, volumeObj.getPool());
        BlockSnapshotExpandCompleter completer = new BlockSnapshotExpandCompleter(snapshotURI, newSize, opId);
        // expand as regular BlockSnapshot
        InvokeTestFailure.internalOnlyInvokeTestFailure(InvokeTestFailure.ARTIFICIAL_FAILURE_080);
        getDevice(storageObj.getSystemType()).doExpandSnapshot(storageObj, poolObj, snapObj, newSize, completer);
        _log.info("expandBlockSnapshot end - Array: {} Pool:{} BlockSnapshot:{}", storageURI.toString(), volumeObj.getPool().toString(), snapshotURI.toString());
    } catch (Exception e) {
        _log.error("expandBlockSnapshot Failed - Array:{} Pool:{} BlockSnapshot:{}", storageURI.toString(), (volumeObj == null) ? "" : volumeObj.getPool().toString(), snapshotURI.toString(), e);
        ServiceError serviceError = DeviceControllerException.errors.jobFailed(e);
        List<URI> snapshotURIs = Arrays.asList(snapshotURI);
        doFailTask(BlockSnapshot.class, snapshotURIs, opId, serviceError);
        WorkflowStepCompleter.stepFailed(opId, serviceError);
    }
}
Also used : ServiceError(com.emc.storageos.svcs.errorhandling.model.ServiceError) StoragePool(com.emc.storageos.db.client.model.StoragePool) Volume(com.emc.storageos.db.client.model.Volume) BlockSnapshot(com.emc.storageos.db.client.model.BlockSnapshot) BlockSnapshotExpandCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.BlockSnapshotExpandCompleter) Arrays.asList(java.util.Arrays.asList) ApplicationAddVolumeList(com.emc.storageos.volumecontroller.ApplicationAddVolumeList) ArrayList(java.util.ArrayList) URIQueryResultList(com.emc.storageos.db.client.constraint.URIQueryResultList) List(java.util.List) InternalException(com.emc.storageos.svcs.errorhandling.resources.InternalException) BaseCollectionException(com.emc.storageos.plugins.BaseCollectionException) ControllerException(com.emc.storageos.volumecontroller.ControllerException) WorkflowException(com.emc.storageos.workflow.WorkflowException) DatabaseException(com.emc.storageos.db.exceptions.DatabaseException) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) DataBindingException(javax.xml.bind.DataBindingException) StorageSystem(com.emc.storageos.db.client.model.StorageSystem)

Aggregations

URIQueryResultList (com.emc.storageos.db.client.constraint.URIQueryResultList)1 BlockSnapshot (com.emc.storageos.db.client.model.BlockSnapshot)1 StoragePool (com.emc.storageos.db.client.model.StoragePool)1 StorageSystem (com.emc.storageos.db.client.model.StorageSystem)1 Volume (com.emc.storageos.db.client.model.Volume)1 DatabaseException (com.emc.storageos.db.exceptions.DatabaseException)1 DeviceControllerException (com.emc.storageos.exceptions.DeviceControllerException)1 BaseCollectionException (com.emc.storageos.plugins.BaseCollectionException)1 ServiceError (com.emc.storageos.svcs.errorhandling.model.ServiceError)1 InternalException (com.emc.storageos.svcs.errorhandling.resources.InternalException)1 ApplicationAddVolumeList (com.emc.storageos.volumecontroller.ApplicationAddVolumeList)1 ControllerException (com.emc.storageos.volumecontroller.ControllerException)1 BlockSnapshotExpandCompleter (com.emc.storageos.volumecontroller.impl.block.taskcompleter.BlockSnapshotExpandCompleter)1 WorkflowException (com.emc.storageos.workflow.WorkflowException)1 ArrayList (java.util.ArrayList)1 Arrays.asList (java.util.Arrays.asList)1 List (java.util.List)1 DataBindingException (javax.xml.bind.DataBindingException)1