Search in sources :

Example 11 with Joiner

use of com.emc.storageos.db.joiner.Joiner in project coprhd-controller by CoprHD.

the class VPlexUtil method getExportMasksWithExistingInitiators.

/**
 * Returns ExportMask for the VPLEX cluster where passed in list of initiators is in the existingInitiators List.
 *
 * @param vplexURI URI of the VPLEX system
 * @param dbClient database client instance
 * @param inits List of Initiators
 * @param varrayUri URI of the Virtual Array
 * @param vplexCluster VPLEX Cluster value (1 or 2)
 * @return the ExportMask with inits in the existingInitiators list
 * @throws Exception
 */
public static ExportMask getExportMasksWithExistingInitiators(URI vplexURI, DbClient dbClient, List<Initiator> inits, URI varrayURI, String vplexCluster) throws Exception {
    ExportMask sharedVplexExportMask = null;
    // Get initiators WWN in upper case without colons
    Collection<String> initiatorNames = Collections2.transform(inits, CommonTransformerFunctions.fctnInitiatorToPortName());
    // J1 joiner to fetch all the exportMasks for the VPLEX where existingInitiators list match one or all inits.
    Joiner j1 = new Joiner(dbClient);
    j1.join(ExportMask.class, "exportmask").match("existingInitiators", initiatorNames).match("storageDevice", vplexURI).go().printTuples("exportmask");
    List<ExportMask> exportMasks = j1.list("exportmask");
    // exportMasks list could have mask for both the VPLEX cluster for the same initiators for the cross-connect case
    // hence get the ExportMask for the specific VPLEX cluster.
    List<ExportMask> exportMasksForVplexCluster = getExportMasksForVplexCluster(vplexURI, dbClient, varrayURI, vplexCluster, exportMasks);
    if (!exportMasksForVplexCluster.isEmpty()) {
        sharedVplexExportMask = exportMasksForVplexCluster.get(0);
        _log.info(String.format("Found ExportMask %s %s with some or all initiators %s in the existing initiators.", sharedVplexExportMask.getMaskName(), sharedVplexExportMask.getId(), initiatorNames));
    }
    return sharedVplexExportMask;
}
Also used : Joiner(com.emc.storageos.db.joiner.Joiner) ExportMask(com.emc.storageos.db.client.model.ExportMask)

Aggregations

Joiner (com.emc.storageos.db.joiner.Joiner)11 URI (java.net.URI)5 HashMap (java.util.HashMap)4 ExportMask (com.emc.storageos.db.client.model.ExportMask)3 Initiator (com.emc.storageos.db.client.model.Initiator)3 ArrayList (java.util.ArrayList)3 FCZoneReference (com.emc.storageos.db.client.model.FCZoneReference)2 StoragePort (com.emc.storageos.db.client.model.StoragePort)2 StorageSystem (com.emc.storageos.db.client.model.StorageSystem)2 UnManagedExportMask (com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedExportMask)2 Volume (com.emc.storageos.db.client.model.Volume)2 List (java.util.List)2 AlternateIdConstraint (com.emc.storageos.db.client.constraint.AlternateIdConstraint)1 URIQueryResultList (com.emc.storageos.db.client.constraint.URIQueryResultList)1 Bucket (com.emc.storageos.db.client.model.Bucket)1 DataObject (com.emc.storageos.db.client.model.DataObject)1 FileShare (com.emc.storageos.db.client.model.FileShare)1 StoragePool (com.emc.storageos.db.client.model.StoragePool)1 StringSet (com.emc.storageos.db.client.model.StringSet)1 UnManagedVolume (com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedVolume)1