use of javax.cim.CIMObjectPath in project coprhd-controller by CoprHD.
the class SRDFStorageSyncProcessor method processStorageSynchronizedPaths.
private void processStorageSynchronizedPaths(Operation operation, Iterator<CIMObjectPath> it, Object resultObj, Map<String, Object> keyMap) {
while (it.hasNext()) {
try {
DbClient dbClient = (DbClient) keyMap.get(Constants.dbClient);
CIMObjectPath volumePath = it.next();
CIMObjectPath sourcePath = (CIMObjectPath) volumePath.getKey(Constants._SystemElement).getValue();
CIMObjectPath destPath = (CIMObjectPath) volumePath.getKey(Constants._SyncedElement).getValue();
CIMProperty<?> prop = sourcePath.getKey(Constants._SystemName);
String[] serialNumber_split = prop.getValue().toString().split(Constants.PATH_DELIMITER_REGEX);
if (serialNumber_split[1].equalsIgnoreCase((String) keyMap.get(Constants._serialID))) {
// If mirror
String sourceVolumeNativeGuid = getVolumeNativeGuid(sourcePath);
Volume sourceVolume = checkStorageVolumeExistsInDB(sourceVolumeNativeGuid, dbClient);
if (null == sourceVolume || !isSRDFProtectedVolume(sourceVolume)) {
continue;
}
String targetVolumeNativeGuid = getVolumeNativeGuid(destPath);
Volume targetVolume = checkStorageVolumeExistsInDB(targetVolumeNativeGuid, dbClient);
if (null == targetVolume || !isSRDFProtectedVolume(targetVolume)) {
continue;
}
if (PersonalityTypes.SOURCE.toString().equalsIgnoreCase(sourceVolume.getPersonality())) {
if (null == sourceVolume.getSrdfTargets() || !sourceVolume.getSrdfTargets().contains(targetVolume.getId().toString())) {
_log.info("target volume {} is not part of ViPR managed targtes for given source {}", targetVolumeNativeGuid, sourceVolumeNativeGuid);
continue;
}
} else if (PersonalityTypes.SOURCE.toString().equalsIgnoreCase(targetVolume.getPersonality())) {
if (null == targetVolume.getSrdfTargets() || !targetVolume.getSrdfTargets().contains(sourceVolume.getId().toString())) {
_log.info("target volume {} is not part of ViPR managed targtes for given source {}", sourceVolumeNativeGuid, targetVolumeNativeGuid);
continue;
}
}
addPath(keyMap, operation.getResult(), volumePath);
}
} catch (Exception e) {
_log.error("Prerequiste Step for getting srdf storage synchronized relations failed :", e);
}
}
}
use of javax.cim.CIMObjectPath in project coprhd-controller by CoprHD.
the class VolumeToSynchronizedRefProcessor method processResult.
@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException {
try {
@SuppressWarnings("unchecked") final Iterator<CIMInstance> it = (Iterator<CIMInstance>) resultObj;
CIMObjectPath volumePath = getObjectPathfromCIMArgument(args);
String volumeNativeGuid = getVolumeNativeGuid(volumePath);
_dbClient = (DbClient) keyMap.get(Constants.dbClient);
@SuppressWarnings("unchecked") Map<String, URI> volumeToRAGroupMap = (Map<String, URI>) keyMap.get(Constants.RAGROUP);
URI remoteRAGroupUri = volumeToRAGroupMap.get(volumeNativeGuid);
_log.debug("Remote RA Group URI {}", remoteRAGroupUri);
RemoteDirectorGroup remoteGroup = _dbClient.queryObject(RemoteDirectorGroup.class, remoteRAGroupUri);
if (null == remoteGroup) {
_log.info("Remote Group not found {}", remoteRAGroupUri);
return;
}
String copyMode = null;
int numberOfTargets = 0;
if (it != null) {
while (it.hasNext()) {
CIMInstance storageSynchronized = it.next();
CIMObjectPath storageSynchronizedPath = storageSynchronized.getObjectPath();
CIMObjectPath sourcePath = (CIMObjectPath) storageSynchronizedPath.getKey(Constants._SystemElement).getValue();
CIMObjectPath destPath = (CIMObjectPath) storageSynchronizedPath.getKey(Constants._SyncedElement).getValue();
String sourceNativeGuid = createKeyfromPath(sourcePath);
String targetNativeGuid = createKeyfromPath(destPath);
_log.info("Source : {} , target : {}", sourceNativeGuid, targetNativeGuid);
if (!findVolumesArefromSameArray(sourceNativeGuid, targetNativeGuid)) {
numberOfTargets++;
copyMode = storageSynchronized.getPropertyValue(MODE).toString();
_log.info("RDF Group {} detected Copy Mode {}", remoteGroup.getNativeGuid(), copyMode);
}
}
}
if (numberOfTargets > 1) {
_log.info("RA Group {} is associated with Cascaded SRDF configuration, hence copyMode will not be updated.", remoteGroup.getNativeGuid());
remoteGroup.setSupported(false);
} else {
// set copy Mode on Remote Group.
// get Volume-->RA Group Mapping
// if Copy Mode is already set on ViPr remoteGroup in DB, then don't change it.
remoteGroup.setSupported(true);
if (updateSupportedCopyMode(remoteGroup.getSupportedCopyMode())) {
// in general, this property value can't be null, but in customer case we are seeing this, hence added this check
if (null == copyMode) {
remoteGroup.setSupportedCopyMode(SupportedCopyModes.UNKNOWN.toString());
} else {
remoteGroup.setSupportedCopyMode(SupportedCopyModes.getCopyMode(copyMode));
}
}
_log.debug("Remote Group Copy Mode: {}", remoteGroup.getSupportedCopyMode());
}
_dbClient.persistObject(remoteGroup);
} catch (Exception e) {
_log.error("Copy Mode Discovery failed for remote Groups ", e);
}
}
use of javax.cim.CIMObjectPath in project coprhd-controller by CoprHD.
the class ScannerProcessor method processResult.
/**
* {@inheritDoc}
*/
@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException {
AccessProfile profile = null;
try {
profile = (AccessProfile) keyMap.get(Constants.ACCESSPROFILE);
@SuppressWarnings("unchecked") final Iterator<CIMInstance> it = (Iterator<CIMInstance>) resultObj;
while (it.hasNext()) {
try {
final CIMInstance instance = it.next();
final CIMObjectPath path = instance.getObjectPath();
if (isIBMInstance(instance) || path.toString().toLowerCase().contains(Constants.CLARIION) || !isRemoteSystem(instance)) {
addPath(keyMap, operation.getResult(), path);
} else {
_logger.info("Skipping Detection of Remote System {}", instance.getPropertyValue(Constants.NAME));
}
} catch (Exception e) {
_logger.error("Scanner Failed to scan Provider : {}-->{}", profile.getserialID(), getMessage(e));
}
}
} catch (Exception e) {
_logger.error("Scanner Failed to scan Provider : {}-->{}", profile.getIpAddress(), getMessage(e));
}
}
use of javax.cim.CIMObjectPath in project coprhd-controller by CoprHD.
the class SMICommunicationInterface method discover.
/**
* {@inheritDoc}
*/
@Override
public void discover(AccessProfile accessProfile) throws BaseCollectionException {
URI storageSystemURI = null;
StorageSystem storageSystem = null;
String detailedStatusMessage = "Unknown Status";
long startTime = System.currentTimeMillis();
try {
_logger.info("Access Profile Details :" + accessProfile.toString());
storageSystemURI = accessProfile.getSystemId();
storageSystem = queryStorageSystem(accessProfile);
_keyMap = new ConcurrentHashMap<String, Object>();
_wbemClient = getCIMClient(accessProfile);
_logger.info("CIMClient initialized successfully");
_keyMap.put(Constants._cimClient, _wbemClient);
_keyMap.put(Constants.dbClient, _dbClient);
_keyMap.put(Constants.COORDINATOR_CLIENT, _coordinator);
if (_networkDeviceController != null) {
_keyMap.put(Constants.networkDeviceController, _networkDeviceController);
}
_keyMap.put(Constants.PROPS, accessProfile.getProps());
_keyMap.put(Constants._InteropNamespace, accessProfile.getInteropNamespace());
_keyMap.put(Constants.ACCESSPROFILE, accessProfile);
_keyMap.put(Constants.SYSTEMID, accessProfile.getSystemId());
_keyMap.put(Constants._serialID, accessProfile.getserialID());
_keyMap.put(Constants.STORAGEPOOLS, new LinkedList<CIMObjectPath>());
_keyMap.put(Constants.PROTOCOLS, new HashSet<String>());
_keyMap.put(Constants.STORAGEETHERNETPORTS, new LinkedList<CIMObjectPath>());
_keyMap.put(Constants.IPENDPOINTS, new LinkedList<CIMObjectPath>());
_keyMap.put(Constants.STORAGEVOLUMES, new LinkedList<CIMObjectPath>());
String providerVersion = getProviderVersionString(storageSystem);
if (null != providerVersion) {
_keyMap.put(Constants.VERSION, providerVersion);
_keyMap.put(Constants.IS_NEW_SMIS_PROVIDER, isSMIS8XProvider(providerVersion));
}
Map<URI, StoragePool> poolsToMatchWithVpool = new HashMap<URI, StoragePool>();
_keyMap.put(Constants.MODIFIED_STORAGEPOOLS, poolsToMatchWithVpool);
// need this nested structure to be able to minimize the changes on existing code.
List<List<StoragePort>> portsToRunNetworkConnectivity = new ArrayList<List<StoragePort>>();
_keyMap.put(Constants.STORAGE_PORTS, portsToRunNetworkConnectivity);
List<StoragePort> discoveredPorts = new ArrayList<StoragePort>();
_keyMap.put(Constants.DISCOVERED_PORTS, discoveredPorts);
_keyMap.put(Constants.SLO_NAMES, new HashSet<String>());
if (Type.ibmxiv.name().equals(accessProfile.getSystemType())) {
initIBMDiscoveryKeyMap(accessProfile);
} else {
initEMCDiscoveryKeyMap(accessProfile);
if (Type.vmax.name().equals(accessProfile.getSystemType())) {
// discover port group
_keyMap.put(Constants.PORTGROUP, CimObjectPathCreator.createInstance(Constants.SE_TARGETMASKINGGROUP, accessProfile.getInteropNamespace()));
}
}
executor.setKeyMap(_keyMap);
executor.execute((Namespace) namespaces.getNsList().get(DISCOVER));
} catch (Exception e) {
detailedStatusMessage = String.format("Discovery failed for Storage System: %s because %s", storageSystemURI.toString(), e.getMessage());
_logger.error(detailedStatusMessage, e);
throw new SMIPluginException(detailedStatusMessage);
} finally {
if (storageSystem != null) {
try {
// set detailed message
storageSystem.setLastDiscoveryStatusMessage(detailedStatusMessage);
_dbClient.persistObject(storageSystem);
} catch (DatabaseException ex) {
_logger.error("Error while persisting object to DB", ex);
}
}
releaseResources();
long totalTime = System.currentTimeMillis() - startTime;
_logger.info(String.format("Discovery of Storage System %s took %f seconds", storageSystemURI.toString(), (double) totalTime / (double) 1000));
}
}
use of javax.cim.CIMObjectPath in project coprhd-controller by CoprHD.
the class SMICommunicationInterface method discoverArrayAffinity.
/**
* {@inheritDoc}
*/
@Override
public void discoverArrayAffinity(AccessProfile accessProfile) {
_logger.info("Calling discoverArrayAffinity");
URI storageSystemURI = accessProfile.getSystemId();
String detailedStatusMessage = "Array Affinity Discovery completed successfully for Storage System: %s";
long startTime = System.currentTimeMillis();
try {
_logger.info("Access Profile Details :" + accessProfile.toString());
_keyMap = new ConcurrentHashMap<String, Object>();
_wbemClient = getCIMClient(accessProfile);
_logger.info("CIMClient initialized successfully");
_keyMap.put(Constants._cimClient, _wbemClient);
_keyMap.put(Constants.dbClient, _dbClient);
_keyMap.put(Constants.COORDINATOR_CLIENT, _coordinator);
_keyMap.put(Constants.PROPS, accessProfile.getProps());
_keyMap.put(Constants._InteropNamespace, accessProfile.getInteropNamespace());
_keyMap.put(Constants.ACCESSPROFILE, accessProfile);
_keyMap.put(Constants.SYSTEMID, accessProfile.getSystemId());
_keyMap.put(Constants._serialID, accessProfile.getserialID());
_keyMap.put(Constants.MASKING_VIEWS, new LinkedList<CIMObjectPath>());
StorageSystem storageSystem = queryStorageSystem(accessProfile);
String providerVersion = getProviderVersionString(storageSystem);
if (null != providerVersion) {
_keyMap.put(Constants.VERSION, providerVersion);
_keyMap.put(Constants.IS_NEW_SMIS_PROVIDER, isSMIS8XProvider(providerVersion));
}
executor.setKeyMap(_keyMap);
executor.execute((Namespace) namespaces.getNsList().get(DISCOVER));
} catch (Exception e) {
detailedStatusMessage = "Array Affinity Discovery failed for Storage System: %s because " + e.getMessage();
_logger.error(String.format(detailedStatusMessage, storageSystemURI.toString()), e);
throw new SMIPluginException(String.format(detailedStatusMessage, storageSystemURI.toString()));
} finally {
try {
String systemIdsStr = accessProfile.getProps().get(Constants.SYSTEM_IDS);
String[] systemIds = systemIdsStr.split(Constants.ID_DELIMITER);
List<StorageSystem> systemsToUpdate = new ArrayList<StorageSystem>();
for (String systemId : systemIds) {
StorageSystem system = _dbClient.queryObject(StorageSystem.class, URI.create(systemId));
// set detailed message
system.setLastArrayAffinityStatusMessage(String.format(detailedStatusMessage, systemId));
systemsToUpdate.add(system);
}
_dbClient.updateObject(systemsToUpdate);
} catch (DatabaseException ex) {
_logger.error("Error while persisting object to DB", ex);
}
releaseResources();
long totalTime = System.currentTimeMillis() - startTime;
_logger.info(String.format("Array Affinity discovery of Storage System %s took %f seconds", storageSystemURI.toString(), (double) totalTime / (double) 1000));
}
}
Aggregations