use of com.emc.storageos.vnxe.VNXeException in project coprhd-controller by CoprHD.
the class FileSystemSnapRequestsTest method restoreSnap.
@Test
public void restoreSnap() {
FileSystemSnapRequests req = new FileSystemSnapRequests(_client);
VNXeCommandJob response = null;
try {
response = req.restoreFileSystemSnap("98784247833", null, "3.1.0");
} catch (VNXeException e) {
logger.error("VNXeException occured", e);
}
System.out.println(response.getId());
}
use of com.emc.storageos.vnxe.VNXeException in project coprhd-controller by CoprHD.
the class VNXUnityCommunicationInterface method collectStatisticsInformation.
@Override
public void collectStatisticsInformation(AccessProfile accessProfile) throws VNXeException {
URI storageSystemId = accessProfile.getSystemId();
StorageSystem storageSystem = null;
try {
_logger.info("Start collecting statistics for ip address {}", accessProfile.getIpAddress());
VNXeApiClient client = getVnxUnityClient(accessProfile);
long latestSampleTime = accessProfile.getLastSampleTime();
storageSystem = _dbClient.queryObject(StorageSystem.class, storageSystemId);
String serialNumber = storageSystem.getSerialNumber();
String deviceType = storageSystem.getSystemType();
// compute static load processor code
computeStaticLoadMetrics(accessProfile);
// TODO: Do we need usage stats?
_logger.info("End collecting statistics for ip address {}", accessProfile.getIpAddress());
} catch (Exception e) {
_logger.error("CollectStatisticsInformation failed. Storage system: " + storageSystemId, e);
throw VNXeException.exceptions.discoveryError("Failed to collect statistics ", e);
}
}
use of com.emc.storageos.vnxe.VNXeException in project coprhd-controller by CoprHD.
the class VNXeCommunicationInterface method discover.
/**
* Implementation for discovery for Vnxe storage systems, file related only
* for now
*
* @param accessProfile
*
* @throws VNXeException
*/
@Override
public void discover(AccessProfile accessProfile) throws VNXeException {
URI storageSystemURI = accessProfile.getSystemId();
StorageSystem viprStorageSystem = null;
String detailedStatusMessage = "Unknown Status";
try {
_logger.info("Access Profile Details : IpAddress : {}, PortNumber : {}", accessProfile.getIpAddress(), accessProfile.getPortNumber());
if (null != accessProfile.getnamespace() && (accessProfile.getnamespace().equals(StorageSystem.Discovery_Namespaces.UNMANAGED_VOLUMES.toString()) || accessProfile.getnamespace().equals(StorageSystem.Discovery_Namespaces.UNMANAGED_FILESYSTEMS.toString()))) {
discoverUnmanagedObjects(accessProfile);
} else {
// Get the Vnxe storage system from the database.
viprStorageSystem = _dbClient.queryObject(StorageSystem.class, storageSystemURI);
_logger.info(String.format("Discover Vnxe storage system %s at IP:%s, PORT:%s", storageSystemURI.toString(), accessProfile.getIpAddress(), accessProfile.getPortNumber()));
// Get the vnxe service client for getting information about the
// Vnxe
// storage system.
VNXeApiClient client = getVnxeClient(accessProfile);
_logger.debug("Got handle to Vnxe service client");
// Get the serial number and the native guid and set
// into the storage system.
_logger.info("Discovering storage system properties.");
VNXeStorageSystem system = client.getStorageSystem();
boolean isFASTVPEnabled = false;
if (system != null) {
viprStorageSystem.setSerialNumber(system.getSerialNumber());
String guid = NativeGUIDGenerator.generateNativeGuid(viprStorageSystem);
viprStorageSystem.setNativeGuid(guid);
viprStorageSystem.setLabel(guid);
viprStorageSystem.setCompatibilityStatus(DiscoveredDataObject.CompatibilityStatus.COMPATIBLE.name());
viprStorageSystem.setReachableStatus(true);
isFASTVPEnabled = client.isFASTVPEnabled();
viprStorageSystem.setAutoTieringEnabled(isFASTVPEnabled);
StringSet supportedActions = new StringSet();
supportedActions.add(StorageSystem.AsyncActions.CreateElementReplica.name());
supportedActions.add(StorageSystem.AsyncActions.CreateGroupReplica.name());
viprStorageSystem.setSupportedAsynchronousActions(supportedActions);
StringSet supportedReplica = new StringSet();
supportedReplica.add(StorageSystem.SupportedReplicationTypes.LOCAL.name());
viprStorageSystem.setSupportedReplicationTypes(supportedReplica);
_dbClient.persistObject(viprStorageSystem);
_completer.statusPending(_dbClient, "Completed discovery of system properties");
} else {
_logger.error("Failed to retrieve VNXe system info!");
viprStorageSystem.setReachableStatus(false);
}
// get version for the storage system
BasicSystemInfo info = client.getBasicSystemInfo();
if (info != null) {
viprStorageSystem.setFirmwareVersion(info.getSoftwareVersion());
}
StringSet arraySupportedProtocols = new StringSet();
// Discover the NasServers
Map<String, URI> nasServerIdMap = new HashMap<String, URI>();
Map<String, List<StorageHADomain>> nasServers = discoverNasServers(viprStorageSystem, client, nasServerIdMap, arraySupportedProtocols);
_logger.info("No of newly discovered NasServers {}", nasServers.get(NEW).size());
_logger.info("No of existing discovered NasServers {}", nasServers.get(EXISTING).size());
if (!nasServers.get(NEW).isEmpty()) {
_dbClient.createObject(nasServers.get(NEW));
}
if (!nasServers.get(EXISTING).isEmpty()) {
_dbClient.persistObject(nasServers.get(EXISTING));
}
_completer.statusPending(_dbClient, "Completed NAS Server discovery");
// Discover FileInterfaces
List<StoragePort> allExistingPorts = new ArrayList<StoragePort>();
List<StoragePort> allNewPorts = new ArrayList<StoragePort>();
Map<String, List<StoragePort>> ports = discoverFileStoragePorts(viprStorageSystem, client, nasServerIdMap);
if (ports.get(NEW) != null && !ports.get(NEW).isEmpty()) {
allNewPorts.addAll(ports.get(NEW));
_dbClient.createObject(ports.get(NEW));
}
if (ports.get(EXISTING) != null && !ports.get(EXISTING).isEmpty()) {
allExistingPorts.addAll(ports.get(EXISTING));
_dbClient.persistObject(ports.get(EXISTING));
}
_completer.statusPending(_dbClient, "Completed file ports discovery");
// discover storage processors
Map<String, URI> spIdMap = new HashMap<String, URI>();
Map<String, List<StorageHADomain>> sps = discoverStorageProcessors(viprStorageSystem, client, spIdMap);
if (!sps.get(NEW).isEmpty()) {
_dbClient.createObject(sps.get(NEW));
}
if (!sps.get(EXISTING).isEmpty()) {
_dbClient.persistObject(sps.get(EXISTING));
}
_completer.statusPending(_dbClient, "Completed storage processor discovery");
// discover iscsi ports
Map<String, List<StoragePort>> iscsiPorts = discoverIscsiPorts(viprStorageSystem, client, spIdMap);
boolean hasIscsiPorts = false;
if (iscsiPorts.get(NEW) != null && !iscsiPorts.get(NEW).isEmpty()) {
allNewPorts.addAll(iscsiPorts.get(NEW));
hasIscsiPorts = true;
_dbClient.createObject(iscsiPorts.get(NEW));
}
if (iscsiPorts.get(EXISTING) != null && !iscsiPorts.get(EXISTING).isEmpty()) {
allExistingPorts.addAll(iscsiPorts.get(EXISTING));
hasIscsiPorts = true;
_dbClient.persistObject(ports.get(EXISTING));
}
if (hasIscsiPorts) {
arraySupportedProtocols.add(StorageProtocol.Block.iSCSI.name());
}
_completer.statusPending(_dbClient, "Completed iscsi ports discovery");
// discover fc ports
Map<String, List<StoragePort>> fcPorts = discoverFcPorts(viprStorageSystem, client, spIdMap);
boolean hasFcPorts = false;
if (fcPorts.get(NEW) != null && !fcPorts.get(NEW).isEmpty()) {
allNewPorts.addAll(fcPorts.get(NEW));
hasFcPorts = true;
_dbClient.createObject(fcPorts.get(NEW));
}
if (fcPorts.get(EXISTING) != null && !fcPorts.get(EXISTING).isEmpty()) {
allExistingPorts.addAll(fcPorts.get(EXISTING));
hasFcPorts = true;
_dbClient.persistObject(ports.get(EXISTING));
}
if (hasFcPorts) {
arraySupportedProtocols.add(StorageProtocol.Block.FC.name());
}
_completer.statusPending(_dbClient, "Completed FC ports discovery");
List<StoragePort> allPorts = new ArrayList<StoragePort>(allNewPorts);
allPorts.addAll(allExistingPorts);
// check if any port not visible in this discovery
List<StoragePort> notVisiblePorts = DiscoveryUtils.checkStoragePortsNotVisible(allPorts, _dbClient, viprStorageSystem.getId());
if (notVisiblePorts != null && !notVisiblePorts.isEmpty()) {
allExistingPorts.addAll(notVisiblePorts);
}
/**
* Discover the VNXe pool information.
*/
_logger.info("Discovering storage pools.");
List<StoragePool> poolsToMatchWithVpool = new ArrayList<StoragePool>();
List<StoragePool> allPools = new ArrayList<StoragePool>();
Map<String, List<StoragePool>> pools = discoverStoragePools(viprStorageSystem, client, arraySupportedProtocols, poolsToMatchWithVpool);
_logger.info("No of newly discovered pools {}", pools.get(NEW).size());
_logger.info("No of existing discovered pools {}", pools.get(EXISTING).size());
if (!pools.get(NEW).isEmpty()) {
allPools.addAll(pools.get(NEW));
_dbClient.createObject(pools.get(NEW));
StoragePoolAssociationHelper.setStoragePoolVarrays(viprStorageSystem.getId(), pools.get(NEW), _dbClient);
}
if (!pools.get(EXISTING).isEmpty()) {
allPools.addAll(pools.get(EXISTING));
_dbClient.persistObject(pools.get(EXISTING));
}
List<StoragePool> notVisiblePools = DiscoveryUtils.checkStoragePoolsNotVisible(allPools, _dbClient, viprStorageSystem.getId());
if (notVisiblePools != null && !notVisiblePools.isEmpty()) {
poolsToMatchWithVpool.addAll(notVisiblePools);
}
StoragePortAssociationHelper.runUpdatePortAssociationsProcess(allNewPorts, allExistingPorts, _dbClient, _coordinator, poolsToMatchWithVpool);
_completer.statusPending(_dbClient, "Completed pool discovery");
if (isFASTVPEnabled) {
_logger.info("FASTVP is enabled");
HashMap<String, List<AutoTieringPolicy>> policies = discoverAutoTierPolicies(viprStorageSystem, client);
if (!policies.get(NEW).isEmpty()) {
_dbClient.createObject(policies.get(NEW));
}
if (!policies.get(EXISTING).isEmpty()) {
_dbClient.persistObject(policies.get(EXISTING));
}
HashMap<String, List<StorageTier>> tiers = discoverStorageTier(viprStorageSystem, client);
if (!tiers.get(NEW).isEmpty()) {
_dbClient.createObject(tiers.get(NEW));
}
if (!tiers.get(EXISTING).isEmpty()) {
_dbClient.persistObject(tiers.get(EXISTING));
}
}
detailedStatusMessage = String.format("Discovery completed successfully for Storage System: %s", storageSystemURI.toString());
}
} catch (Exception e) {
detailedStatusMessage = String.format("Discovery failed for VNXe %s: %s", storageSystemURI.toString(), e.getLocalizedMessage());
_logger.error(detailedStatusMessage, e);
throw VNXeException.exceptions.discoveryError("Discovery error", e);
} finally {
if (viprStorageSystem != null) {
try {
// set detailed message
viprStorageSystem.setLastDiscoveryStatusMessage(detailedStatusMessage);
_dbClient.persistObject(viprStorageSystem);
} catch (DatabaseException ex) {
_logger.error("Error while persisting object to DB", ex);
}
}
}
}
use of com.emc.storageos.vnxe.VNXeException in project coprhd-controller by CoprHD.
the class VNXUnityFileStorageDeviceTest method testDiscoverUnity.
/**
* Tests Unity discovery
*
* @throws Exception
*/
@Test
public void testDiscoverUnity() {
try {
VNXeApiClient apiclient = _unity.getVnxUnityClient(_device);
VNXeStorageSystem storageSystem = apiclient.getStorageSystem();
Assert.assertTrue("Unity discovery failed " + storageSystem.getId(), true);
} catch (VNXeException uex) {
System.out.println("Unity discovery failed: " + uex.getCause());
}
}
use of com.emc.storageos.vnxe.VNXeException in project coprhd-controller by CoprHD.
the class VNXUnityFileStorageDeviceTest method testFileShareCreateNegative.
/**
* Tests that we rollback file share create in case when file share quota set fails.
*
* @throws Exception
*/
@Test
public void testFileShareCreateNegative() throws Exception {
FileShare fs = new FileShare();
fs.setId(URIUtil.createId(FileShare.class));
fs.setLabel("neTest");
// set negative capacity to force failure of quota creation
fs.setCapacity(-102400L);
FileDeviceInputOutput args = new FileDeviceInputOutput();
args.addStoragePool(_pool);
args.addFSFileObject(fs);
Assert.assertTrue("doCreateFS was expected to fail due to negative quota in the test.", _unity.doCreateFS(_device, args).getCommandStatus().equals(Operation.Status.error.name()));
// verify that doCreate() was rolled back
// check that file share does not exist
// try to get list of shares for directory which we tried to create
VNXeApiClient apiclient = _unity.getVnxUnityClient(_device);
try {
apiclient.getFileSystemByFSName(args.getFileObjMountPath());
Assert.assertTrue("File share create rollback failed, fs path: " + args.getFileObjMountPath(), true);
} catch (VNXeException uex) {
System.out.println("testFileShareCreateNegative --- rollback success: " + uex.getCause());
}
}
Aggregations