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