Search in sources :

Example 6 with ZoneInfo

use of com.emc.storageos.db.client.model.ZoneInfo in project coprhd-controller by CoprHD.

the class ExportMaskUtils method getZoneMapFromZoneInfoMap.

/**
 * Given zoneInfoMap stored in an UnManagedExportMask, create a zone map for the
 * initiators in the list.
 *
 * @param zoneInfoMap zoneInfoMap stored from a UnManagedExportMask
 * @param initiators a list of initiators for which the zone map should created
 * @return a zone map of initiator-uri-to-list-of-ports-uris
 */
public static StringSetMap getZoneMapFromZoneInfoMap(ZoneInfoMap zoneInfoMap, List<Initiator> initiators) {
    StringSetMap zoneMap = new StringSetMap();
    if (zoneInfoMap != null && initiators != null) {
        for (Initiator initiator : initiators) {
            for (ZoneInfo info : zoneInfoMap.values()) {
                if (info.getInitiatorId().equals(initiator.getId().toString())) {
                    zoneMap.put(initiator.getId().toString(), info.getPortId());
                }
            }
        }
    }
    _log.info("getZoneMapFromZoneInfoMap created zone map {}", zoneMap);
    return zoneMap;
}
Also used : StringSetMap(com.emc.storageos.db.client.model.StringSetMap) Initiator(com.emc.storageos.db.client.model.Initiator) ZoneInfo(com.emc.storageos.db.client.model.ZoneInfo)

Example 7 with ZoneInfo

use of com.emc.storageos.db.client.model.ZoneInfo in project coprhd-controller by CoprHD.

the class VNXUnityUnManagedObjectDiscoverer method updateZoningMap.

/**
 * Set mask zoning map
 *
 * @param mask
 * @param initiators
 * @param storagePorts
 */
private void updateZoningMap(UnManagedExportMask mask, List<Initiator> initiators, List<StoragePort> storagePorts) {
    ZoneInfoMap zoningMap = networkDeviceController.getInitiatorsZoneInfoMap(initiators, storagePorts);
    for (ZoneInfo zoneInfo : zoningMap.values()) {
        log.info("Found zone: {} for initiator {} and port {}", new Object[] { zoneInfo.getZoneName(), zoneInfo.getInitiatorWwn(), zoneInfo.getPortWwn() });
    }
    mask.setZoningMap(zoningMap);
}
Also used : ZoneInfoMap(com.emc.storageos.db.client.model.ZoneInfoMap) ZoneInfo(com.emc.storageos.db.client.model.ZoneInfo)

Example 8 with ZoneInfo

use of com.emc.storageos.db.client.model.ZoneInfo in project coprhd-controller by CoprHD.

the class ExportMaskUtils method checkZoneUseInUnManagedExportMasks.

/**
 * Check if a particular zone (as represented by a ZoneInfo) is in use by an UnManagedExportMask
 * (excluding the UnManagedExportMask corresponding to the named exportMask.
 * @param exportMaskName -- ExportMask name filed
 * @param info -- ZoneInfo representing the Zone
 * @param dbClient == databasehandle
 * @return -- true IFF the same zone was found in other UnManagedExportMasks
 */
private static boolean checkZoneUseInUnManagedExportMasks(String exportMaskName, ZoneInfo info, DbClient dbClient) {
    String initiatorWwn = info.getInitiatorWwn();
    boolean inUse = false;
    List<UnManagedExportMask> unmanagedMasks = CustomQueryUtility.queryActiveResourcesByAltId(dbClient, UnManagedExportMask.class, "knownInitiatorNetworkIds", initiatorWwn);
    for (UnManagedExportMask umask : unmanagedMasks) {
        if (umask.getKnownInitiatorNetworkIds().contains(initiatorWwn) && !umask.getUnmanagedVolumeUris().isEmpty()) {
            for (ZoneInfo umZoneInfo : umask.getZoningMap().values()) {
                if (exportMaskName.equals(umask.getMaskName())) {
                    continue;
                }
                if (info.getInitiatorWwn().equals(umZoneInfo.getInitiatorWwn()) && info.getPortWwn().equals(umZoneInfo.getPortWwn())) {
                    _log.info(String.format("UnManagedExportMask %s zone %s is using the same initiator %s and port %s", umask.getNativeId(), umZoneInfo.getZoneName(), umZoneInfo.getInitiatorWwn(), umZoneInfo.getPortWwn()));
                    inUse = true;
                    break;
                }
            }
        }
    }
    return inUse;
}
Also used : ZoneInfo(com.emc.storageos.db.client.model.ZoneInfo) UnManagedExportMask(com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedExportMask)

Example 9 with ZoneInfo

use of com.emc.storageos.db.client.model.ZoneInfo in project coprhd-controller by CoprHD.

the class XtremIOUnManagedVolumeDiscoverer method updateZoningMap.

private void updateZoningMap(UnManagedExportMask mask, List<Initiator> initiators, List<StoragePort> storagePorts) {
    ZoneInfoMap zoningMap = networkDeviceController.getInitiatorsZoneInfoMap(initiators, storagePorts);
    for (ZoneInfo zoneInfo : zoningMap.values()) {
        log.info("Found zone: {} for initiator {} and port {}", new Object[] { zoneInfo.getZoneName(), zoneInfo.getInitiatorWwn(), zoneInfo.getPortWwn() });
    }
    mask.setZoningMap(zoningMap);
}
Also used : ZoneInfoMap(com.emc.storageos.db.client.model.ZoneInfoMap) ZoneInfo(com.emc.storageos.db.client.model.ZoneInfo)

Example 10 with ZoneInfo

use of com.emc.storageos.db.client.model.ZoneInfo in project coprhd-controller by CoprHD.

the class ExportProcessor method updateZoningMap.

private void updateZoningMap(UnManagedExportMask mask, List<Initiator> initiators, List<StoragePort> storagePorts) {
    NetworkDeviceController networkDeviceController = (NetworkDeviceController) _keyMap.get(Constants.networkDeviceController);
    try {
        ZoneInfoMap zoningMap = networkDeviceController.getInitiatorsZoneInfoMap(initiators, storagePorts);
        for (ZoneInfo zoneInfo : zoningMap.values()) {
            _logger.info("Found zone: {} for initiator {} and port {}", new Object[] { zoneInfo.getZoneName(), zoneInfo.getInitiatorWwn(), zoneInfo.getPortWwn() });
        }
        mask.setZoningMap(zoningMap);
    } catch (Exception ex) {
        _logger.error("Failed to get the zoning map for mask {}", mask.getMaskName());
        mask.setZoningMap(null);
    }
}
Also used : NetworkDeviceController(com.emc.storageos.networkcontroller.impl.NetworkDeviceController) ZoneInfoMap(com.emc.storageos.db.client.model.ZoneInfoMap) ZoneInfo(com.emc.storageos.db.client.model.ZoneInfo) BaseCollectionException(com.emc.storageos.plugins.BaseCollectionException)

Aggregations

ZoneInfo (com.emc.storageos.db.client.model.ZoneInfo)11 ZoneInfoMap (com.emc.storageos.db.client.model.ZoneInfoMap)7 Initiator (com.emc.storageos.db.client.model.Initiator)4 ArrayList (java.util.ArrayList)4 URIQueryResultList (com.emc.storageos.db.client.constraint.URIQueryResultList)3 StringSetMap (com.emc.storageos.db.client.model.StringSetMap)3 NetworkFCZoneInfo (com.emc.storageos.networkcontroller.NetworkFCZoneInfo)3 FCZoneReference (com.emc.storageos.db.client.model.FCZoneReference)2 StoragePort (com.emc.storageos.db.client.model.StoragePort)2 StringSet (com.emc.storageos.db.client.model.StringSet)2 UnManagedExportMask (com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedExportMask)2 URI (java.net.URI)2 List (java.util.List)2 BlockObject (com.emc.storageos.db.client.model.BlockObject)1 DiscoveredDataObject (com.emc.storageos.db.client.model.DiscoveredDataObject)1 ExportGroup (com.emc.storageos.db.client.model.ExportGroup)1 NetworkSystem (com.emc.storageos.db.client.model.NetworkSystem)1 StringMap (com.emc.storageos.db.client.model.StringMap)1 UnManagedVolume (com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedVolume)1 DatabaseException (com.emc.storageos.db.exceptions.DatabaseException)1