use of javax.cim.CIMObjectPath in project coprhd-controller by CoprHD.
the class LunMaskingProcessor method getChildGroupsifCascaded.
/**
* get All Child SGs if cascaded
*
* @param path
* @param client
* @return
*/
private List<CIMObjectPath> getChildGroupsifCascaded(CIMObjectPath path, WBEMClient client) {
CloseableIterator<CIMObjectPath> pathItr = null;
List<CIMObjectPath> childSGs = new ArrayList<CIMObjectPath>();
try {
pathItr = client.referenceNames(path, SmisConstants.SE_MEMBER_OF_COLLECTION_DMG_DMG, null);
if (!pathItr.hasNext()) {
// There are no references in this SG, it is a standalone.
return Collections.emptyList();
}
while (pathItr.hasNext()) {
CIMObjectPath objPath = pathItr.next();
CIMProperty prop = objPath.getKey(SmisConstants.MEMBER);
CIMObjectPath comparePath = (CIMObjectPath) prop.getValue();
if (comparePath.toString().endsWith(path.toString())) {
return Collections.emptyList();
}
_logger.debug("Found Child SG {}", comparePath.toString());
childSGs.add(comparePath);
}
} catch (Exception e) {
_logger.info("Got exception trying to retrieve cascade status of SG. Assuming cascaded: ", e);
} finally {
if (null != pathItr) {
pathItr.close();
}
}
return childSGs;
}
use of javax.cim.CIMObjectPath in project coprhd-controller by CoprHD.
the class LunMaskingProcessor method addIoLimitsOnVolume.
/**
* Add IO limits on volume based on SG they belong to.
*
* Also sets the SLO name in which the SG is configured.
*
* @param client
* @param path
* @param volToIolimits
* @param parentHostIoBw
* @param parentHostIoPs
*/
private void addIoLimitsOnVolume(WBEMClient client, CIMObjectPath path, Map<String, VolHostIOObject> volToIolimits, Map<String, String> volToFastPolicy, String parentHostIoBw, String parentHostIoPs) {
try {
CIMInstance instance = client.getInstance(path, false, true, SmisConstants.PS_HOST_IO);
String hostIoBw = String.valueOf(instance.getPropertyValue(SmisConstants.EMC_MAX_BANDWIDTH));
String hostIoPs = String.valueOf(instance.getPropertyValue(SmisConstants.EMC_MAX_IO));
String fastSetting = SmisUtils.getSLOPolicyName(instance);
_logger.info("Bw {} and Iops {} found for SG : {} ", new Object[] { hostIoBw, hostIoPs, String.valueOf(instance.getPropertyValue(Constants.ELEMENTNAME)) });
if (hostIoBw.equals("0") && hostIoPs.equals("0")) {
hostIoBw = parentHostIoBw;
hostIoPs = parentHostIoPs;
}
CloseableIterator<CIMObjectPath> volPaths = client.associatorNames(path, null, Constants.STORAGE_VOLUME, null, null);
while (volPaths.hasNext()) {
CIMObjectPath volPath = volPaths.next();
String volumeNativeGuid = getVolumeNativeGuid(volPath);
VolHostIOObject obj = new VolHostIOObject();
obj.setVolNativeGuid(volumeNativeGuid);
obj.setHostIoBw(hostIoBw);
obj.setHostIops(hostIoPs);
_logger.debug("Volume key: {}..obj : {}", volumeNativeGuid, obj.toString());
volToIolimits.put(volumeNativeGuid, obj);
if (!Strings.isNullOrEmpty(fastSetting)) {
volToFastPolicy.put(volumeNativeGuid, fastSetting);
}
}
} catch (Exception e) {
_logger.warn("Finding HostIO limits failed during unmanaged volume discovery", e);
}
}
use of javax.cim.CIMObjectPath in project coprhd-controller by CoprHD.
the class ConnectivityCollectionRelationshipsProcessor method processResult.
@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException {
try {
@SuppressWarnings("unchecked") final Iterator<CIMObjectPath> it = (Iterator<CIMObjectPath>) resultObj;
boolean volumeAdded = false;
DbClient dbClient = (DbClient) keyMap.get(Constants.dbClient);
CIMObjectPath raGroupPath = getObjectPathfromCIMArgument(args);
String ragGroupId = NativeGUIDGenerator.generateRAGroupNativeGuid(raGroupPath);
_log.debug("RA Group Id : {}", ragGroupId);
RemoteDirectorGroup rg = getRAGroupUriFromDB(dbClient, ragGroupId);
if (null == rg) {
_log.info("RA Group Not found : {}", ragGroupId);
return;
}
URI raGroupUri = rg.getId();
@SuppressWarnings("unchecked") Map<String, URI> rAGroupMap = (Map<String, URI>) keyMap.get(Constants.RAGROUP);
Set<String> volumeNativeGuids = new StringSet();
while (it.hasNext()) {
CIMObjectPath connCollectionRelationPaths = it.next();
String cimClass = connCollectionRelationPaths.getObjectName();
if (PROTOCOL_END_POINT.equals(cimClass)) {
String endPointId = connCollectionRelationPaths.getKey(Constants.NAME).getValue().toString();
_log.info("End Point Added {}", connCollectionRelationPaths);
addPath(keyMap, Constants.ENDPOINTS_RAGROUP, connCollectionRelationPaths);
rAGroupMap.put(endPointId, raGroupUri);
} else if (VOLUME.equals(cimClass)) {
String volumeNativeGuid = getVolumeNativeGuid(connCollectionRelationPaths);
if (!volumeAdded && !rAGroupMap.containsKey(volumeNativeGuid)) {
volumeAdded = true;
_log.info("Volume Added {}", connCollectionRelationPaths);
addPath(keyMap, Constants.VOLUME_RAGROUP, connCollectionRelationPaths);
rAGroupMap.put(volumeNativeGuid, raGroupUri);
} else {
_log.info("Volume {} is part of multiple RA Groups", volumeNativeGuid);
}
volumeNativeGuids.add(volumeNativeGuid);
}
}
RemoteDirectorGroup remoteGroup = dbClient.queryObject(RemoteDirectorGroup.class, raGroupUri);
// async
if (!volumeAdded) {
remoteGroup.setSupportedCopyMode(SupportedCopyModes.ALL.toString());
}
if (null == remoteGroup.getVolumes() || remoteGroup.getVolumes().isEmpty()) {
remoteGroup.setVolumes(new StringSet(volumeNativeGuids));
} else {
_log.debug("Existing Volumes {}", Joiner.on("\t").join(remoteGroup.getVolumes()));
_log.debug("New Volumes {}", Joiner.on("\t").join(volumeNativeGuids));
remoteGroup.getVolumes().replace(volumeNativeGuids);
_log.debug("Updated Volumes {}", Joiner.on("\t").join(remoteGroup.getVolumes()));
}
dbClient.persistObject(remoteGroup);
} catch (Exception e) {
_log.error("Exception occurred while processing remote connectivity information.", e);
}
}
use of javax.cim.CIMObjectPath in project coprhd-controller by CoprHD.
the class ProtocolEndPointToPortProcessor 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 protocolEndPointPath = getObjectPathfromCIMArgument(args);
AccessProfile profile = (AccessProfile) keyMap.get(Constants.ACCESSPROFILE);
_dbClient = (DbClient) keyMap.get(Constants.dbClient);
StorageSystem device = _dbClient.queryObject(StorageSystem.class, profile.getSystemId());
String protocolEndPointId = protocolEndPointPath.getKey(Constants.NAME).getValue().toString();
_log.info("Protocol End Point ID :" + protocolEndPointId);
@SuppressWarnings("unchecked") Map<String, URI> volumeToRAGroupMap = (Map<String, URI>) keyMap.get(Constants.RAGROUP);
URI remoteRAGroupUri = volumeToRAGroupMap.get(protocolEndPointId);
_log.info("Remote RA Group URI :" + remoteRAGroupUri);
String sourceSystemSerialId = keyMap.get(Constants._serialID).toString();
_log.info("Source Serial ID :" + sourceSystemSerialId);
RemoteDirectorGroup remoteGroup = _dbClient.queryObject(RemoteDirectorGroup.class, remoteRAGroupUri);
if (remoteGroup == null) {
_log.info("RA Group Not Found {}", remoteRAGroupUri);
}
while (it.hasNext()) {
CIMInstance portInstance = it.next();
StoragePort port = checkStoragePortExistsInDB(portInstance, device, _dbClient);
if (null == port) {
_log.info("RA Group Port Not Found {}", portInstance.getObjectPath());
continue;
}
if (portInstance.getObjectPath().toString().contains(sourceSystemSerialId)) {
remoteGroup.setSourcePort(port.getId());
_log.info("Source Port added :" + portInstance.getObjectPath());
} else {
remoteGroup.setRemotePort(port.getId());
_log.info("Remote Port added :" + portInstance.getObjectPath());
}
_dbClient.persistObject(remoteGroup);
}
} catch (Exception e) {
_log.error("Discovering Ports for RA Groups failed", e);
}
}
use of javax.cim.CIMObjectPath in project coprhd-controller by CoprHD.
the class SRDFStorageSyncProcessor method processResult.
@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException {
CloseableIterator<CIMObjectPath> synchronizedInstancePaths = null;
EnumerateResponse<CIMObjectPath> synchronizedInstancePathChunks = null;
WBEMClient client = SMICommunicationInterface.getCIMClient(keyMap);
try {
synchronizedInstancePathChunks = (EnumerateResponse<CIMObjectPath>) resultObj;
synchronizedInstancePaths = synchronizedInstancePathChunks.getResponses();
processStorageSynchronizedPaths(operation, synchronizedInstancePaths, resultObj, keyMap);
while (!synchronizedInstancePathChunks.isEnd()) {
synchronizedInstancePathChunks = client.getInstancePaths(Constants.SYNC_PATH, synchronizedInstancePathChunks.getContext(), Constants.SYNC_BATCH_SIZE);
processStorageSynchronizedPaths(operation, synchronizedInstancePathChunks.getResponses(), resultObj, keyMap);
}
}//
catch (Exception e) {
_log.error("Processing Storage Synchronized Realtions for SRDF failed : ", e);
} finally {
if (null != synchronizedInstancePaths) {
synchronizedInstancePaths.close();
}
if (null != synchronizedInstancePathChunks) {
try {
client.closeEnumeration(Constants.SYNC_PATH, synchronizedInstancePathChunks.getContext());
} catch (Exception e) {
_log.debug("Exception occurred while closing enumeration", e);
}
}
}
resultObj = null;
}
Aggregations