use of com.emc.storageos.vnxe.models.BasicSystemInfo in project coprhd-controller by CoprHD.
the class VNXUnityCommunicationInterface method discoverStorageSystemInfo.
private StorageSystem discoverStorageSystemInfo(VNXeApiClient client, AccessProfile accessProfile, VNXeStorageSystem system, Boolean isFASTVPEnabled, StorageSystem viprStorageSystem) {
if (system != null) {
viprStorageSystem.setSerialNumber(system.getSerialNumber());
String guid = NativeGUIDGenerator.generateNativeGuid(viprStorageSystem);
viprStorageSystem.setNativeGuid(guid);
viprStorageSystem.setCompatibilityStatus(DiscoveredDataObject.CompatibilityStatus.COMPATIBLE.name());
viprStorageSystem.setReachableStatus(true);
viprStorageSystem.setAutoTieringEnabled(isFASTVPEnabled);
viprStorageSystem.setModel(system.getModel());
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);
viprStorageSystem.setSupportSoftLimit(true);
viprStorageSystem.setIpAddress(accessProfile.getIpAddress());
viprStorageSystem.setUsername(accessProfile.getUserName());
viprStorageSystem.setPortNumber(accessProfile.getPortNumber());
viprStorageSystem.setPassword(accessProfile.getPassword());
_completer.statusPending(_dbClient, "Completed discovery of system properties");
} else {
_logger.error("Failed to retrieve VNX Unity system info!");
viprStorageSystem.setReachableStatus(false);
}
// get version for the storage system
BasicSystemInfo info = client.getBasicSystemInfo();
if (info != null) {
viprStorageSystem.setFirmwareVersion(info.getSoftwareVersion());
}
_dbClient.updateObject(viprStorageSystem);
return viprStorageSystem;
}
use of com.emc.storageos.vnxe.models.BasicSystemInfo in project coprhd-controller by CoprHD.
the class ApiClientTest method getBasicSystemInfo.
// @Test
public void getBasicSystemInfo() {
BasicSystemInfo info = apiClient.getBasicSystemInfo();
System.out.println(info.getSoftwareVersion());
}
use of com.emc.storageos.vnxe.models.BasicSystemInfo in project coprhd-controller by CoprHD.
the class VNXUnityCommunicationInterface method scan.
/**
* Implementation for scan for Vnx Unity storage systems.
*
* @param accessProfile
*
* @throws BaseCollectionException
*/
@Override
public void scan(AccessProfile accessProfile) throws BaseCollectionException {
_logger.info("Starting scan of Unity StorageProvider. IP={}", accessProfile.getIpAddress());
StorageProvider.ConnectionStatus cxnStatus = StorageProvider.ConnectionStatus.CONNECTED;
StorageProvider provider = _dbClient.queryObject(StorageProvider.class, accessProfile.getSystemId());
_locker.acquireLock(accessProfile.getIpAddress(), LOCK_WAIT_SECONDS);
try {
VNXeApiClient apiClient = getVnxUnityClient(accessProfile);
if (apiClient != null) {
Map<String, StorageSystemViewObject> storageSystemsCache = accessProfile.getCache();
BasicSystemInfo unitySystem = apiClient.getBasicSystemInfo();
String unityType = StorageSystem.Type.unity.name();
String version = unitySystem.getApiVersion();
String compatibility = StorageSystem.CompatibilityStatus.COMPATIBLE.name();
provider.setCompatibilityStatus(compatibility);
provider.setVersionString(version);
VNXeStorageSystem system = apiClient.getStorageSystem();
_logger.info("Found Unity: {} ", system.getSerialNumber());
String id = system.getSerialNumber();
String nativeGuid = generateNativeGuid(unityType, id);
StorageSystemViewObject viewObject = storageSystemsCache.get(nativeGuid);
if (viewObject == null) {
viewObject = new StorageSystemViewObject();
}
viewObject.setDeviceType(unityType);
viewObject.addprovider(accessProfile.getSystemId().toString());
viewObject.setProperty(StorageSystemViewObject.MODEL, unitySystem.getModel());
viewObject.setProperty(StorageSystemViewObject.SERIAL_NUMBER, id);
storageSystemsCache.put(nativeGuid, viewObject);
}
} catch (Exception e) {
cxnStatus = StorageProvider.ConnectionStatus.NOTCONNECTED;
_logger.error(String.format("Exception was encountered when attempting to scan Unity Instance %s", accessProfile.getIpAddress()), e);
throw VNXeException.exceptions.scanFailed(accessProfile.getIpAddress(), e);
} finally {
provider.setConnectionStatus(cxnStatus.name());
_dbClient.updateObject(provider);
_logger.info("Completed scan of Unity StorageProvider. IP={}", accessProfile.getIpAddress());
_locker.releaseLock(accessProfile.getIpAddress());
}
}
use of com.emc.storageos.vnxe.models.BasicSystemInfo 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.models.BasicSystemInfo in project coprhd-controller by CoprHD.
the class VNXUnityCommunicationInterface method getMaxDbMetrics.
/**
* get the Max limits for static db metrics
*
* @param system
* @return dbMetrics
*/
private StringMap getMaxDbMetrics(final VNXeApiClient client) {
StringMap dbMetrics = new StringMap();
// Set the Limit Metric keys
// default values
Long MaxTotalExports = MAX_EXPORTS;
long MaxCapacityInTB = MAX_CAPACITY_TB;
Long MaxStorObjects = MAX_STORAGE_OBJECTS;
BasicSystemInfo unitySystem = client.getBasicSystemInfo();
String model = unitySystem.getModel();
if (model.equals(UNITY_300)) {
MaxTotalExports = MAX_EXPORTS_UNITY300;
MaxCapacityInTB = MAX_CAPACITY_UNITY300_TB;
MaxStorObjects = MAX_STORAGE_OBJECTS_UNITY300;
} else if (model.equals(UNITY_400)) {
MaxTotalExports = MAX_EXPORTS_UNITY400;
MaxCapacityInTB = MAX_CAPACITY_UNITY400_TB;
MaxStorObjects = MAX_STORAGE_OBJECTS_UNITY400;
} else if (model.equals(UNITY_500)) {
MaxTotalExports = MAX_EXPORTS_UNITY500;
MaxCapacityInTB = MAX_CAPACITY_UNITY500_TB;
MaxStorObjects = MAX_STORAGE_OBJECTS_UNITY500;
} else if (model.equals(UNITY_600)) {
MaxTotalExports = MAX_EXPORTS_UNITY600;
MaxCapacityInTB = MAX_CAPACITY_UNITY600_TB;
MaxStorObjects = MAX_STORAGE_OBJECTS_UNITY600;
} else if (model.equals(UNITY_VSA)) {
MaxTotalExports = MAX_EXPORTS_UNITYVSA;
MaxCapacityInTB = MAX_CAPACITY_UNITYVSA_TB;
MaxStorObjects = MAX_STORAGE_OBJECTS_UNITYVSA;
} else {
_logger.info("Cannot determine Max nas server limits for Unity model: {}. Using defaults", model);
}
dbMetrics.put(MetricsKeys.maxExports.name(), String.valueOf(MaxTotalExports));
dbMetrics.put(MetricsKeys.maxStorageObjects.name(), String.valueOf(MaxStorObjects));
// set the max capacity in KB
dbMetrics.put(MetricsKeys.maxStorageCapacity.name(), String.valueOf(MaxCapacityInTB * TB_IN_GB * GB_IN_KB));
return dbMetrics;
}
Aggregations