use of com.emc.storageos.vplex.api.VPlexApiFactory in project coprhd-controller by CoprHD.
the class VPlexControllerUtils method getDistributedDevicePathToClusterMap.
/**
* Returns a Map of distributed device component context
* paths from the VPLEX API to VPLEX cluster names.
*
* @param vplexUri the VPLEX to query
* @param dbClient a reference to the database client
* @return a Map of distributed device component context
* paths from the VPLEX API to VPLEX cluster names
*
* @throws VPlexApiException
*/
public static Map<String, String> getDistributedDevicePathToClusterMap(URI vplexUri, DbClient dbClient) throws VPlexApiException {
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);
}
Map<String, String> distributedDevicePathToClusterMap = Collections.emptyMap();
if (null != client) {
distributedDevicePathToClusterMap = client.getDistributedDevicePathToClusterMap();
}
return distributedDevicePathToClusterMap;
}
use of com.emc.storageos.vplex.api.VPlexApiFactory in project coprhd-controller by CoprHD.
the class VPlexControllerUtils method validateSupportingDeviceStructure.
/**
* Validates that the underlying structure of the given device name
* satisfies the constraints for compatibility with ViPR. Used for
* validating unmanaged VPLEX volumes before ingestion.
*
* @param deviceName the device to validate
* @param vplexUri the VPLEX to query
* @param dbClient a reference to the database client
* @throws VPlexApiException if the device structure is incompatible with ViPR
*/
public static void validateSupportingDeviceStructure(String deviceName, URI vplexUri, DbClient dbClient) throws VPlexApiException {
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) {
String drillDownResponse = client.getDrillDownInfoForDevice(deviceName);
if (!VPlexUtil.isDeviceStructureValid(deviceName, drillDownResponse)) {
throw VPlexApiException.exceptions.deviceStructureIsIncompatibleForIngestion(drillDownResponse);
}
} else {
throw VPlexApiException.exceptions.failedToExecuteDrillDownCommand(deviceName, "cannot load vplex api client");
}
}
use of com.emc.storageos.vplex.api.VPlexApiFactory in project coprhd-controller by CoprHD.
the class VPlexControllerUtils method getStorageVolumeInfoForDevice.
/**
* Returns a Map of lowest-level storage-volume resource's WWN to its VPlexStorageVolumeInfo
* object for a given device name, virtual volume type, and cluster name. If
* hasMirror is true, this indicates the top-level device is composed of a
* RAID-1 mirror, so there's an extra layers of components to traverse in finding
* the lowest-level storage-volume resources.
*
* @param deviceName the name of the top-level device to look at
* @param virtualVolumeType the type of virtual volume (local or distributed)
* @param clusterName the cluster name
* @param hasMirror indicates if the top-level device is a RAID-1 mirror
* @param vplexUri the URI of the VPLEX system
* @param dbClient a reference to the database client
*
* @return a map of WWNs to VPlexStorageVolumeInfo objects
* @throws VPlexApiException
*/
public static Map<String, VPlexStorageVolumeInfo> getStorageVolumeInfoForDevice(String deviceName, String virtualVolumeType, String clusterName, boolean hasMirror, URI vplexUri, DbClient dbClient) throws VPlexApiException {
Map<String, VPlexStorageVolumeInfo> storageVolumeInfo = 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) {
storageVolumeInfo = client.getStorageVolumeInfoForDevice(deviceName, virtualVolumeType, clusterName, hasMirror);
}
log.info("Backend storage volume wwns for {} are {}", deviceName, storageVolumeInfo);
return storageVolumeInfo;
}
use of com.emc.storageos.vplex.api.VPlexApiFactory in project coprhd-controller by CoprHD.
the class VPlexMigrationJob 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 VPlexDeviceController method migrationSupportedForVolume.
/**
* Determines if the controller can support migration for the passed VPLEX volume.
*
* @param volume
* A reference to a VPLEX volume.
* @param varrayURI
* A reference to a varray or null.
*
* @return true if migration is supported, false otherwise.
*/
public static boolean migrationSupportedForVolume(Volume volume, URI varrayURI, DbClient dbClient) {
boolean supported = true;
// Migration is supported for all volumes that were not ingested.
if (volume.isIngestedVolumeWithoutBackend(dbClient)) {
VirtualPool vpool = dbClient.queryObject(VirtualPool.class, volume.getVirtualPool());
// Migration is supported for all local volumes.
if (VirtualPool.HighAvailabilityType.vplex_distributed.name().equals(vpool.getHighAvailability())) {
StorageSystem vplexSystem = dbClient.queryObject(StorageSystem.class, volume.getStorageController());
try {
VPlexApiFactory apiFactory = VPlexApiFactory.getInstance();
VPlexApiClient client = getVPlexAPIClient(apiFactory, vplexSystem, dbClient);
VPlexVirtualVolumeInfo vvInfo = client.getVirtualVolumeStructure(volume.getDeviceLabel());
VPlexDistributedDeviceInfo ddInfo = (VPlexDistributedDeviceInfo) vvInfo.getSupportingDeviceInfo();
List<VPlexDeviceInfo> localDeviceInfoList = ddInfo.getLocalDeviceInfo();
for (VPlexDeviceInfo localDeviceInfo : localDeviceInfoList) {
_log.info("localDeviceInfo: {}, {}", localDeviceInfo.getName(), localDeviceInfo.getCluster());
// the passed varray.
if (varrayURI != null) {
_log.info("varrayURI:{}", varrayURI);
String varrayCluster = ConnectivityUtil.getVplexClusterForVarray(varrayURI, vplexSystem.getId(), dbClient);
_log.info("varrayCluster:{}", varrayCluster);
if (!localDeviceInfo.getCluster().contains(varrayCluster)) {
continue;
}
}
// For distributed volumes, the local device must be built
// on a single extent.
_log.info("Local device: {}", localDeviceInfo.getName());
_log.info("Extent count: {}", localDeviceInfo.getExtentInfo().size());
if (localDeviceInfo.getExtentInfo().size() != 1) {
supported = false;
break;
}
}
} catch (VPlexApiException vae) {
_log.error("Exception checking if migration supported for volume:", vae);
throw vae;
} catch (Exception ex) {
_log.error("Exception checking if migration supported for volume", ex);
throw VPlexApiException.exceptions.failedGettingMigrationSupportedForVolume(vplexSystem.getId().toString(), volume.getLabel());
}
}
}
return supported;
}
Aggregations