use of com.emc.storageos.customconfigcontroller.DataSource in project coprhd-controller by CoprHD.
the class NetworkScheduler method nameZone.
/**
* Assign a name to a zone using the current zone name configuration.
* The name is stored in the fabricInfo.
* The system-default name is composed of the following fields separated by underscores:
* 1. The prefix "SDS"
* 2. Hostname (maximum 32 characters)
* 3. The last twelve characters of the WWPN of the Initiator (without colons, upper case)
* 4. The last four digits of the Storage Array serial number.
* 5. The Storage Array Port Name (maximum 9 characters) (nothing but alpha-numeric characters).
*
* @param fabricInfo -- Contextual object for the operation. Contains the endpoints.
* @param hostName -- The host name for the given initiator.
* @param port -- The StoragePort used to find the StorageArray and get the PortName
* @param lsanZone -- a flag that indicates if the zone to be created is an LSAN zone
*/
private void nameZone(NetworkFCZoneInfo fabricInfo, String systemType, String hostName, String initiatorport, StoragePort port, boolean lsanZone) {
// use 1st two endpoints in name
if (fabricInfo.getEndPoints().size() < 2) {
throw NetworkDeviceControllerException.exceptions.nameZoneNotEnoughEndPoints();
}
// Use the StoragePort to find the StorageSystem
URI arrayUri = port.getStorageDevice();
StorageSystem array = _dbClient.queryObject(StorageSystem.class, arrayUri);
if (array == null) {
throw NetworkDeviceControllerException.exceptions.portStorageDeviceNotFound(port.getStorageDevice().toString(), port.getLabel());
}
Initiator initiator = NetworkUtil.findInitiatorInDB(initiatorport, _dbClient);
DataSource dataSource = dataSourceFactory.createZoneNameDataSource(hostName, initiator, port, fabricInfo.getFabricId(), array);
if (array.getSystemType().equals(DiscoveredDataObject.Type.vplex.name())) {
dataSource.addProperty(CustomConfigConstants.ARRAY_PORT_NAME, getVPlexPortName(port));
dataSource.addProperty(CustomConfigConstants.ARRAY_SERIAL_NUMBER, getVPlexClusterSerialNumber(port));
}
String resolvedZoneName = customConfigHandler.resolve(CustomConfigConstants.ZONE_MASK_NAME, systemType, dataSource);
validateZoneNameLength(resolvedZoneName, lsanZone, systemType);
String zoneName = customConfigHandler.getComputedCustomConfigValue(CustomConfigConstants.ZONE_MASK_NAME, systemType, dataSource);
if (lsanZone && DiscoveredDataObject.Type.brocade.name().equals(systemType)) {
zoneName = LSAN + zoneName;
}
fabricInfo.setZoneName(zoneName);
}
Aggregations