Search in sources :

Example 21 with DataSource

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);
}
Also used : Initiator(com.emc.storageos.db.client.model.Initiator) URI(java.net.URI) StorageSystem(com.emc.storageos.db.client.model.StorageSystem) DataSource(com.emc.storageos.customconfigcontroller.DataSource)

Aggregations

DataSource (com.emc.storageos.customconfigcontroller.DataSource)21 Initiator (com.emc.storageos.db.client.model.Initiator)7 DeviceControllerException (com.emc.storageos.exceptions.DeviceControllerException)7 URI (java.net.URI)7 ArrayList (java.util.ArrayList)7 ServiceError (com.emc.storageos.svcs.errorhandling.model.ServiceError)6 Project (com.emc.storageos.db.client.model.Project)5 StorageSystem (com.emc.storageos.db.client.model.StorageSystem)5 StringSet (com.emc.storageos.db.client.model.StringSet)5 HashSet (java.util.HashSet)5 ExportMask (com.emc.storageos.db.client.model.ExportMask)4 HashMap (java.util.HashMap)4 URIQueryResultList (com.emc.storageos.db.client.constraint.URIQueryResultList)3 NamedURI (com.emc.storageos.db.client.model.NamedURI)3 TenantOrg (com.emc.storageos.db.client.model.TenantOrg)3 Volume (com.emc.storageos.db.client.model.Volume)3 DatabaseException (com.emc.storageos.db.exceptions.DatabaseException)3 InternalException (com.emc.storageos.svcs.errorhandling.resources.InternalException)3 InternalServerErrorException (com.emc.storageos.svcs.errorhandling.resources.InternalServerErrorException)3 ControllerException (com.emc.storageos.volumecontroller.ControllerException)3