use of com.emc.storageos.fileorchestrationcontroller.FileStorageSystemAssociation.TargetAssociation in project coprhd-controller by CoprHD.
the class FileOrchestrationDeviceController method assignFileReplicationPolicyToVirtualPools.
@Override
public void assignFileReplicationPolicyToVirtualPools(List<FileStorageSystemAssociation> associations, List<URI> vpoolURIs, URI filePolicyToAssign, String taskId) {
FilePolicy filePolicy = s_dbClient.queryObject(FilePolicy.class, filePolicyToAssign);
FilePolicyAssignWorkflowCompleter completer = new FilePolicyAssignWorkflowCompleter(filePolicyToAssign, vpoolURIs, null, taskId);
try {
String waitFor = null;
String stepId = null;
String stepDes = null;
Workflow workflow = _workflowService.getNewWorkflow(this, ASSIGN_FILE_POLICY_WF_NAME, false, taskId, completer);
completer.setWorkFlowId(workflow.getWorkflowURI());
String usePhysicalNASForProvisioning = customConfigHandler.getComputedCustomConfigValue(CustomConfigConstants.USE_PHYSICAL_NAS_FOR_PROVISIONING, "isilon", null);
Boolean usePhysicalNAS = Boolean.valueOf(usePhysicalNASForProvisioning);
// Verify the associations have many to one storage system relation.
// If so, inform the user to configure cluster name in provisioning path!!
verifyClusterNameInPathForManyToOneRecommendations(associations, filePolicy);
s_logger.info("Generating steps for assigning file replication policy to vpool: {}.", filePolicyToAssign);
for (FileStorageSystemAssociation association : associations) {
StorageSystem sourceStoragesystem = s_dbClient.queryObject(StorageSystem.class, association.getSourceSystem());
URI vpoolURI = association.getAppliedAtResource();
List<TargetAssociation> targetAssociations = association.getTargets();
if (targetAssociations != null && !targetAssociations.isEmpty()) {
for (Iterator<TargetAssociation> iterator = targetAssociations.iterator(); iterator.hasNext(); ) {
TargetAssociation targetAssociation = iterator.next();
URI targetVNASURI = targetAssociation.getvNASURI();
URI targetStorage = targetAssociation.getStorageSystemURI();
URI targetVArray = targetAssociation.getvArrayURI();
if (targetVNASURI != null && association.getSourceVNAS() != null) {
stepId = workflow.createStepId();
stepDes = String.format("Assigning file policy: %s, to vpool: %s on storage system: %s with source vnas %s and target vnas %s", filePolicy.getId(), vpoolURI, association.getSourceSystem(), association.getSourceVNAS(), targetVNASURI);
Object[] args = new Object[] { association.getSourceSystem(), targetStorage, association.getSourceVNAS(), targetVArray, targetVNASURI, filePolicyToAssign, vpoolURI };
_fileDeviceController.createMethod(workflow, waitFor, ASSIGN_FILE_REPLICATION_POLICY_TO_VIRTUAL_POOLS_METHOD, stepId, stepDes, association.getSourceSystem(), args);
} else {
if (sourceStoragesystem.getSystemType().equals(Type.isilon.toString())) {
if (usePhysicalNAS) {
stepId = workflow.createStepId();
stepDes = String.format("Assigning file policy: %s, to vpool: %s on storage system: %s", filePolicy.getId(), vpoolURI, association.getSourceSystem());
// Let the all workflow steps be executed
// workflow completer should handle the unsuccessful steps
Object[] args = new Object[] { association.getSourceSystem(), targetStorage, association.getSourceVNAS(), targetVArray, null, filePolicyToAssign, vpoolURI };
_fileDeviceController.createMethod(workflow, waitFor, ASSIGN_FILE_REPLICATION_POLICY_TO_VIRTUAL_POOLS_METHOD, stepId, stepDes, association.getSourceSystem(), args);
}
}
}
}
}
}
String successMessage = String.format("Assigning file policy : %s, to vpool(s) successful.", filePolicy.getId());
workflow.executePlan(completer, successMessage);
} catch (Exception ex) {
// If no other resources are assigned to replication policy
// Remove the replication topology from the policy
FileOrchestrationUtils.removeTopologyInfo(filePolicy, s_dbClient);
s_logger.error(String.format("Assigning file policy : %s to vpool(s) failed", filePolicy.getId()), ex);
ServiceError serviceError = DeviceControllerException.errors.assignFilePolicyFailed(filePolicyToAssign.toString(), filePolicy.getApplyAt(), ex);
completer.error(s_dbClient, _locker, serviceError);
}
}
use of com.emc.storageos.fileorchestrationcontroller.FileStorageSystemAssociation.TargetAssociation in project coprhd-controller by CoprHD.
the class FileOrchestrationDeviceController method assignFileReplicationPolicyToProjects.
@Override
public void assignFileReplicationPolicyToProjects(List<FileStorageSystemAssociation> associations, URI vpoolURI, List<URI> projectURIs, URI filePolicyToAssign, String taskId) {
FilePolicy filePolicy = s_dbClient.queryObject(FilePolicy.class, filePolicyToAssign);
FilePolicyAssignWorkflowCompleter completer = new FilePolicyAssignWorkflowCompleter(filePolicyToAssign, projectURIs, vpoolURI, taskId);
try {
String waitFor = null;
String stepId = null;
String stepDes = null;
Workflow workflow = _workflowService.getNewWorkflow(this, ASSIGN_FILE_POLICY_WF_NAME, false, taskId, completer);
completer.setWorkFlowId(workflow.getWorkflowURI());
String usePhysicalNASForProvisioning = customConfigHandler.getComputedCustomConfigValue(CustomConfigConstants.USE_PHYSICAL_NAS_FOR_PROVISIONING, "isilon", null);
Boolean usePhysicalNAS = Boolean.valueOf(usePhysicalNASForProvisioning);
// Verify the associations have many to one storage system relation.
// If so, inform the user to configure cluster name in provisioning path!!
verifyClusterNameInPathForManyToOneRecommendations(associations, filePolicy);
s_logger.info("Generating steps for assigning file policy {} to project.", filePolicyToAssign);
for (FileStorageSystemAssociation association : associations) {
StorageSystem sourceStoragesystem = s_dbClient.queryObject(StorageSystem.class, association.getSourceSystem());
URI projectURI = association.getAppliedAtResource();
URI vPoolURI = association.getProjectvPool();
List<TargetAssociation> targetAssociations = association.getTargets();
if (targetAssociations != null && !targetAssociations.isEmpty()) {
for (Iterator<TargetAssociation> iterator = targetAssociations.iterator(); iterator.hasNext(); ) {
TargetAssociation targetAssociation = iterator.next();
URI targetVNASURI = targetAssociation.getvNASURI();
URI targetStorage = targetAssociation.getStorageSystemURI();
URI targetVArray = targetAssociation.getvArrayURI();
if (targetVNASURI != null && association.getSourceVNAS() != null) {
stepId = workflow.createStepId();
stepDes = String.format("Assigning file policy: %s, to project: %s on storage system: %s", filePolicy.getId(), projectURI, association.getSourceSystem());
// Let the all workflow steps be executed
// workflow completer should handle the unsuccessful steps
Object[] args = new Object[] { association.getSourceSystem(), targetStorage, association.getSourceVNAS(), targetVArray, targetVNASURI, filePolicyToAssign, vPoolURI, projectURI };
_fileDeviceController.createMethod(workflow, waitFor, ASSIGN_FILE_REPLICATION_POLICY_TO_PROJECTS_METHOD, stepId, stepDes, association.getSourceSystem(), args);
} else {
if (sourceStoragesystem.getSystemType().equals(Type.isilon.toString())) {
if (usePhysicalNAS) {
stepId = workflow.createStepId();
stepDes = String.format("Assigning file policy: %s, to project: %s on storage system: %s", filePolicy.getId(), projectURI, association.getSourceSystem());
// Let the all workflow steps be executed
// workflow completer should handle the unsuccessful steps
Object[] args = new Object[] { association.getSourceSystem(), targetStorage, association.getSourceVNAS(), targetVArray, null, filePolicyToAssign, vPoolURI, projectURI };
_fileDeviceController.createMethod(workflow, waitFor, ASSIGN_FILE_REPLICATION_POLICY_TO_PROJECTS_METHOD, stepId, stepDes, association.getSourceSystem(), args);
}
}
}
}
}
}
String successMessage = String.format("Assigning file policy : %s, to project(s) successful.", filePolicy.getId());
workflow.executePlan(completer, successMessage);
} catch (Exception ex) {
// If no other resources are assigned to replication policy
// Remove the replication topology from the policy
FileOrchestrationUtils.removeTopologyInfo(filePolicy, s_dbClient);
s_logger.error(String.format("Assigning file policy : %s to project(s) failed", filePolicy.getId()), ex);
ServiceError serviceError = DeviceControllerException.errors.assignFilePolicyFailed(filePolicyToAssign.toString(), filePolicy.getApplyAt(), ex);
completer.error(s_dbClient, _locker, serviceError);
}
}
use of com.emc.storageos.fileorchestrationcontroller.FileStorageSystemAssociation.TargetAssociation in project coprhd-controller by CoprHD.
the class FilePolicyService method convertRecommendationsToStorageSystemAssociations.
private List<FileStorageSystemAssociation> convertRecommendationsToStorageSystemAssociations(List<FileRecommendation> recs, String appliedAt, URI vPoolURI, URI projectURI) {
List<FileStorageSystemAssociation> associations = new ArrayList<FileStorageSystemAssociation>();
for (FileRecommendation rec : recs) {
FileMirrorRecommendation mirrorRec = (FileMirrorRecommendation) rec;
FileStorageSystemAssociation association = new FileStorageSystemAssociation();
association.setSourceSystem(mirrorRec.getSourceStorageSystem());
association.setSourceVNAS(mirrorRec.getvNAS());
if (appliedAt.equalsIgnoreCase(FilePolicyApplyLevel.vpool.name())) {
association.setAppliedAtResource(vPoolURI);
} else if (appliedAt.equalsIgnoreCase(FilePolicyApplyLevel.project.name())) {
association.setProjectvPool(vPoolURI);
association.setAppliedAtResource(projectURI);
}
Map<URI, Target> virtualArrayTargetMap = mirrorRec.getVirtualArrayTargetMap();
// Getting the first target because we support one-to-one replication now.
URI targetVArray = virtualArrayTargetMap.entrySet().iterator().next().getKey();
Target target = virtualArrayTargetMap.entrySet().iterator().next().getValue();
URI targetStorageDevice = target.getTargetStorageDevice();
URI targetVNasURI = target.getTargetvNASURI();
TargetAssociation targetAssociation = new TargetAssociation();
targetAssociation.setStorageSystemURI(targetStorageDevice);
targetAssociation.setvArrayURI(targetVArray);
targetAssociation.setvNASURI(targetVNasURI);
association.addTargetAssociation(targetAssociation);
associations.add(association);
}
return associations;
}
Aggregations