use of com.emc.storageos.volumecontroller.impl.hds.HDSCollectionException in project coprhd-controller by CoprHD.
the class HDSCommunicationInterface method discoverUnManagedVolumes.
/**
* Discover all UnManagedVolumes for a given storagesystem.
*
* @param accessProfile
*/
private void discoverUnManagedVolumes(AccessProfile accessProfile) {
StorageSystem storageSystem = null;
String detailedStatusMessage = null;
try {
storageSystem = _dbClient.queryObject(StorageSystem.class, accessProfile.getSystemId());
if (null == storageSystem) {
return;
}
volumeDiscoverer.discoverUnManagedVolumes(accessProfile, _dbClient, _coordinator, _partitionManager);
storageSystem.setDiscoveryStatus(DiscoveredDataObject.DataCollectionJobStatus.IN_PROGRESS.toString());
_dbClient.persistObject(storageSystem);
} catch (Exception e) {
if (storageSystem != null) {
cleanupDiscovery(storageSystem);
}
detailedStatusMessage = String.format("Discovery of unmanaged volumes failed for system %s because %s", storageSystem.getId().toString(), e.getLocalizedMessage());
_logger.error(detailedStatusMessage, e);
throw new HDSCollectionException(detailedStatusMessage);
} finally {
if (storageSystem != null) {
try {
// set detailed message
storageSystem.setLastDiscoveryStatusMessage(detailedStatusMessage);
_dbClient.persistObject(storageSystem);
} catch (Exception ex) {
_logger.error(String.format("Error while updating unmanaged volume discovery status for system %s", storageSystem.getId()), ex);
}
}
}
}
use of com.emc.storageos.volumecontroller.impl.hds.HDSCollectionException in project coprhd-controller by CoprHD.
the class HDSCommunicationInterface method discover.
@Override
public void discover(AccessProfile accessProfile) throws BaseCollectionException {
if ((null != accessProfile.getnamespace()) && (accessProfile.getnamespace().equals(StorageSystem.Discovery_Namespaces.UNMANAGED_VOLUMES.toString()))) {
discoverUnManagedVolumes(accessProfile);
} else {
_logger.info("Discovery started for system {}", accessProfile.getSystemId());
StorageSystem storageSystem = null;
String detailedStatusMessage = "Unknown Status";
try {
storageSystem = _dbClient.queryObject(StorageSystem.class, accessProfile.getSystemId());
HDSApiClient hdsApiClient = hdsApiFactory.getClient(HDSUtils.getHDSServerManagementServerInfo(accessProfile), accessProfile.getUserName(), accessProfile.getPassword());
// HDS+ARRAY.AMS200.73012495
Iterable<String> splitter = Splitter.on(HDSConstants.PLUS_OPERATOR).limit(2).split(storageSystem.getNativeGuid());
String objectID = Iterables.getLast(splitter);
StorageArray storageArray = hdsApiClient.getStorageSystemDetails(objectID);
if (null != storageArray) {
parseDiscoveryResponse(storageArray, accessProfile);
storageArray = hdsApiClient.getStorageSystemTieringPolicies(objectID);
parseDiscoveryTieringPolicyResponse(storageArray, accessProfile);
fetchStoragePoolTiers(storageSystem, objectID, accessProfile, hdsApiClient);
} else {
_logger.error("Discovery failed for system {} as not able to retrieve information from HiCommand DM");
throw new HDSCollectionException("Discovery failed for system as not able to retrieve information from HiCommand Device Manager.");
}
// discovery succeeds
detailedStatusMessage = String.format("Discovery completed successfully for HDS: %s", accessProfile.getSystemId());
} catch (Exception e) {
if (null != storageSystem) {
cleanupDiscovery(storageSystem);
}
detailedStatusMessage = String.format("Discovery failed for Storage System: %s because %s", storageSystem.toString(), e.getLocalizedMessage());
_logger.error(detailedStatusMessage, e);
throw new HDSCollectionException(detailedStatusMessage);
} finally {
try {
if (storageSystem != null) {
storageSystem.setLastDiscoveryStatusMessage(detailedStatusMessage);
_dbClient.persistObject(storageSystem);
}
} catch (Exception e) {
_logger.error(e.getMessage(), e);
}
}
_logger.info("Discovery Ended for system {}", accessProfile.getSystemId());
}
}
use of com.emc.storageos.volumecontroller.impl.hds.HDSCollectionException in project coprhd-controller by CoprHD.
the class HDSCommunicationInterface method scan.
@Override
public void scan(AccessProfile accessProfile) throws BaseCollectionException {
_logger.info("Scanning started for provider: {}", accessProfile.getSystemId());
StorageProvider provider = _dbClient.queryObject(StorageProvider.class, accessProfile.getSystemId());
boolean exceptionOccured = false;
try {
HDSApiClient hdsApiClient = hdsApiFactory.getClient(HDSUtils.getHDSServerManagementServerInfo(accessProfile), accessProfile.getUserName(), accessProfile.getPassword());
String apiVersion = hdsApiClient.getProviderAPIVersion();
_logger.info("Provider {} API Version:{}", provider.getLabel(), apiVersion);
provider.setVersionString(apiVersion);
String minimumSupportedVersion = ControllerUtils.getPropertyValueFromCoordinator(_coordinator, CONTROLLER_HICOMMAND_PROVIDER_VERSION);
if (VersionChecker.verifyVersionDetails(minimumSupportedVersion, apiVersion) < 0) {
provider.setCompatibilityStatus(DiscoveredDataObject.CompatibilityStatus.INCOMPATIBLE.name());
throw new HDSCollectionException(String.format(" ** The HiCommand Device Manager API version is not supported. Minimum supported version should be: %s", minimumSupportedVersion));
}
provider.setCompatibilityStatus(DiscoveredDataObject.CompatibilityStatus.COMPATIBLE.name());
List<StorageArray> storageArrayList = hdsApiClient.getStorageSystemsInfo();
if (null != storageArrayList && !storageArrayList.isEmpty()) {
_logger.debug("Received proper response from HiCommand server");
processScanResponse(storageArrayList, accessProfile);
} else {
_logger.info("No Systems found during scanning of provider: {}", provider.getId());
}
} catch (Exception ex) {
exceptionOccured = true;
_logger.error("Exception occurred while scanning provider {}", accessProfile.getSystemId(), ex);
throw HDSException.exceptions.scanFailed(ex);
} finally {
if (exceptionOccured) {
provider.setConnectionStatus(ConnectionStatus.NOTCONNECTED.name());
} else {
provider.setConnectionStatus(ConnectionStatus.CONNECTED.name());
}
_dbClient.persistObject(provider);
}
_logger.info("Scanning ended for provider: {}", accessProfile.getSystemId());
}
use of com.emc.storageos.volumecontroller.impl.hds.HDSCollectionException in project coprhd-controller by CoprHD.
the class HDSCommunicationInterface method collectStatisticsInformation.
@Override
public void collectStatisticsInformation(AccessProfile accessProfile) throws BaseCollectionException {
try {
_logger.info("Access Profile Details :" + accessProfile.toString());
wbemClient = getCIMClient(accessProfile);
initMap(accessProfile);
Namespace namespace = (Namespace) namespaces.getNsList().get(METERING);
_logger.info("HDS CIMClient initialized successfully");
executor.setKeyMap(_keyMap);
executor.execute(namespace);
dumpStatRecords();
injectStats();
// if portMetricsProcesor was injected with metering, trigger pool matcher
if (portMetricsProcessor != null) {
//
// compute port metric to trigger if any port allocation qualification changed. If there is
// changes, run vpool matcher
//
_logger.info("checking to see if Vpool Matcher needs to be run");
List<StoragePort> systemPorts = ControllerUtils.getSystemPortsOfSystem(_dbClient, accessProfile.getSystemId());
portMetricsProcessor.triggerVpoolMatcherIfPortAllocationQualificationChanged(accessProfile.getSystemId(), systemPorts);
//
// compute storage system's average of port metrics. Then, persist it into storage system object.
//
portMetricsProcessor.computeStorageSystemAvgPortMetrics(accessProfile.getSystemId());
}
} catch (Exception e) {
throw new HDSCollectionException(e.getMessage());
} finally {
releaseResources();
}
}
Aggregations