use of com.emc.storageos.driver.dellsc.scapi.rest.RestResult in project coprhd-controller by CoprHD.
the class StorageCenterAPI method findServerHba.
/**
* Find an initiator WWN or iSCSI IQN.
*
* @param ssn The Storage Center SN on which to check.
* @param iqnOrWwn The FC WWN or iSCSI IQN.
* @return The HBA object.
*/
private ScServerHba findServerHba(String ssn, String iqnOrWwn) {
ScServerHba result = null;
PayloadFilter filter = new PayloadFilter();
filter.append("scSerialNumber", ssn);
filter.append("instanceName", iqnOrWwn);
RestResult rr = restClient.post("StorageCenter/ScServerHba/GetList", filter.toJson());
if (checkResults(rr)) {
ScServerHba[] hbas = gson.fromJson(rr.getResult(), ScServerHba[].class);
for (ScServerHba hba : hbas) {
// Should only return one if found, but just grab first from list
result = hba;
break;
}
}
return result;
}
use of com.emc.storageos.driver.dellsc.scapi.rest.RestResult in project coprhd-controller by CoprHD.
the class StorageCenterAPI method getAllVolumes.
/**
* Gets all volumes.
*
* @param ssn The Storage Center to query from.
* @return The volumes on the requested SC.
*/
public ScVolume[] getAllVolumes(String ssn) {
PayloadFilter filter = new PayloadFilter();
filter.append("scSerialNumber", ssn);
RestResult rr = restClient.post("StorageCenter/ScVolume/GetList", filter.toJson());
if (checkResults(rr)) {
return gson.fromJson(rr.getResult(), ScVolume[].class);
}
return new ScVolume[0];
}
use of com.emc.storageos.driver.dellsc.scapi.rest.RestResult in project coprhd-controller by CoprHD.
the class StorageCenterAPI method getFaultDomainPorts.
/**
* Gets the virtual ports in a fault domain.
*
* @param instanceId The fault domain instance ID.
* @param True to get virtual ports, false to get physical.
* @return The controller ports.
*/
public ScControllerPort[] getFaultDomainPorts(String instanceId, boolean virtualPorts) {
String portType = virtualPorts ? "Virtual" : "Physical";
RestResult rr = restClient.get(String.format("StorageCenter/ScFaultDomain/%s/%sPortList", instanceId, portType));
if (checkResults(rr)) {
return gson.fromJson(rr.getResult(), ScControllerPort[].class);
}
LOG.warn(String.format("Error getting controller ports for fault domain %s: %s", instanceId, rr.getErrorMsg()));
return new ScControllerPort[0];
}
use of com.emc.storageos.driver.dellsc.scapi.rest.RestResult in project coprhd-controller by CoprHD.
the class StorageCenterAPI method getConsistencyGroups.
/**
* Gets all replay profiles that are consistent type.
*
* @param ssn The Storage Center serial number.
* @return The consistent replay profiles.
*/
public ScReplayProfile[] getConsistencyGroups(String ssn) {
PayloadFilter filter = new PayloadFilter();
filter.append("scSerialNumber", ssn);
filter.append("type", "Consistent");
RestResult rr = restClient.post("StorageCenter/ScReplayProfile/GetList", filter.toJson());
if (checkResults(rr)) {
return gson.fromJson(rr.getResult(), ScReplayProfile[].class);
}
return new ScReplayProfile[0];
}
use of com.emc.storageos.driver.dellsc.scapi.rest.RestResult in project coprhd-controller by CoprHD.
the class StorageCenterAPI method addHbaToServer.
/**
* Add an HBA to a server definition.
*
* @param instanceId The server instance ID.
* @param iqnOrWwn The IQN or WWN to add.
* @param isIscsi Whether it is iSCSI or FC.
* @return The added ScServerHba.
*/
public ScServerHba addHbaToServer(String instanceId, String iqnOrWwn, boolean isIscsi) {
Parameters params = new Parameters();
params.add("HbaPortType", isIscsi ? "Iscsi" : "FibreChannel");
params.add("WwnOrIscsiName", iqnOrWwn);
params.add("AllowManual", true);
RestResult rr = restClient.post(String.format("StorageCenter/ScPhysicalServer/%s/AddHba", instanceId), params.toJson());
if (!checkResults(rr)) {
LOG.warn("Error adding HBA to server {}", rr.getErrorMsg());
return null;
}
return gson.fromJson(rr.getResult(), ScServerHba.class);
}
Aggregations