use of com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedExportMask 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.UnManagedDiscoveredObjects.UnManagedExportMask 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.UnManagedDiscoveredObjects.UnManagedExportMask in project coprhd-controller by CoprHD.
the class UnManagedExportMaskService method getUnManagedExportMaskInfo.
/**
* Show the details of an UnManagedExportMask.
*
* @param id the URN of a ViPR UnManagedExportMask
* @brief Show details for an unmanaged export mask
* @return UnManagedExportMaskRestRep
*/
@GET
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Path("/{id}")
@CheckPermission(roles = { Role.SYSTEM_ADMIN, Role.SYSTEM_MONITOR })
public UnManagedExportMaskRestRep getUnManagedExportMaskInfo(@PathParam("id") URI id) {
UnManagedExportMask uem = _dbClient.queryObject(UnManagedExportMask.class, id);
ArgValidator.checkEntityNotNull(uem, id, isIdEmbeddedInURL(id));
return map(uem);
}
use of com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedExportMask in project coprhd-controller by CoprHD.
the class VolumeIngestionUtil method createExportMask.
/**
* Creates an ExportMask for the given arguments and returns the BlockObject.
*
* @param eligibleMask an UnManagedExportMask to base the ExportMask on
* @param unManagedVolume the UnManagedVolume being ingested
* @param exportGroup the ExportGroup for the ExportMask
* @param volume the Volume object for the ExportMask
* @param dbClient a reference to the database client
* @param hosts a List of Hosts for the ExportMask
* @param cluster a Cluster for the ExportMask
* @param exportMaskLabel the name of the ExportMask
* @throws Exception
*/
public static <T extends BlockObject> ExportMask createExportMask(UnManagedExportMask eligibleMask, UnManagedVolume unManagedVolume, ExportGroup exportGroup, T volume, DbClient dbClient, List<Host> hosts, Cluster cluster, String exportMaskLabel) throws Exception {
_logger.info("Creating ExportMask for unManaged Mask {}", eligibleMask.getMaskName());
List<URI> initiatorUris = new ArrayList<URI>(Collections2.transform(eligibleMask.getKnownInitiatorUris(), CommonTransformerFunctions.FCTN_STRING_TO_URI));
List<Initiator> allInitiators = dbClient.queryObject(Initiator.class, initiatorUris);
List<Initiator> userAddedInis = VolumeIngestionUtil.findUserAddedInisFromExistingIniListInMask(allInitiators, eligibleMask.getId(), dbClient);
List<URI> storagePortUris = new ArrayList<URI>(Collections2.transform(eligibleMask.getKnownStoragePortUris(), CommonTransformerFunctions.FCTN_STRING_TO_URI));
Map<String, Integer> wwnToHluMap = extractWwnToHluMap(eligibleMask, dbClient);
ExportMask exportMask = ExportMaskUtils.initializeExportMaskWithVolumes(eligibleMask.getStorageSystemUri(), exportGroup, eligibleMask.getMaskName(), exportMaskLabel, allInitiators, null, storagePortUris, eligibleMask.getZoningMap(), volume, eligibleMask.getUnmanagedInitiatorNetworkIds(), eligibleMask.getNativeId(), userAddedInis, dbClient, wwnToHluMap);
// remove unmanaged mask if created if the block object is not marked as internal
if (!volume.checkInternalFlags(Flag.PARTIALLY_INGESTED)) {
_logger.info("breaking relationship between UnManagedExportMask {} and UnManagedVolume {}", eligibleMask.getMaskName(), unManagedVolume.getLabel());
unManagedVolume.getUnmanagedExportMasks().remove(eligibleMask.getId().toString());
eligibleMask.getUnmanagedVolumeUris().remove(unManagedVolume.getId().toString());
}
updateExportGroup(exportGroup, volume, wwnToHluMap, dbClient, allInitiators, hosts, cluster);
return exportMask;
}
use of com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedExportMask in project coprhd-controller by CoprHD.
the class VolumeIngestionUtil method validateUnManagedExportMasks.
/**
* Validates that all the selected UnManagedExportMasks are compatible for ingestion.
*
* Currently only VPLEX volumes are checked for presence of a
* single storage view per VPLEX cluster per host initiator.
*
* @param unManagedVolume the UnManagedVolume being ingested
* @param unManagedMasks the UnManagedExportMasks being ingested
* @param dbClient a reference to the database client
*/
public static void validateUnManagedExportMasks(UnManagedVolume unManagedVolume, List<UnManagedExportMask> unManagedMasks, DbClient dbClient) {
if (isVplexVolume(unManagedVolume)) {
Map<String, Set<String>> initToMaskMap = new HashMap<String, Set<String>>();
// vplex brownfield requires initiators to only be in one storage view.
// assemble a Set of all initiator ports being masked to the ingesting unmanaged volume
StringSet allInitiatorPortsBeingIngested = new StringSet();
for (UnManagedExportMask mask : unManagedMasks) {
allInitiatorPortsBeingIngested.addAll(mask.getKnownInitiatorNetworkIds());
allInitiatorPortsBeingIngested.addAll(mask.getUnmanagedInitiatorNetworkIds());
}
URIQueryResultList result = new URIQueryResultList();
dbClient.queryByConstraint(ContainmentConstraint.Factory.getStorageSystemUnManagedExportMaskConstraint(unManagedVolume.getStorageSystemUri()), result);
Set<URI> allMasksUrisForVplex = new HashSet<URI>();
Iterator<URI> it = result.iterator();
while (it.hasNext()) {
allMasksUrisForVplex.add(it.next());
}
List<UnManagedExportMask> allMasksForVplex = dbClient.queryObject(UnManagedExportMask.class, allMasksUrisForVplex);
for (UnManagedExportMask mask : allMasksForVplex) {
mapInitsToVplexStorageViews(initToMaskMap, mask, allInitiatorPortsBeingIngested);
}
_logger.info("initiator to UnManagedExportMask map is " + initToMaskMap);
// filter out any initiator to mask entries that satisfy the requirements of 1 storage view per initiator
Iterator<Entry<String, Set<String>>> mapEntries = initToMaskMap.entrySet().iterator();
while (mapEntries.hasNext()) {
Entry<String, Set<String>> entry = mapEntries.next();
if (entry.getValue().size() <= 1) {
mapEntries.remove();
}
}
// if any are left in the map, they violate the single storage view per initiator rule
if (!initToMaskMap.isEmpty()) {
StringBuilder errorDetails = new StringBuilder();
for (Entry<String, Set<String>> mapEntry : initToMaskMap.entrySet()) {
errorDetails.append("Initiator port ").append(mapEntry.getKey());
errorDetails.append(" is contained in the following storage views: ");
errorDetails.append(Joiner.on(", ").join(mapEntry.getValue())).append(". ");
}
_logger.error(errorDetails.toString());
throw IngestionException.exceptions.invalidExportConfiguration(errorDetails.toString());
}
}
}
Aggregations