Search in sources :

Example 1 with ScFaultDomain

use of com.emc.storageos.driver.dellsc.scapi.objects.ScFaultDomain in project coprhd-controller by CoprHD.

the class DellSCDiscovery method getPortList.

/**
 * Gets the ScControllerPorts for a system.
 *
 * @param api The API connection.
 * @param ssn The system serial number.
 * @return The ports.
 */
private Map<String, List<ScControllerPort>> getPortList(StorageCenterAPI api, String ssn) {
    Map<String, List<ScControllerPort>> ports = new HashMap<>();
    try {
        ScConfiguration scConfig = api.getScConfig(ssn);
        ScFaultDomain[] faultDomains = api.getFaultDomains(ssn);
        for (ScFaultDomain fd : faultDomains) {
            // See what kind of fault domain this is
            boolean virtualMode;
            if (ScControllerPort.FC_TRANSPORT_TYPE.equals(fd.transportType)) {
                virtualMode = "VirtualPort".equals(scConfig.fibreChannelTransportMode);
            } else if (ScControllerPort.ISCSI_TRANSPORT_TYPE.equals(fd.transportType)) {
                virtualMode = "VirtualPort".equals(scConfig.iscsiTransportMode);
            } else {
                // Not a currently supported transport type
                continue;
            }
            // Now get the actual ports
            if (!ports.containsKey(fd.name)) {
                ports.put(fd.name, new ArrayList<>());
            }
            ScControllerPort[] fdPorts = api.getFaultDomainPorts(fd.instanceId, virtualMode);
            for (ScControllerPort fdPort : fdPorts) {
                // See if we need to inherit the IP settings from the fault domain
                if (EMPTY_IPADDR.equals(fdPort.iscsiSubnetMask)) {
                    fdPort.iscsiSubnetMask = fd.subnetMask;
                }
                if (EMPTY_IPADDR.equals(fdPort.iscsiIpAddress)) {
                    fdPort.iscsiIpAddress = fd.targetIpv4Address;
                }
                ports.get(fd.name).add(fdPort);
            }
        }
    } catch (Exception e) {
        LOG.error(String.format("Error getting system controller ports: %s", e));
    }
    return ports;
}
Also used : ScControllerPort(com.emc.storageos.driver.dellsc.scapi.objects.ScControllerPort) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) List(java.util.List) ScFaultDomain(com.emc.storageos.driver.dellsc.scapi.objects.ScFaultDomain) ScConfiguration(com.emc.storageos.driver.dellsc.scapi.objects.ScConfiguration) DellSCDriverException(com.emc.storageos.driver.dellsc.DellSCDriverException) StorageCenterAPIException(com.emc.storageos.driver.dellsc.scapi.StorageCenterAPIException)

Example 2 with ScFaultDomain

use of com.emc.storageos.driver.dellsc.scapi.objects.ScFaultDomain in project coprhd-controller by CoprHD.

the class StorageCenterAPI method getFaultDomains.

/**
 * Gets all fault domains for a system.
 *
 * @param ssn The system serial number.
 * @return The fault domains.
 */
public ScFaultDomain[] getFaultDomains(String ssn) {
    RestResult rr = restClient.get(String.format("StorageCenter/StorageCenter/%s/FaultDomainList", ssn));
    if (checkResults(rr)) {
        return gson.fromJson(rr.getResult(), ScFaultDomain[].class);
    }
    LOG.warn(String.format("Error getting Storage Center configuration: %s", rr.getErrorMsg()));
    return new ScFaultDomain[0];
}
Also used : RestResult(com.emc.storageos.driver.dellsc.scapi.rest.RestResult) ScFaultDomain(com.emc.storageos.driver.dellsc.scapi.objects.ScFaultDomain)

Aggregations

ScFaultDomain (com.emc.storageos.driver.dellsc.scapi.objects.ScFaultDomain)2 DellSCDriverException (com.emc.storageos.driver.dellsc.DellSCDriverException)1 StorageCenterAPIException (com.emc.storageos.driver.dellsc.scapi.StorageCenterAPIException)1 ScConfiguration (com.emc.storageos.driver.dellsc.scapi.objects.ScConfiguration)1 ScControllerPort (com.emc.storageos.driver.dellsc.scapi.objects.ScControllerPort)1 RestResult (com.emc.storageos.driver.dellsc.scapi.rest.RestResult)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 List (java.util.List)1