use of com.emc.storageos.volumecontroller.impl.block.taskcompleter.ExportTaskCompleter in project coprhd-controller by CoprHD.
the class MaskingWorkflowEntryPoints method rollbackChangePortGroupDeleteMask.
/**
* Roll back change port group delete mask
*
* @param storageURI
* @param exportGroupURI
* @param exportMaskURI
* @param contextKey
* @param token
* @throws ControllerException
*/
public void rollbackChangePortGroupDeleteMask(URI storageURI, URI exportGroupURI, URI exportMaskURI, String token) throws ControllerException {
_log.info("Roll back change port group delete mask");
ExportTaskCompleter taskCompleter = new ExportOrchestrationTask(exportGroupURI, token);
StorageSystem storage = _dbClient.queryObject(StorageSystem.class, storageURI);
getDevice(storage).rollbackChangePortGroupRemovePaths(storage, exportGroupURI, exportMaskURI, taskCompleter);
}
use of com.emc.storageos.volumecontroller.impl.block.taskcompleter.ExportTaskCompleter in project coprhd-controller by CoprHD.
the class VNXeMaskingOrchestrator method exportGroupAddVolumes.
@Override
public void exportGroupAddVolumes(URI storageURI, URI exportGroupURI, Map<URI, Integer> volumeMap, String token) throws Exception {
ExportTaskCompleter taskCompleter = null;
try {
_log.info(String.format("exportAddVolume start - Array: %s ExportMask: %s Volume: %s", storageURI.toString(), exportGroupURI.toString(), Joiner.on(',').join(volumeMap.entrySet())));
ExportGroup exportGroup = _dbClient.queryObject(ExportGroup.class, exportGroupURI);
StorageSystem storage = _dbClient.queryObject(StorageSystem.class, storageURI);
taskCompleter = new ExportOrchestrationTask(exportGroupURI, token);
List<ExportMask> exportMasks = ExportMaskUtils.getExportMasks(_dbClient, exportGroup, storageURI);
if (!CollectionUtils.isEmpty(exportMasks)) {
// refresh all export masks
for (ExportMask exportMask : exportMasks) {
refreshExportMask(storage, getDevice(), exportMask);
}
// Set up workflow steps.
Workflow workflow = _workflowService.getNewWorkflow(MaskingWorkflowEntryPoints.getInstance(), "exportGroupAddVolumes - Added volumes to existing mask", true, token);
List<URI> volumeURIs = new ArrayList<URI>();
volumeURIs.addAll(volumeMap.keySet());
Collection<URI> initiatorURIs = Collections2.transform(exportGroup.getInitiators(), CommonTransformerFunctions.FCTN_STRING_TO_URI);
findAndUpdateFreeHLUsForClusterExport(storage, exportGroup, new ArrayList<URI>(initiatorURIs), volumeMap);
String zoningStep = generateZoningAddVolumesWorkflow(workflow, null, exportGroup, exportMasks, volumeURIs);
String exportStep = null;
for (ExportMask exportMask : exportMasks) {
if (exportStep == null) {
exportStep = generateExportMaskAddVolumesWorkflow(workflow, zoningStep, storage, exportGroup, exportMask, volumeMap, null);
} else {
exportStep = generateExportMaskAddVolumesWorkflow(workflow, exportStep, storage, exportGroup, exportMask, volumeMap, null);
}
}
String successMessage = String.format("Volumes successfully added to export on StorageArray %s", storage.getLabel());
workflow.executePlan(taskCompleter, successMessage);
} else {
// This is the case when exportGroup exists, but no volume is added before.
if (exportGroup.getInitiators() != null && !exportGroup.getInitiators().isEmpty()) {
_log.info("export_volume_add: adding volume, creating a new export");
List<URI> initiatorURIs = new ArrayList<URI>();
for (String initiatorId : exportGroup.getInitiators()) {
initiatorURIs.add(URI.create(initiatorId));
}
exportGroupCreate(storageURI, exportGroupURI, initiatorURIs, volumeMap, token);
} else {
_log.info("export_volume_add: adding volume, no initiators yet");
taskCompleter.ready(_dbClient);
}
}
_log.info(String.format("exportAddVolume end - Array: %s ExportMask: %s Volume: %s", storageURI.toString(), exportGroupURI.toString(), volumeMap.toString()));
} catch (Exception e) {
if (taskCompleter != null) {
ServiceError serviceError = DeviceControllerException.errors.jobFailedMsg(e.getMessage(), e);
taskCompleter.error(_dbClient, serviceError);
} else {
throw DeviceControllerException.exceptions.exportGroupAddVolumesFailed(e);
}
}
}
use of com.emc.storageos.volumecontroller.impl.block.taskcompleter.ExportTaskCompleter in project coprhd-controller by CoprHD.
the class BlockStorageDeviceTest method testExportRemoveInitiators.
@Test
public void testExportRemoveInitiators() {
ExportGroup exportGroup = getExportGroup();
ExportMask exportMask = getExportMask();
List<Initiator> initiators = getInitiators();
List<URI> initiatorURIs = new ArrayList<URI>();
List<Initiator> initiatorArgs = new ArrayList<Initiator>();
for (Initiator initiator : initiators) {
if (initiator.getInitiatorPort().endsWith("1")) {
initiatorURIs.add(initiator.getId());
initiatorArgs.add(initiator);
}
}
String token = UUID.randomUUID().toString() + UUID.randomUUID().toString();
ExportTaskCompleter taskCompleter = new ExportRemoveInitiatorCompleter(exportGroup.getId(), initiatorURIs, token);
_deviceController.doExportRemoveInitiators(_storageSystem, exportMask, null, initiators, null, taskCompleter);
}
use of com.emc.storageos.volumecontroller.impl.block.taskcompleter.ExportTaskCompleter in project coprhd-controller by CoprHD.
the class BlockStorageDeviceTest method testExportAddInitiator.
@Test
public void testExportAddInitiator() {
ExportGroup exportGroup = getExportGroup();
ExportMask exportMask = getExportMask();
Initiator initiator = getInitiators().get(0);
List<URI> initiatorURIs = new ArrayList<URI>();
initiatorURIs.add(initiator.getId());
List<URI> targets = new ArrayList<URI>();
String token = UUID.randomUUID().toString() + UUID.randomUUID().toString();
ExportTaskCompleter taskCompleter = new ExportAddInitiatorCompleter(exportGroup.getId(), initiatorURIs, token);
_deviceController.doExportAddInitiator(_storageSystem, exportMask, null, initiator, targets, taskCompleter);
}
use of com.emc.storageos.volumecontroller.impl.block.taskcompleter.ExportTaskCompleter in project coprhd-controller by CoprHD.
the class BlockStorageDeviceTest method testExportAddVolume.
@Test
public void testExportAddVolume() {
ExportGroup exportGroup = getExportGroup();
ExportMask exportMask = getExportMask();
List<Volume> volumes = getVolumes(_storageSystem);
Volume volume = volumes.get(0);
Map<URI, Integer> volumeMap = new HashMap<URI, Integer>();
int lun = 1;
volumeMap.put(volume.getId(), lun);
String token = UUID.randomUUID().toString() + UUID.randomUUID().toString();
ExportTaskCompleter taskCompleter = new ExportAddVolumeCompleter(exportGroup.getId(), volumeMap, token);
_deviceController.doExportAddVolume(_storageSystem, exportMask, volume.getId(), lun, null, taskCompleter);
}
Aggregations