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