Search in sources :

Example 31 with RestResult

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;
}
Also used : RestResult(com.emc.storageos.driver.dellsc.scapi.rest.RestResult) PayloadFilter(com.emc.storageos.driver.dellsc.scapi.rest.PayloadFilter) ScServerHba(com.emc.storageos.driver.dellsc.scapi.objects.ScServerHba)

Example 32 with RestResult

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];
}
Also used : ScVolume(com.emc.storageos.driver.dellsc.scapi.objects.ScVolume) RestResult(com.emc.storageos.driver.dellsc.scapi.rest.RestResult) PayloadFilter(com.emc.storageos.driver.dellsc.scapi.rest.PayloadFilter)

Example 33 with RestResult

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];
}
Also used : ScControllerPort(com.emc.storageos.driver.dellsc.scapi.objects.ScControllerPort) RestResult(com.emc.storageos.driver.dellsc.scapi.rest.RestResult)

Example 34 with RestResult

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];
}
Also used : RestResult(com.emc.storageos.driver.dellsc.scapi.rest.RestResult) PayloadFilter(com.emc.storageos.driver.dellsc.scapi.rest.PayloadFilter) ScReplayProfile(com.emc.storageos.driver.dellsc.scapi.objects.ScReplayProfile)

Example 35 with RestResult

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);
}
Also used : Parameters(com.emc.storageos.driver.dellsc.scapi.rest.Parameters) RestResult(com.emc.storageos.driver.dellsc.scapi.rest.RestResult)

Aggregations

RestResult (com.emc.storageos.driver.dellsc.scapi.rest.RestResult)44 Parameters (com.emc.storageos.driver.dellsc.scapi.rest.Parameters)16 PayloadFilter (com.emc.storageos.driver.dellsc.scapi.rest.PayloadFilter)12 ScVolume (com.emc.storageos.driver.dellsc.scapi.objects.ScVolume)4 ScServerHba (com.emc.storageos.driver.dellsc.scapi.objects.ScServerHba)3 ScVolumeConfiguration (com.emc.storageos.driver.dellsc.scapi.objects.ScVolumeConfiguration)3 ArrayList (java.util.ArrayList)3 ScControllerPort (com.emc.storageos.driver.dellsc.scapi.objects.ScControllerPort)2 ScMapping (com.emc.storageos.driver.dellsc.scapi.objects.ScMapping)2 ScMappingProfile (com.emc.storageos.driver.dellsc.scapi.objects.ScMappingProfile)2 ScObject (com.emc.storageos.driver.dellsc.scapi.objects.ScObject)2 ScReplay (com.emc.storageos.driver.dellsc.scapi.objects.ScReplay)2 ScServer (com.emc.storageos.driver.dellsc.scapi.objects.ScServer)2 ScStorageType (com.emc.storageos.driver.dellsc.scapi.objects.ScStorageType)2 ScFaultDomain (com.emc.storageos.driver.dellsc.scapi.objects.ScFaultDomain)1 ScReplayConsistencyGroup (com.emc.storageos.driver.dellsc.scapi.objects.ScReplayConsistencyGroup)1 ScReplayProfile (com.emc.storageos.driver.dellsc.scapi.objects.ScReplayProfile)1 ScServerOperatingSystem (com.emc.storageos.driver.dellsc.scapi.objects.ScServerOperatingSystem)1