use of com.emc.storageos.db.client.model.ZoneInfoMap 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);
}
}
use of com.emc.storageos.db.client.model.ZoneInfoMap in project coprhd-controller by CoprHD.
the class NetworkDeviceController method fetchInitiatorsInNetworkZoneInfoMap.
/**
* For the given network and initiators, which are in the network,
* and a given list of storage ports, find all the zones on the network
* system for the initiators. Search the zones to find ones that have
* one or more of the ports and create the zoning map between the
* initiators and ports. Returns the results as {@link ZoneInfoMap} which is map
* of initiator port WWN and storage port WWN keyed by zone-key, where zone-key
* is the concatenation of the initiator port WWN and the storage port WWN.
* <p>
* Note that the map returned contains only the zones that were selected for use by ViPR. In the case of duplicate zones between an
* initiator-port pair, ViPR applies a selection criteria to choose one. See {@link #selectZonesForInitiatorsAndPorts}
* <p>
* Note that a zone in the network system can have more than one initiator and one storage port. For such zone, there can be multiple
* entries in the map, one for each initiator/port pairs.
* <p>
* If the initiator is not in a network or no zones could be found for the initiator, there will be no entries for this initiator in the
* map. An empty map will be returned if no zones could be found for any initiator.
*
* @param network the network of the initiators
* @param map an OUT parameter where ZoneInfoMap is stored
* @param initiators the initiators for which the zones will be read
* @param initiatorPortsMap the storage ports of interest in the networks.
* @return the network system used to read the zones
*/
private NetworkSystem fetchInitiatorsInNetworkZoneInfoMap(NetworkLite network, ZoneInfoMap map, List<Initiator> initiators, Map<String, StoragePort> initiatorPortsMap) {
Map<String, Initiator> wwnToInitiatorMap = wwnToInitiatorMap(initiators);
// retrieve the zones
Map<String, List<Zone>> wwnToZones = new HashMap<String, List<Zone>>();
NetworkSystem networkSystem = fetchInitiatorsZones(network, initiators, wwnToZones);
wwnToZones = selectZonesForInitiatorsAndPorts(network, wwnToZones, initiatorPortsMap);
// if we successfully retrieved the zones
if (networkSystem != null && !wwnToZones.isEmpty()) {
ZoneInfo info = null;
Initiator initiator = null;
for (Map.Entry<String, List<Zone>> entry : wwnToZones.entrySet()) {
initiator = wwnToInitiatorMap.get(entry.getKey());
for (Zone zone : entry.getValue()) {
// I need some logic here to make sure I select the best zone
for (ZoneMember member : zone.getMembers()) {
if (initiatorPortsMap.containsKey(member.getAddress())) {
// double check WWN formatting
StoragePort port = initiatorPortsMap.get(member.getAddress());
info = new ZoneInfo();
info.setZoneName(zone.getName());
info.setInitiatorWwn(initiator.getInitiatorPort());
info.setInitiatorId(initiator.getId().toString());
info.setPortWwn(port.getPortNetworkId());
info.setPortId(port.getId().toString());
info.setNetworkId(network.getId().toString());
info.setNetworkWwn(NetworkUtil.getNetworkWwn(network));
info.setFabricId(network.getNativeId());
info.setNetworkSystemId(networkSystem.getId().toString());
info.setMemberCount(zone.getMembers().size());
map.put(info.getZoneReferenceKey(), info);
}
}
}
}
}
return networkSystem;
}
use of com.emc.storageos.db.client.model.ZoneInfoMap in project coprhd-controller by CoprHD.
the class NetworkDeviceController method getInitiatorsZoneInfoMap.
/**
* Given a list of initiators, and a list of ports, for each initiator, find the
* zones on the network system where the initiator port WWN and the storage port
* WWN is a member. Returns the results as {@link ZoneInfoMap} which is map
* of initiator port WWN and storage port WWN keyed by zone-key, where zone-key
* is the concatenation of the initiator port WWN and the storage port WWN.
* <p>
* Note that a zone in the network system can have more than one initiator and one storage port. For such zone, there can be multiple
* entries in the map, one for each initiator/port pairs.
* <p>
* If the initiator is not in a network or no zones could be found for the initiator, there will be no entries for this initiator in the
* map. An empty map will be returned if no zones could be found for any initiator.
*
* @param initiators the list of initiators.
* @param storagePorts
* @return an instance of {@link ZoneInfoMap} which is which is map
* of initiator port WWN and storage port WWN keyed by zone-key, where zone-key
* is the concatenation of the initiator port WWN and the storage port WWN.
*/
public ZoneInfoMap getInitiatorsZoneInfoMap(List<Initiator> initiators, List<StoragePort> storagePorts) {
ZoneInfoMap zoningMap = new ZoneInfoMap();
Map<NetworkLite, List<Initiator>> initiatorsByNetworkMap = NetworkUtil.getInitiatorsByNetwork(initiators, _dbClient);
for (Map.Entry<NetworkLite, List<Initiator>> entry : initiatorsByNetworkMap.entrySet()) {
if (!Transport.FC.toString().equals(entry.getKey().getTransportType())) {
continue;
}
Map<String, StoragePort> initiatorPortsMap = NetworkUtil.getPortsInNetworkMap(entry.getKey(), storagePorts);
if (initiatorPortsMap.size() > 0) {
zoningMap.putAll(getInitiatorsInNetworkZoneInfoMap(entry.getKey(), entry.getValue(), initiatorPortsMap));
}
}
return zoningMap;
}
use of com.emc.storageos.db.client.model.ZoneInfoMap in project coprhd-controller by CoprHD.
the class NetworkDeviceController method getInitiatorsInNetworkZoneInfoMap.
/**
* For the given network and initiators, which are in the network,
* and a given list of storage ports, find all the zones on the network
* system for the initiators. Search the zones to find ones that have
* one or more of the ports and create the zoning map between the
* initiators and ports. Returns the results as {@link ZoneInfoMap} which is map
* of initiator port WWN and storage port WWN keyed by zone-key, where zone-key
* is the concatenation of the initiator port WWN and the storage port WWN.
* <p>
* Note that the map returned contains only the zones that were selected for use by ViPR. In the case of duplicate zones between an
* initiator-port pair, ViPR applies a selection criteria to choose one. See {@link #selectZonesForInitiatorsAndPorts}
* <p>
* Note that a zone in the network system can have more than one initiator and one storage port. For such zone, there can be multiple
* entries in the map, one for each initiator/port pairs.
* <p>
* If the initiator is not in a network or no zones could be found for the initiator, there will be no entries for this initiator in the
* map. An empty map will be returned if no zones could be found for any initiator.
*
* @param network the network of the initiators
* @param initiators the initiators for which the zones will be read
* @param initiatorPortsMap the storage ports of interest in the networks.
* @return a ZoneInfoMap a map of zones found that have at least one of initiators and one of the ports
*/
private ZoneInfoMap getInitiatorsInNetworkZoneInfoMap(NetworkLite network, List<Initiator> initiators, Map<String, StoragePort> initiatorPortsMap) {
ZoneInfoMap map = new ZoneInfoMap();
fetchInitiatorsInNetworkZoneInfoMap(network, map, initiators, initiatorPortsMap);
return map;
}
Aggregations