use of com.emc.storageos.plugins.BaseCollectionException in project coprhd-controller by CoprHD.
the class BlockDeviceController method scanProvider.
private boolean scanProvider(StorageProvider provider, StorageSystem storageSystem, boolean activeProvider, String opId) throws DatabaseException, BaseCollectionException, ControllerException {
Map<String, StorageSystemViewObject> storageCache = new HashMap<String, StorageSystemViewObject>();
_dbClient.createTaskOpStatus(StorageProvider.class, provider.getId(), opId, ResourceOperationTypeEnum.SCAN_SMISPROVIDER);
ScanTaskCompleter scanCompleter = new ScanTaskCompleter(StorageProvider.class, provider.getId(), opId);
try {
scanCompleter.statusPending(_dbClient, "Scan for storage system is Initiated");
provider.setLastScanStatusMessage("");
_dbClient.updateObject(provider);
ControllerServiceImpl.performScan(provider.getId(), scanCompleter, storageCache);
scanCompleter.statusReady(_dbClient, "Scan for storage system has completed");
} catch (Exception ex) {
_log.error("Scan failed for {}--->", provider, ex);
scanCompleter.statusError(_dbClient, DeviceControllerErrors.dataCollectionErrors.scanFailed(ex.getLocalizedMessage(), ex));
throw DeviceControllerException.exceptions.scanProviderFailed(storageSystem.getNativeGuid(), provider.getId().toString());
}
if (!storageCache.containsKey(storageSystem.getNativeGuid())) {
return false;
} else {
StorageSystemViewObject vo = storageCache.get(storageSystem.getNativeGuid());
String model = vo.getProperty(StorageSystemViewObject.MODEL);
if (StringUtils.isNotBlank(model)) {
storageSystem.setModel(model);
}
String serialNo = vo.getProperty(StorageSystemViewObject.SERIAL_NUMBER);
if (StringUtils.isNotBlank(serialNo)) {
storageSystem.setSerialNumber(serialNo);
}
String version = vo.getProperty(StorageSystemViewObject.VERSION);
if (StringUtils.isNotBlank(version)) {
storageSystem.setMajorVersion(version);
}
String name = vo.getProperty(StorageSystemViewObject.STORAGE_NAME);
if (StringUtils.isNotBlank(name)) {
storageSystem.setLabel(name);
}
provider.addStorageSystem(_dbClient, storageSystem, activeProvider);
return true;
}
}
use of com.emc.storageos.plugins.BaseCollectionException in project coprhd-controller by CoprHD.
the class FrontEndPortStatsProcessor method processResult.
@SuppressWarnings("unchecked")
@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException {
Iterator<CIMInstance> storagePortStatsResponseItr = (Iterator<CIMInstance>) resultObj;
AccessProfile profile = (AccessProfile) keyMap.get(Constants.ACCESSPROFILE);
URI systemId = profile.getSystemId();
DbClient dbClient = (DbClient) keyMap.get(Constants.dbClient);
logger.info("Processing FrontEnd Ports response");
try {
List<Stat> metricsObjList = (List<Stat>) keyMap.get(Constants._Stats);
while (storagePortStatsResponseItr.hasNext()) {
CIMInstance storagePortStatInstance = (CIMInstance) storagePortStatsResponseItr.next();
Stat fePortStat = new Stat();
fePortStat.setServiceType(Constants._Block);
fePortStat.setTimeCollected((Long) keyMap.get(Constants._TimeCollected));
Long providerCollectionTime = convertCIMStatisticTime(getCIMPropertyValue(storagePortStatInstance, STATISTICTIME));
if (0 != providerCollectionTime) {
fePortStat.setTimeInMillis(providerCollectionTime);
} else {
fePortStat.setTimeInMillis((Long) keyMap.get(Constants._TimeCollected));
}
fePortStat.setTotalIOs(ControllerUtils.getModLongValue(getCIMPropertyValue(storagePortStatInstance, TOTALIOS)));
fePortStat.setKbytesTransferred(ControllerUtils.getModLongValue(getCIMPropertyValue(storagePortStatInstance, KBYTESTRANSFERRED)));
setPortRelatedInfo(storagePortStatInstance, systemId, dbClient, fePortStat);
metricsObjList.add(fePortStat);
}
} catch (Exception ex) {
logger.error("Failed while extracting Stats for Front end ports: ", ex);
} finally {
resultObj = null;
}
logger.info("Processing FrontEnd Ports response completed");
}
use of com.emc.storageos.plugins.BaseCollectionException in project coprhd-controller by CoprHD.
the class VPlexCommunicationInterface method discoverUnmanagedStorageViews.
/**
* Discovers storage views on the VPLEX and creates UnManagedExportMasks for any
* that are not managed by ViPR.
*
* @param accessProfile providing context for this discovery session
* @param client a reference to the VPLEX API client
* @param vvolMap map of virtual volume names to virtual volume info objects
* @param volumeToExportMasksMap map of volumes to a set of associated UnManagedExportMasks
* @param volumeToStorageViewMap map of volumes to a set of associated VPlexStorageViewInfos
* @param recoverpointExportMasks recoverpoint export mask uris
* @throws BaseCollectionException
*/
private void discoverUnmanagedStorageViews(AccessProfile accessProfile, VPlexApiClient client, Map<String, VPlexVirtualVolumeInfo> vvolMap, Map<String, Set<UnManagedExportMask>> volumeToExportMasksMap, Map<String, Set<VPlexStorageViewInfo>> volumeToStorageViewMap, Set<String> recoverPointExportMasks) throws BaseCollectionException {
String statusMessage = "Starting discovery of Unmanaged VPLEX Storage Views.";
s_logger.info(statusMessage + " Access Profile Details : IpAddress : " + "PortNumber : {}, namespace : {}", accessProfile.getIpAddress() + accessProfile.getPortNumber(), accessProfile.getnamespace());
URI vplexUri = accessProfile.getSystemId();
StorageSystem vplex = _dbClient.queryObject(StorageSystem.class, vplexUri);
if (null == vplex) {
s_logger.error("No VPLEX Device was found in ViPR for URI: " + vplexUri);
s_logger.error("Unmanaged VPLEX StorageView discovery cannot continue.");
return;
}
try {
// this is a map of cluster id (1 or 2) to the actual cluster name
Map<String, String> clusterIdToNameMap = client.getClusterIdToNameMap();
// this is a map of the cluster names to a map of its target port names to wwpns
Map<String, Map<String, String>> clusterPortMap = new HashMap<String, Map<String, String>>();
for (String clusterName : clusterIdToNameMap.values()) {
Map<String, String> targetPortToPwwnMap = VPlexControllerUtils.getTargetPortToPwwnMap(client, clusterName);
clusterPortMap.put(clusterName, targetPortToPwwnMap);
}
Set<URI> allCurrentUnManagedExportMaskUris = new HashSet<URI>();
List<UnManagedExportMask> unManagedExportMasksToCreate = new ArrayList<UnManagedExportMask>();
List<UnManagedExportMask> unManagedExportMasksToUpdate = new ArrayList<UnManagedExportMask>();
Set<URI> rpPortInitiators = RPHelper.getBackendPortInitiators(_dbClient);
for (String clusterName : clusterIdToNameMap.values()) {
List<VPlexStorageViewInfo> storageViews = client.getStorageViewsForCluster(clusterName);
for (VPlexStorageViewInfo storageView : storageViews) {
s_logger.info("discovering storage view: " + storageView.toString());
List<Initiator> knownInitiators = new ArrayList<Initiator>();
List<StoragePort> knownPorts = new ArrayList<StoragePort>();
UnManagedExportMask uem = getUnManagedExportMaskFromDb(storageView);
if (uem != null) {
s_logger.info("found an existing unmanaged export mask for storage view " + storageView.getName());
unManagedExportMasksToUpdate.add(uem);
// clean up collections (we'll be refreshing them)
uem.getKnownInitiatorUris().clear();
uem.getKnownInitiatorNetworkIds().clear();
uem.getKnownStoragePortUris().clear();
uem.getKnownVolumeUris().clear();
uem.getUnmanagedInitiatorNetworkIds().clear();
uem.getUnmanagedStoragePortNetworkIds().clear();
uem.getUnmanagedVolumeUris().clear();
} else {
s_logger.info("creating a new unmanaged export mask for storage view " + storageView.getName());
uem = new UnManagedExportMask();
unManagedExportMasksToCreate.add(uem);
}
// set basic info
uem.setNativeId(storageView.getPath());
uem.setMaskingViewPath(storageView.getPath());
uem.setMaskName(storageView.getName());
uem.setStorageSystemUri(accessProfile.getSystemId());
s_logger.info("now discovering host initiators in storage view " + storageView.getName());
for (String initiatorNetworkId : storageView.getInitiatorPwwns()) {
s_logger.info("looking at initiator network id " + initiatorNetworkId);
if (initiatorNetworkId != null && initiatorNetworkId.matches(ISCSI_PATTERN) && (iSCSIUtility.isValidIQNPortName(initiatorNetworkId) || iSCSIUtility.isValidEUIPortName(initiatorNetworkId))) {
s_logger.info("\tiSCSI network id normalized to " + initiatorNetworkId);
} else if (initiatorNetworkId != null && initiatorNetworkId.matches(REGISTERED_PATTERN)) {
initiatorNetworkId = initiatorNetworkId.substring(REGISTERED_PORT_PREFIX.length());
initiatorNetworkId = WWNUtility.getWWNWithColons(initiatorNetworkId);
s_logger.info("\tRegistered network id normalized to " + initiatorNetworkId);
} else if (WWNUtility.isValidWWNAlias(initiatorNetworkId)) {
initiatorNetworkId = WWNUtility.getWWNWithColons(initiatorNetworkId);
s_logger.info("\twwn normalized to " + initiatorNetworkId);
} else {
s_logger.warn("\tthis is not a valid network id format, skipping");
continue;
}
// check if a host initiator exists for this id
// if so, add to _knownInitiators
// otherwise, add to _unmanagedInitiators
Initiator knownInitiator = NetworkUtil.getInitiator(initiatorNetworkId, _dbClient);
if (knownInitiator != null) {
s_logger.info(" found an initiator in ViPR on host " + knownInitiator.getHostName());
uem.getKnownInitiatorUris().add(knownInitiator.getId().toString());
uem.getKnownInitiatorNetworkIds().add(knownInitiator.getInitiatorPort());
knownInitiators.add(knownInitiator);
} else {
s_logger.info(" no hosts in ViPR found configured for initiator " + initiatorNetworkId);
uem.getUnmanagedInitiatorNetworkIds().add(initiatorNetworkId);
}
}
s_logger.info("now discovering storage ports in storage view " + storageView.getName());
List<String> targetPortNames = storageView.getPorts();
if (targetPortNames.isEmpty()) {
s_logger.info("no storage ports found in storage view " + storageView.getName());
// continue; ?
}
// target port has value like - P0000000046E01E80-A0-FC02
// PortWwn has value like - 0x50001442601e8002
List<String> portWwns = new ArrayList<String>();
for (String targetPortName : targetPortNames) {
Map<String, String> portToWwpnMap = clusterPortMap.get(clusterName);
if (portToWwpnMap.keySet().contains(targetPortName)) {
portWwns.add(WwnUtils.convertWWN(portToWwpnMap.get(targetPortName), WwnUtils.FORMAT.COLON));
}
}
for (String portNetworkId : portWwns) {
s_logger.info("looking at storage port network id " + portNetworkId);
// check if a storage port exists for this id in ViPR
// if so, add to _storagePorts
StoragePort knownStoragePort = NetworkUtil.getStoragePort(portNetworkId, _dbClient);
if (knownStoragePort != null) {
s_logger.info(" found a matching storage port in ViPR " + knownStoragePort.getLabel());
uem.getKnownStoragePortUris().add(knownStoragePort.getId().toString());
knownPorts.add(knownStoragePort);
} else {
s_logger.info(" no storage port in ViPR found matching portNetworkId " + portNetworkId);
uem.getUnmanagedStoragePortNetworkIds().add(portNetworkId);
}
}
s_logger.info("now discovering storage volumes in storage view " + storageView.getName());
for (String volumeNameStr : storageView.getVirtualVolumes()) {
s_logger.info("found volume " + volumeNameStr);
// volumeNameStr contains value like
// (161,dd_V000195701573-00D57_VAPM00140801303-00614_vol,VPD83T3:6000144000000010f07dc46a0717e61d,2G)
String[] tokens = volumeNameStr.split(",");
String volumeName = tokens[1];
VPlexVirtualVolumeInfo vvol = vvolMap.get(volumeName);
Volume volume = findVirtualVolumeManagedByVipr(vvol);
if (volume != null) {
s_logger.info("this is a volume already managed by ViPR: " + volume.getLabel());
uem.getKnownVolumeUris().add(volume.getId().toString());
}
// add to map of volume paths to export masks
if (vvol != null) {
String nativeGuid = vvol.getPath();
s_logger.info("nativeGuid UnManagedVolume key for locating UnManagedExportMasks is " + nativeGuid);
Set<UnManagedExportMask> maskSet = volumeToExportMasksMap.get(nativeGuid);
if (maskSet == null) {
maskSet = new HashSet<UnManagedExportMask>();
s_logger.info(" creating new maskSet for nativeGuid " + nativeGuid);
volumeToExportMasksMap.put(nativeGuid, maskSet);
}
maskSet.add(uem);
}
// add this storage view to the volume to storage view map for this volume
Set<VPlexStorageViewInfo> storageViewSet = volumeToStorageViewMap.get(volumeName);
if (storageViewSet == null) {
storageViewSet = new HashSet<VPlexStorageViewInfo>();
}
storageViewSet.add(storageView);
volumeToStorageViewMap.put(volumeName, storageViewSet);
}
if (uem.getId() == null) {
uem.setId(URIUtil.createId(UnManagedExportMask.class));
}
if (checkRecoverPointExportMask(uem, knownInitiators, rpPortInitiators)) {
recoverPointExportMasks.add(uem.getId().toString());
}
updateZoningMap(uem, knownInitiators, knownPorts);
persistUnManagedExportMasks(unManagedExportMasksToCreate, unManagedExportMasksToUpdate, false);
allCurrentUnManagedExportMaskUris.add(uem.getId());
}
}
persistUnManagedExportMasks(unManagedExportMasksToCreate, unManagedExportMasksToUpdate, true);
cleanUpOrphanedExportMasks(vplexUri, allCurrentUnManagedExportMaskUris);
} catch (Exception ex) {
s_logger.error(ex.getLocalizedMessage(), ex);
String vplexLabel = vplexUri.toString();
if (null != vplex) {
vplexLabel = vplex.getLabel();
}
throw VPlexCollectionException.exceptions.vplexUnmanagedExportMaskDiscoveryFailed(vplexLabel, ex.getLocalizedMessage());
} finally {
if (null != vplex) {
try {
vplex.setLastDiscoveryStatusMessage(statusMessage);
_dbClient.updateObject(vplex);
} catch (Exception ex) {
s_logger.error("Error while saving VPLEX discovery status message: {} - Exception: {}", statusMessage, ex.getLocalizedMessage());
}
}
}
}
use of com.emc.storageos.plugins.BaseCollectionException in project coprhd-controller by CoprHD.
the class VPlexCommunicationInterface method discoverUnmanagedVolumes.
/**
* Implementation for discovering unmanaged virtual volumes in a VPLEX storage system.
*
* @param accessProfile providing context for this discovery session
* @param client a reference to the VPLEX API client
* @param vvolMap map of virtual volume names to virtual volume info objects
* @param volumeToExportMasksMap map of volumes to a set of associated UnManagedExportMasks
* @param volumeToStorageViewMap map of volumes to a set of associated VPlexStorageViewInfos
* @param recoverpointExportMasks recoverpoint export mask uris
* @param tracker the performance report tracking object for this discovery process
* @throws BaseCollectionException
*/
private void discoverUnmanagedVolumes(AccessProfile accessProfile, VPlexApiClient client, Map<String, VPlexVirtualVolumeInfo> allVirtualVolumes, Map<String, Set<UnManagedExportMask>> volumeToExportMasksMap, Map<String, Set<VPlexStorageViewInfo>> volumeToStorageViewMap, Set<String> recoverPointExportMasks, UnmanagedDiscoveryPerformanceTracker tracker) throws BaseCollectionException {
String statusMessage = "Starting discovery of Unmanaged VPLEX Volumes.";
s_logger.info(statusMessage + " Access Profile Details : IpAddress : " + "PortNumber : {}, namespace : {}", accessProfile.getIpAddress() + accessProfile.getPortNumber(), accessProfile.getnamespace());
URI vplexUri = accessProfile.getSystemId();
StorageSystem vplex = _dbClient.queryObject(StorageSystem.class, vplexUri);
if (null == vplex) {
s_logger.error("No VPLEX Device was found in ViPR for URI: " + vplexUri);
s_logger.error("Unmanaged VPLEX Volume discovery cannot continue.");
return;
}
Set<URI> allUnmanagedVolumes = new HashSet<URI>();
List<UnManagedVolume> newUnmanagedVolumes = new ArrayList<UnManagedVolume>();
List<UnManagedVolume> knownUnmanagedVolumes = new ArrayList<UnManagedVolume>();
List<UnManagedExportMask> unmanagedExportMasksToUpdate = new ArrayList<UnManagedExportMask>();
Map<String, String> backendVolumeGuidToVvolGuidMap = new HashMap<String, String>();
try {
long timer = System.currentTimeMillis();
Map<String, String> volumesToCgs = new HashMap<String, String>();
List<VPlexConsistencyGroupInfo> cgs = client.getConsistencyGroups();
s_logger.info("Found {} Consistency Groups.", cgs.size());
for (VPlexConsistencyGroupInfo cg : cgs) {
for (String volumeName : cg.getVirtualVolumes()) {
volumesToCgs.put(volumeName, cg.getName());
}
}
s_logger.info("Volume to Consistency Group Map is: " + volumesToCgs.toString());
tracker.consistencyGroupFetch = System.currentTimeMillis() - timer;
Map<String, String> clusterIdToNameMap = client.getClusterIdToNameMap();
Map<String, String> varrayToClusterIdMap = new HashMap<String, String>();
Map<String, String> distributedDevicePathToClusterMap = VPlexControllerUtils.getDistributedDevicePathToClusterMap(vplexUri, _dbClient);
if (null != allVirtualVolumes) {
// Pre-populate the virtual pools
List<URI> allVpoolUris = _dbClient.queryByType(VirtualPool.class, true);
Iterator<VirtualPool> vpoolIter = _dbClient.queryIterativeObjects(VirtualPool.class, allVpoolUris);
List<VirtualPool> allVpools = new ArrayList<VirtualPool>();
while (vpoolIter.hasNext()) {
VirtualPool vpool = vpoolIter.next();
// Only cache vplex virtual pools for vpool filtering
if (VirtualPool.vPoolSpecifiesHighAvailability(vpool)) {
allVpools.add(vpool);
}
}
for (String name : allVirtualVolumes.keySet()) {
timer = System.currentTimeMillis();
s_logger.info("Discovering Virtual Volume {}", name);
// UnManagedVolume discover does a pretty expensive
// iterative call into the VPLEX API to get extended details
String discoveryKillSwitch = ControllerUtils.getPropertyValueFromCoordinator(_coordinator, VplexBackendIngestionContext.DISCOVERY_KILL_SWITCH);
if ("stop".equals(discoveryKillSwitch)) {
s_logger.warn("discovery kill switch was set to stop, " + "so discontinuing unmanaged volume discovery");
return;
}
// on every volume in each cluster. First it gets all the
// volume names/paths (the inexpensive "lite" call), then
// iterates through them getting the details to populate the
String discoveryFilter = ControllerUtils.getPropertyValueFromCoordinator(_coordinator, VplexBackendIngestionContext.DISCOVERY_FILTER);
if ((discoveryFilter != null && !discoveryFilter.isEmpty()) && !(name.matches(discoveryFilter))) {
s_logger.warn("name {} doesn't match discovery filter {}", name, discoveryFilter);
continue;
}
// VPlexVirtualVolumeInfo objects with extended details
VPlexVirtualVolumeInfo info = allVirtualVolumes.get(name);
// to here null, it would mean a 404 happened earlier.
if (null == info) {
continue;
}
Volume managedVolume = findVirtualVolumeManagedByVipr(info);
UnManagedVolume unmanagedVolume = findUnmanagedVolumeKnownToVipr(info);
if (null == managedVolume) {
s_logger.info("Virtual Volume {} is not managed by ViPR", name);
if (null != unmanagedVolume) {
// just refresh / update the existing unmanaged volume
s_logger.info("Unmanaged Volume {} is already known to ViPR", name);
updateUnmanagedVolume(info, vplex, unmanagedVolume, volumesToCgs, clusterIdToNameMap, varrayToClusterIdMap, distributedDevicePathToClusterMap, backendVolumeGuidToVvolGuidMap, volumeToStorageViewMap, allVpools);
knownUnmanagedVolumes.add(unmanagedVolume);
} else {
// set up new unmanaged vplex volume
s_logger.info("Unmanaged Volume {} is not known to ViPR", name);
unmanagedVolume = createUnmanagedVolume(info, vplex, volumesToCgs, clusterIdToNameMap, varrayToClusterIdMap, distributedDevicePathToClusterMap, backendVolumeGuidToVvolGuidMap, volumeToStorageViewMap, allVpools);
newUnmanagedVolumes.add(unmanagedVolume);
}
boolean nonRpExported = false;
Set<UnManagedExportMask> uems = volumeToExportMasksMap.get(unmanagedVolume.getNativeGuid());
if (uems != null) {
s_logger.info("{} UnManagedExportMasks found in the map for volume {}", uems.size(), unmanagedVolume.getNativeGuid());
for (UnManagedExportMask uem : uems) {
s_logger.info(" adding UnManagedExportMask {} to UnManagedVolume", uem.getMaskingViewPath());
unmanagedVolume.getUnmanagedExportMasks().add(uem.getId().toString());
uem.getUnmanagedVolumeUris().add(unmanagedVolume.getId().toString());
unmanagedExportMasksToUpdate.add(uem);
// add the known initiators, too
for (String initUri : uem.getKnownInitiatorUris()) {
s_logger.info(" adding known Initiator URI {} to UnManagedVolume", initUri);
unmanagedVolume.getInitiatorUris().add(initUri);
Initiator init = _dbClient.queryObject(Initiator.class, URI.create(initUri));
unmanagedVolume.getInitiatorNetworkIds().add(init.getInitiatorPort());
}
// log this info for debugging
for (String path : uem.getUnmanagedInitiatorNetworkIds()) {
s_logger.info(" UnManagedExportMask has this initiator unknown to ViPR: {}", path);
}
// volume if it is
if (!recoverPointExportMasks.isEmpty() && recoverPointExportMasks.contains(uem.getId().toString())) {
s_logger.info("unmanaged volume {} is an RP volume", unmanagedVolume.getLabel());
unmanagedVolume.putVolumeCharacterstics(SupportedVolumeCharacterstics.IS_RECOVERPOINT_ENABLED.toString(), TRUE);
} else {
// this volume is contained in at least one export mask that is non-RP
nonRpExported = true;
}
}
}
persistUnManagedExportMasks(null, unmanagedExportMasksToUpdate, false);
// this as a convenience to ingest features.
if (nonRpExported) {
s_logger.info("unmanaged volume {} is exported to something other than RP. Marking IS_NONRP_EXPORTED.", unmanagedVolume.getLabel());
unmanagedVolume.putVolumeCharacterstics(SupportedVolumeCharacterstics.IS_NONRP_EXPORTED.toString(), TRUE);
unmanagedVolume.putVolumeCharacterstics(SupportedVolumeCharacterstics.IS_VOLUME_EXPORTED.toString(), TRUE);
} else {
s_logger.info("unmanaged volume {} is not exported OR not exported to something other than RP. Not marking IS_NONRP_EXPORTED.", unmanagedVolume.getLabel());
unmanagedVolume.putVolumeCharacterstics(SupportedVolumeCharacterstics.IS_NONRP_EXPORTED.toString(), FALSE);
unmanagedVolume.putVolumeCharacterstics(SupportedVolumeCharacterstics.IS_VOLUME_EXPORTED.toString(), FALSE);
}
persistUnManagedVolumes(newUnmanagedVolumes, knownUnmanagedVolumes, false);
} else {
s_logger.info("Virtual Volume {} is already managed by ViPR", managedVolume.forDisplay());
Long currentCapacity = info.getCapacityBytes();
if (currentCapacity != null && currentCapacity > managedVolume.getCapacity()) {
// update the managed volume's capacity if it changed. this could possibly happen
// if the volume were expanded and the final status was not processed successfully by ViPR due to timeout
s_logger.info("Virtual Volume {} capacity on VPLEX is different ({}) than in database ({}), updating...", managedVolume.forDisplay(), info.getCapacityBytes(), managedVolume.getCapacity());
managedVolume.setAllocatedCapacity(Long.parseLong(String.valueOf(0)));
managedVolume.setProvisionedCapacity(currentCapacity);
managedVolume.setCapacity(currentCapacity);
_dbClient.updateObject(managedVolume);
}
}
if (null != unmanagedVolume && !unmanagedVolume.getInactive()) {
allUnmanagedVolumes.add(unmanagedVolume.getId());
}
tracker.volumeTimeResults.put(name, System.currentTimeMillis() - timer);
tracker.totalVolumesDiscovered++;
s_logger.info("estimated discovery time remaining: " + tracker.getDiscoveryTimeRemaining());
}
} else {
s_logger.warn("No virtual volumes were found on VPLEX.");
}
persistUnManagedVolumes(newUnmanagedVolumes, knownUnmanagedVolumes, true);
persistUnManagedExportMasks(null, unmanagedExportMasksToUpdate, true);
cleanUpOrphanedVolumes(vplex.getId(), allUnmanagedVolumes);
// this has to happen at the very end so that the map is complete,
// and by supplying the vplex id, we'll re-fetch all the volumes
// now that everything has been persisted and orphans cleared out
processBackendClones(vplex.getId(), backendVolumeGuidToVvolGuidMap);
} catch (Exception ex) {
s_logger.error("An error occurred during VPLEX unmanaged volume discovery", ex);
String vplexLabel = vplexUri.toString();
if (null != vplex) {
vplexLabel = vplex.getLabel();
}
throw VPlexCollectionException.exceptions.vplexUnmanagedVolumeDiscoveryFailed(vplexLabel, ex.toString());
} finally {
if (null != vplex) {
try {
vplex.setLastDiscoveryStatusMessage(statusMessage);
_dbClient.updateObject(vplex);
} catch (Exception ex) {
s_logger.error("Error while saving VPLEX discovery status message: {} - Exception: {}", statusMessage, ex.getLocalizedMessage());
}
}
}
}
use of com.emc.storageos.plugins.BaseCollectionException in project coprhd-controller by CoprHD.
the class XIVCommunicationInterface method scan.
/**
* {@inheritDoc}
*/
@Override
public void scan(AccessProfile accessProfile) throws BaseCollectionException {
// Call scan method of SMICommunication interface to validate SMIS connectivity
super.scan(accessProfile);
URI providerURI = null;
StorageProvider providerObj = null;
String detailedStatusMessage = "Unknown Status";
try {
providerURI = accessProfile.getSystemId();
providerObj = _dbClient.queryObject(StorageProvider.class, providerURI);
// Validate Secondary URL for its availability
validateManagementURL(providerObj.getSecondaryURL(), providerObj.getSecondaryUsername(), providerObj.getSecondaryPassword());
// scan succeeds
detailedStatusMessage = String.format("Scan job completed successfully for REST API: %s", providerObj.getSecondaryURL());
} catch (Exception e) {
detailedStatusMessage = String.format("Scan job failed for REST API: %s because %s", providerObj.getSecondaryURL(), e.getMessage());
throw new SMIPluginException(detailedStatusMessage);
} finally {
if (providerObj != null) {
try {
// set detailed message
providerObj.setLastScanStatusMessage(detailedStatusMessage);
_dbClient.updateObject(providerObj);
} catch (DatabaseException ex) {
_logger.error("Error while persisting object to DB", ex);
}
}
}
}
Aggregations