Search in sources :

Example 6 with UnManagedExportMask

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;
}
Also used : UnManagedExportMask(com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedExportMask) ExportMask(com.emc.storageos.db.client.model.ExportMask) ArrayList(java.util.ArrayList) URI(java.net.URI)

Example 7 with UnManagedExportMask

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;
}
Also used : UnManagedExportMask(com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedExportMask) ExportMask(com.emc.storageos.db.client.model.ExportMask)

Example 8 with UnManagedExportMask

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);
}
Also used : UnManagedExportMask(com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedExportMask) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET) CheckPermission(com.emc.storageos.security.authorization.CheckPermission)

Example 9 with UnManagedExportMask

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;
}
Also used : BigInteger(java.math.BigInteger) Initiator(com.emc.storageos.db.client.model.Initiator) UnManagedExportMask(com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedExportMask) ExportMask(com.emc.storageos.db.client.model.ExportMask) ArrayList(java.util.ArrayList) NamedURI(com.emc.storageos.db.client.model.NamedURI) URI(java.net.URI)

Example 10 with UnManagedExportMask

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());
        }
    }
}
Also used : ProtectionSet(com.emc.storageos.db.client.model.ProtectionSet) Set(java.util.Set) HashSet(java.util.HashSet) UnManagedProtectionSet(com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedProtectionSet) AbstractChangeTrackingSet(com.emc.storageos.db.client.model.AbstractChangeTrackingSet) StringSet(com.emc.storageos.db.client.model.StringSet) HashMap(java.util.HashMap) NamedURI(com.emc.storageos.db.client.model.NamedURI) URI(java.net.URI) URIQueryResultList(com.emc.storageos.db.client.constraint.URIQueryResultList) Entry(java.util.Map.Entry) StringSet(com.emc.storageos.db.client.model.StringSet) UnManagedExportMask(com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedExportMask) HashSet(java.util.HashSet)

Aggregations

UnManagedExportMask (com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedExportMask)46 URI (java.net.URI)33 ArrayList (java.util.ArrayList)26 HashSet (java.util.HashSet)20 URIQueryResultList (com.emc.storageos.db.client.constraint.URIQueryResultList)19 StringSet (com.emc.storageos.db.client.model.StringSet)17 Initiator (com.emc.storageos.db.client.model.Initiator)15 HashMap (java.util.HashMap)14 UnManagedVolume (com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedVolume)13 ExportMask (com.emc.storageos.db.client.model.ExportMask)8 NamedURI (com.emc.storageos.db.client.model.NamedURI)8 Map (java.util.Map)8 Set (java.util.Set)8 StringSetMap (com.emc.storageos.db.client.model.StringSetMap)7 Volume (com.emc.storageos.db.client.model.Volume)7 StoragePort (com.emc.storageos.db.client.model.StoragePort)6 StorageSystem (com.emc.storageos.db.client.model.StorageSystem)6 BaseCollectionException (com.emc.storageos.plugins.BaseCollectionException)6 CIMInstance (javax.cim.CIMInstance)5 CIMObjectPath (javax.cim.CIMObjectPath)5