use of com.emc.storageos.db.client.model.ExportMask in project coprhd-controller by CoprHD.
the class MaskPerHostIngestOrchestrator method getExportMaskAlreadyCreated.
/*
* (non-Javadoc)
*
* @see
* com.emc.storageos.api.service.impl.resource.blockingestorchestration.BlockIngestExportOrchestrator#getExportMaskAlreadyCreated(com.
* emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedExportMask,
* com.emc.storageos.api.service.impl.resource.blockingestorchestration.context.IngestionRequestContext)
*/
@Override
protected ExportMask getExportMaskAlreadyCreated(UnManagedExportMask mask, IngestionRequestContext requestContext, DbClient dbClient) {
List<URI> initiatorUris = new ArrayList<URI>(Collections2.transform(mask.getKnownInitiatorUris(), CommonTransformerFunctions.FCTN_STRING_TO_URI));
List<ExportMask> exportMasks = requestContext.findAllNewExportMasks();
for (URI ini : initiatorUris) {
for (ExportMask createdMask : exportMasks) {
if (null != createdMask && createdMask.getInitiators() != null && createdMask.getInitiators().contains(ini.toString())) {
if (null != createdMask.getStorageDevice() && createdMask.getStorageDevice().equals(mask.getStorageSystemUri())) {
_logger.info("Found already-created ExportMask {} matching UnManagedExportMask initiator {} and storage system {}", createdMask.getMaskName(), ini, mask.getStorageSystemUri());
return createdMask;
}
}
}
}
_logger.info("No existing created mask found for UnManagedExportMask {}", mask.getMaskName());
return null;
}
use of com.emc.storageos.db.client.model.ExportMask in project coprhd-controller by CoprHD.
the class MultipleMaskPerHostIngestOrchestrator method getExportMaskAlreadyCreated.
/* (non-Javadoc)
* @see com.emc.storageos.api.service.impl.resource.blockingestorchestration.BlockIngestExportOrchestrator#getExportMaskAlreadyCreated(com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedExportMask, com.emc.storageos.api.service.impl.resource.blockingestorchestration.context.IngestionRequestContext)
*/
@Override
protected ExportMask getExportMaskAlreadyCreated(UnManagedExportMask mask, IngestionRequestContext requestContext, DbClient dbClient) {
List<ExportMask> exportMasks = requestContext.findAllNewExportMasks();
for (ExportMask createdMask : exportMasks) {
// COP-18184 : Check if the initiators are also matching
if (null != createdMask && createdMask.getInitiators() != null && createdMask.getInitiators().containsAll(mask.getKnownInitiatorUris())) {
if (VolumeIngestionUtil.hasIncorrectMaskPathForVplex(mask, createdMask, dbClient)) {
continue;
}
_logger.info("Found already-created ExportMask {} matching all initiators of UnManagedExportMask {}", createdMask.getMaskName(), mask.getMaskName());
return createdMask;
}
}
_logger.info("No existing created mask found for UnManagedExportMask {}", mask.getMaskName());
return null;
}
use of com.emc.storageos.db.client.model.ExportMask in project coprhd-controller by CoprHD.
the class ExportUtils method getItlsForInitiator.
/**
* Gets the list of exports (ITL) for one initiator. The list contains all the volumes and snapshots
* that are exported to the initiator together with the target ports and the zones when zoning
* was performed.
*
* @param initiator the initiator
* @param dbClient an instance of {@link DbClient}
* @param permissionsHelper an instance of {@link PermissionsHelper}
* @param user a pointer to the logged in user
* @return the list of ITLs for one initiator
*/
public static ITLRestRepList getItlsForInitiator(Initiator initiator, DbClient dbClient, PermissionsHelper permissionsHelper, StorageOSUser user) throws DatabaseException {
ITLRestRepList list = new ITLRestRepList();
Map<ExportMask, List<ExportGroup>> exportMasks = null;
exportMasks = getInitiatorExportMasks(initiator, dbClient, permissionsHelper, user);
BlockObject blockObject = null;
List<StoragePort> ports = null;
List<StoragePort> initiatorPorts = null;
Map<StoragePort, List<FCZoneReference>> zoneRefs = null;
String hlu = "";
Map<String, BlockObject> blockObjects = getBlockObjectsForMasks(exportMasks.keySet(), dbClient);
for (ExportMask exportMask : exportMasks.keySet()) {
_log.info("Finding ITLs for initiator {} in export mask {}", initiator.getInitiatorPort(), exportMask.getMaskName());
ports = getStoragePorts(exportMask, dbClient);
initiatorPorts = getInitiatorPorts(exportMask, initiator, ports, dbClient);
zoneRefs = getInitiatorsZoneReferences(initiator, initiatorPorts, dbClient);
for (String doUri : exportMask.getVolumes().keySet()) {
hlu = exportMask.getVolumes().get(doUri);
blockObject = blockObjects.get(doUri);
if (blockObject != null) {
list.getExportList().addAll(getItlsForMaskInitiator(dbClient, exportMasks.get(exportMask), exportMask, initiator, hlu, blockObject, initiatorPorts, zoneRefs));
}
}
}
_log.info("{} ITLs were found for initiator {}.", list.getExportList().size(), initiator.getInitiatorPort());
return list;
}
use of com.emc.storageos.db.client.model.ExportMask in project coprhd-controller by CoprHD.
the class ExportUtils method getBlockObjectInitiatorTargets.
/**
* Returns initiators-to-target-storage-ports pairing for all initiators to which
* the block object (volume or snapshot) was exported.
*
* @param id the URN of a ViPR block object
* @param dbClient dbClient an instance of {@link DbClient}
* @param idEmbeddedInURL
* @return initiators-to-target-storage-ports pairing for all initiators to which
* the block object (volume or snapshot) was exported.
*/
public static ITLRestRepList getBlockObjectInitiatorTargets(URI id, DbClient dbClient, boolean idEmbeddedInURL) {
BlockObject blockObject = getBlockObject(id, dbClient);
ArgValidator.checkEntityNotNull(blockObject, id, idEmbeddedInURL);
ITLRestRepList list = new ITLRestRepList();
Map<ExportMask, List<ExportGroup>> exportMasks = getBlockObjectExportMasks(blockObject, dbClient);
Collection<Initiator> initiators = null;
List<StoragePort> ports = null;
List<StoragePort> initiatorPorts = null;
BlockObject bo = Volume.fetchExportMaskBlockObject(dbClient, blockObject.getId());
if (bo != null) {
Map<StoragePort, List<FCZoneReference>> zoneRefs = null;
for (ExportMask exportMask : exportMasks.keySet()) {
// now process the initiators - Every initiator must see the volume
initiators = getInitiators(exportMask, dbClient);
_log.debug("Found {} initiators in export mask {}", initiators.size(), exportMask.getMaskName());
ports = getStoragePorts(exportMask, dbClient);
_log.debug("Found {} storage ports in export mask {}", ports.size(), exportMask.getMaskName());
String hlu = exportMask.getVolumes().get(bo.getId().toString());
_log.debug("Start pairing initiators and targets in export mask {}.", exportMask.getMaskName());
for (Initiator initiator : initiators) {
initiatorPorts = getInitiatorPorts(exportMask, initiator, ports, dbClient);
zoneRefs = getInitiatorsZoneReferencesForBlockObject(initiator, initiatorPorts, bo, dbClient);
list.getExportList().addAll(getItlsForMaskInitiator(dbClient, exportMasks.get(exportMask), exportMask, initiator, hlu, blockObject, initiatorPorts, zoneRefs));
}
}
}
_log.info("{} ITLs were found for block object {}.", list.getExportList().size(), blockObject.getLabel());
return list;
}
use of com.emc.storageos.db.client.model.ExportMask in project coprhd-controller by CoprHD.
the class ExportUtils method getBlockObjectExportMasks.
/**
* Fetches all the export masks in which a block object is member
*
* @param blockObject the block object
* @param dbClient an instance of {@link DbClient}
* @return a map of export masks in which a block object is member
*/
private static Map<ExportMask, List<ExportGroup>> getBlockObjectExportMasks(BlockObject blockObject, DbClient dbClient) {
Map<ExportMask, List<ExportGroup>> exportMasks = new HashMap<ExportMask, List<ExportGroup>>();
ContainmentConstraint constraint = ContainmentConstraint.Factory.getBlockObjectExportGroupConstraint(blockObject.getId());
// permission are checked by the API service - no need to check again
List<ExportGroup> exportGroups = getExportGroupsByConstraint(constraint, dbClient, null, null);
List<ExportMask> masks = getMasksForExportGroups(exportGroups, dbClient);
// Get the actual export block object associated with the snapshot (if applicable)
BlockObject bo = Volume.fetchExportMaskBlockObject(dbClient, blockObject.getId());
if (bo != null) {
for (ExportMask exportMask : masks) {
if (exportMask != null && !exportMask.getInactive() && exportMask.hasVolume(bo.getId()) && (exportMask.getInitiators() != null || exportMask.getExistingInitiators() != null)) {
List<ExportGroup> maskGroups = new ArrayList<ExportGroup>();
exportMasks.put(exportMask, maskGroups);
for (ExportGroup group : exportGroups) {
if (group.getExportMasks() != null && group.getExportMasks().contains(exportMask.getId().toString())) {
maskGroups.add(group);
}
}
}
}
_log.debug("Found {} export masks for block object {}", exportMasks.size(), bo.getLabel());
}
return exportMasks;
}
Aggregations