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;
}
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];
}
Aggregations