Search in sources :

Example 6 with VPlexApiFactory

use of com.emc.storageos.vplex.api.VPlexApiFactory in project coprhd-controller by CoprHD.

the class VPlexCacheStatusJob method getVPlexAPIClient.

/**
 * Get the HTTP client for making requests to the VPlex at the endpoint
 * specified in the passed profile.
 *
 * @param jobContext The job context
 * @param vplexSystem The VPlex storage system
 *
 * @return A reference to the VPlex API HTTP client.
 * @throws URISyntaxException
 */
private VPlexApiClient getVPlexAPIClient(JobContext jobContext, StorageSystem vplexSystem) throws URISyntaxException {
    // Create the URI to access the VPlex Management Station based
    // on the IP and port for the passed VPlex system.
    URI vplexEndpointURI = new URI("https", null, vplexSystem.getIpAddress(), vplexSystem.getPortNumber(), "/", null, null);
    s_logger.debug("VPlex base URI is {}", vplexEndpointURI.toString());
    VPlexApiFactory vplexApiFactory = jobContext.getVPlexApiFactory();
    s_logger.debug("Got VPlex API factory");
    VPlexApiClient client = vplexApiFactory.getClient(vplexEndpointURI, vplexSystem.getUsername(), vplexSystem.getPassword());
    s_logger.debug("Got VPlex API client");
    return client;
}
Also used : VPlexApiClient(com.emc.storageos.vplex.api.VPlexApiClient) URI(java.net.URI) VPlexApiFactory(com.emc.storageos.vplex.api.VPlexApiFactory)

Example 7 with VPlexApiFactory

use of com.emc.storageos.vplex.api.VPlexApiFactory in project coprhd-controller by CoprHD.

the class VPlexControllerUtils method getDeviceInfo.

/**
 * Returns a VPlexResourceInfo object for the given device name based
 * on its virtual volume type (local or distributed).
 *
 * @param deviceName the name of the device
 * @param virtualVolumeType the type of virtual volume (local or distributed)
 * @param vplexUri the URI of the VPLEX system
 * @param dbClient a reference to the database client
 *
 * @return a VPlexResourceInfo object for the device name
 * @throws VPlexApiException
 */
public static VPlexResourceInfo getDeviceInfo(String deviceName, String virtualVolumeType, URI vplexUri, DbClient dbClient) throws VPlexApiException {
    VPlexResourceInfo device = null;
    VPlexApiClient client = null;
    try {
        VPlexApiFactory vplexApiFactory = VPlexApiFactory.getInstance();
        client = VPlexControllerUtils.getVPlexAPIClient(vplexApiFactory, vplexUri, dbClient);
    } catch (URISyntaxException e) {
        log.error("cannot load vplex api client", e);
    }
    if (null != client) {
        device = client.getDeviceStructure(deviceName, virtualVolumeType);
    }
    return device;
}
Also used : VPlexApiClient(com.emc.storageos.vplex.api.VPlexApiClient) URISyntaxException(java.net.URISyntaxException) VPlexResourceInfo(com.emc.storageos.vplex.api.VPlexResourceInfo) VPlexApiFactory(com.emc.storageos.vplex.api.VPlexApiFactory)

Example 8 with VPlexApiFactory

use of com.emc.storageos.vplex.api.VPlexApiFactory in project coprhd-controller by CoprHD.

the class VPlexControllerUtils method getClusterNameForId.

/**
 * Returns the cluster name (free form, user-configurable)
 * for a given VPLEX cluster id (either "1" or "2").
 *
 * @param clusterId the cluster id (either "1" or "2")
 * @param vplexUri URI of the VPLEX to look at
 * @param dbClient a database client instance
 *
 * @return the cluster name as configured by the user, or null
 *         if it couldn't be determined
 */
public static String getClusterNameForId(String clusterId, URI vplexUri, DbClient dbClient) {
    String clusterName = null;
    VPlexApiClient client = null;
    try {
        VPlexApiFactory vplexApiFactory = VPlexApiFactory.getInstance();
        client = VPlexControllerUtils.getVPlexAPIClient(vplexApiFactory, vplexUri, dbClient);
    } catch (URISyntaxException e) {
        log.error("cannot load vplex api client", e);
    }
    if (null != client) {
        clusterName = client.getClusterNameForId(clusterId);
    }
    log.info("VPLEX cluster name for cluster id {} is {}", clusterId, clusterName);
    return clusterName;
}
Also used : VPlexApiClient(com.emc.storageos.vplex.api.VPlexApiClient) URISyntaxException(java.net.URISyntaxException) VPlexApiFactory(com.emc.storageos.vplex.api.VPlexApiFactory)

Aggregations

VPlexApiClient (com.emc.storageos.vplex.api.VPlexApiClient)8 VPlexApiFactory (com.emc.storageos.vplex.api.VPlexApiFactory)8 URISyntaxException (java.net.URISyntaxException)6 URI (java.net.URI)2 StorageSystem (com.emc.storageos.db.client.model.StorageSystem)1 VirtualPool (com.emc.storageos.db.client.model.VirtualPool)1 DatabaseException (com.emc.storageos.db.exceptions.DatabaseException)1 DeviceControllerException (com.emc.storageos.exceptions.DeviceControllerException)1 InternalException (com.emc.storageos.svcs.errorhandling.resources.InternalException)1 InternalServerErrorException (com.emc.storageos.svcs.errorhandling.resources.InternalServerErrorException)1 ControllerException (com.emc.storageos.volumecontroller.ControllerException)1 VPlexApiException (com.emc.storageos.vplex.api.VPlexApiException)1 VPlexDeviceInfo (com.emc.storageos.vplex.api.VPlexDeviceInfo)1 VPlexDistributedDeviceInfo (com.emc.storageos.vplex.api.VPlexDistributedDeviceInfo)1 VPlexResourceInfo (com.emc.storageos.vplex.api.VPlexResourceInfo)1 VPlexStorageVolumeInfo (com.emc.storageos.vplex.api.VPlexStorageVolumeInfo)1 VPlexVirtualVolumeInfo (com.emc.storageos.vplex.api.VPlexVirtualVolumeInfo)1 WorkflowException (com.emc.storageos.workflow.WorkflowException)1 IOException (java.io.IOException)1