Search in sources :

Example 66 with StorageSystem

use of com.emc.storageos.db.client.model.StorageSystem in project coprhd-controller by CoprHD.

the class FileReplicationDeviceController method createFileMirrorSession.

/**
 * Create Mirror Work Flow Step - creates replication session between source and target
 *
 * @param workflow
 * @param waitFor
 * @param sourceDescriptors
 * @param uriFileShareMap
 * @return
 */
protected String createFileMirrorSession(Workflow workflow, String waitFor, List<FileDescriptor> sourceDescriptors, Map<URI, FileShare> uriFileShareMap) {
    for (FileDescriptor sourceDescriptor : sourceDescriptors) {
        FileShare source = uriFileShareMap.get(sourceDescriptor.getFsURI());
        for (String targetStr : source.getMirrorfsTargets()) {
            URI targetURI = URI.create(targetStr);
            StorageSystem system = dbClient.queryObject(StorageSystem.class, source.getStorageDevice());
            Workflow.Method createMethod = createMirrorFilePairStep(system.getId(), source.getId(), targetURI, null);
            Workflow.Method rollbackMethod = rollbackMirrorFilePairMethod(system.getId(), source.getId(), targetURI);
            // Ensure CreateElementReplica steps are executed sequentially (CQ613404)
            waitFor = workflow.createStep(CREATE_FILE_MIRRORS_STEP, CREATE_FILE_MIRRORS_STEP_DESC, waitFor, system.getId(), system.getSystemType(), getClass(), createMethod, rollbackMethod, null);
        }
    }
    return waitFor = CREATE_FILE_MIRRORS_STEP;
}
Also used : Workflow(com.emc.storageos.workflow.Workflow) FileShare(com.emc.storageos.db.client.model.FileShare) URI(java.net.URI) FileDescriptor(com.emc.storageos.fileorchestrationcontroller.FileDescriptor) StorageSystem(com.emc.storageos.db.client.model.StorageSystem)

Example 67 with StorageSystem

use of com.emc.storageos.db.client.model.StorageSystem in project coprhd-controller by CoprHD.

the class FileReplicationDeviceController method rollbackMirrorFileShareStep.

/**
 * Roll back Mirror session between source and target
 *
 * @param systemURI
 * @param sourceURIs
 * @param targetURIs
 * @param opId
 * @return
 */
public boolean rollbackMirrorFileShareStep(URI systemURI, List<URI> sourceURIs, List<URI> targetURIs, String opId) {
    log.info("START rollback Mirror links");
    TaskCompleter completer = null;
    try {
        WorkflowStepCompleter.stepExecuting(opId);
        StorageSystem system = getStorageSystem(systemURI);
        completer = new FileMirrorRollbackCompleter(sourceURIs, opId);
        getRemoteMirrorDevice(system).doRollbackMirrorLink(system, sourceURIs, targetURIs, completer, opId);
    } catch (Exception e) {
        log.error("Ignoring exception while rolling back Mirror sources: {}", sourceURIs, e);
        // Succeed here, to allow other rollbacks to run
        if (null != completer) {
            completer.ready(dbClient);
        }
        WorkflowStepCompleter.stepSucceded(opId);
        return false;
    }
    return true;
}
Also used : FileMirrorRollbackCompleter(com.emc.storageos.volumecontroller.impl.file.FileMirrorRollbackCompleter) TaskCompleter(com.emc.storageos.volumecontroller.TaskCompleter) MirrorFileCreateTaskCompleter(com.emc.storageos.volumecontroller.impl.file.MirrorFileCreateTaskCompleter) WorkflowException(com.emc.storageos.workflow.WorkflowException) InternalException(com.emc.storageos.svcs.errorhandling.resources.InternalException) ControllerException(com.emc.storageos.volumecontroller.ControllerException) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) StorageSystem(com.emc.storageos.db.client.model.StorageSystem)

Example 68 with StorageSystem

use of com.emc.storageos.db.client.model.StorageSystem in project coprhd-controller by CoprHD.

the class FileReplicationDeviceController method createMethod.

/**
 * Common method used to create Controller methods that would be executed by workflow service
 *
 * @param workflow
 * @param stepGroup
 * @param waitFor - String
 * @param methodName - Name of the method to be executed
 * @param stepId - String unique id of the step
 * @param stepDescription - String description of the step
 * @param storage - URI of the StorageSystem
 * @param args - Parameters of the method that has to be executed by workflow
 * @return waitForStep
 */
public String createMethod(Workflow workflow, String stepGroup, String waitFor, String methodName, String stepId, String stepDescription, URI storage, Object[] args) {
    StorageSystem system = this.dbClient.queryObject(StorageSystem.class, storage);
    Workflow.Method method = new Workflow.Method(methodName, args);
    String waitForStep = workflow.createStep(stepGroup, stepDescription, waitFor, storage, system.getSystemType(), getClass(), method, null, stepId);
    return waitForStep;
}
Also used : Workflow(com.emc.storageos.workflow.Workflow) StorageSystem(com.emc.storageos.db.client.model.StorageSystem)

Example 69 with StorageSystem

use of com.emc.storageos.db.client.model.StorageSystem in project coprhd-controller by CoprHD.

the class ObjectDeviceController method updateBucketACL.

@Override
public void updateBucketACL(URI storage, URI bucket, BucketACLUpdateParams param, String opId) throws InternalException {
    ControllerUtils.setThreadLocalLogData(bucket, opId);
    _log.info("ObjectDeviceController:updateBucketACL Bucket URI : {} ", bucket);
    Bucket bucketObj = _dbClient.queryObject(Bucket.class, bucket);
    StorageSystem storageObj = _dbClient.queryObject(StorageSystem.class, storage);
    ObjectDeviceInputOutput objectArgs = new ObjectDeviceInputOutput();
    objectArgs.setAllBuckectAcl(param);
    objectArgs.setName(bucketObj.getName());
    objectArgs.setNamespace(bucketObj.getNamespace());
    // Query for existing ACL and setting it.
    objectArgs.setExistingBucketAcl(queryExistingBucketAcl(objectArgs, bucket));
    BiosCommandResult result = getDevice(storageObj.getSystemType()).doUpdateBucketACL(storageObj, bucketObj, objectArgs, param, opId);
    if (result.getCommandPending()) {
        return;
    }
    bucketObj.getOpStatus().updateTaskStatus(opId, result.toOperation());
}
Also used : Bucket(com.emc.storageos.db.client.model.Bucket) ObjectDeviceInputOutput(com.emc.storageos.volumecontroller.ObjectDeviceInputOutput) StorageSystem(com.emc.storageos.db.client.model.StorageSystem)

Example 70 with StorageSystem

use of com.emc.storageos.db.client.model.StorageSystem in project coprhd-controller by CoprHD.

the class ObjectDeviceController method deleteBucketACL.

@Override
public void deleteBucketACL(URI storage, URI bucket, String opId) throws InternalException {
    ControllerUtils.setThreadLocalLogData(bucket, opId);
    _log.info("ObjectDeviceController:updateBucketACL Bucket URI : {} ", bucket);
    Bucket bucketObj = _dbClient.queryObject(Bucket.class, bucket);
    StorageSystem storageObj = _dbClient.queryObject(StorageSystem.class, storage);
    ObjectDeviceInputOutput objectArgs = new ObjectDeviceInputOutput();
    objectArgs.setName(bucketObj.getName());
    objectArgs.setNamespace(bucketObj.getNamespace());
    // Query for existing ACL and setting it for deletion.
    objectArgs.setBucketAclToDelete(queryExistingBucketAcl(objectArgs, bucket));
    BiosCommandResult result = getDevice(storageObj.getSystemType()).doDeleteBucketACL(storageObj, bucketObj, objectArgs, opId);
    if (result.getCommandPending()) {
        return;
    }
    bucketObj.getOpStatus().updateTaskStatus(opId, result.toOperation());
}
Also used : Bucket(com.emc.storageos.db.client.model.Bucket) ObjectDeviceInputOutput(com.emc.storageos.volumecontroller.ObjectDeviceInputOutput) StorageSystem(com.emc.storageos.db.client.model.StorageSystem)

Aggregations

StorageSystem (com.emc.storageos.db.client.model.StorageSystem)1088 URI (java.net.URI)581 ArrayList (java.util.ArrayList)424 DeviceControllerException (com.emc.storageos.exceptions.DeviceControllerException)319 Volume (com.emc.storageos.db.client.model.Volume)299 InternalException (com.emc.storageos.svcs.errorhandling.resources.InternalException)272 DatabaseException (com.emc.storageos.db.exceptions.DatabaseException)258 ServiceError (com.emc.storageos.svcs.errorhandling.model.ServiceError)246 NamedURI (com.emc.storageos.db.client.model.NamedURI)243 WorkflowException (com.emc.storageos.workflow.WorkflowException)233 ControllerException (com.emc.storageos.volumecontroller.ControllerException)231 HashMap (java.util.HashMap)172 StoragePool (com.emc.storageos.db.client.model.StoragePool)159 BaseCollectionException (com.emc.storageos.plugins.BaseCollectionException)158 StringSet (com.emc.storageos.db.client.model.StringSet)156 URISyntaxException (java.net.URISyntaxException)145 List (java.util.List)139 IOException (java.io.IOException)136 URIQueryResultList (com.emc.storageos.db.client.constraint.URIQueryResultList)127 Workflow (com.emc.storageos.workflow.Workflow)126