use of javax.cim.CIMObjectPath in project coprhd-controller by CoprHD.
the class CIMObjectPathQueryFactory method getTierPolicyRulePath.
/**
* TODO StoragePoolSetting or Tier_policyRule
*/
@Override
public CIMObjectPath getTierPolicyRulePath(StorageSystem storageDevice, String policyName) {
String tierPolicyRuleClazz = storageDevice.checkIfVmax3() ? STORAGE_POOL_SETTING : TIER_POLICY_RULE;
String wql = format("SELECT * FROM %s WHERE SystemName like '%s' AND PolicyRuleName like '%s'", prefixWithParamName(tierPolicyRuleClazz), storageDevice.getSerialNumber(), policyName);
CIMObjectPath queryClass = getQueryClass(TIER_POLICY_SERVICE);
CIMObjectPath[] paths = execQuery(storageDevice, queryClass, wql);
if (paths.length == 0) {
return null;
}
return paths[0];
}
use of javax.cim.CIMObjectPath in project coprhd-controller by CoprHD.
the class CIMObjectPathQueryFactory method getStoragePoolPath.
@Override
public CIMObjectPath getStoragePoolPath(StorageSystem storage, StoragePool storagePool) {
String wql = format("SELECT * FROM %s WHERE InstanceID like '%s' AND InstanceID like '%s'", storagePool.getPoolClassName(), storagePool.getPoolName(), storage.getSerialNumber());
CIMObjectPath queryClass = getQueryClass(storagePool.getPoolClassName());
CIMObjectPath[] paths = execQuery(storage, queryClass, wql);
if (paths.length == 0) {
return null;
}
return paths[0];
}
use of javax.cim.CIMObjectPath in project coprhd-controller by CoprHD.
the class CIMObjectPathQueryFactory method getControllerReplicationSvcPath.
@Override
public CIMObjectPath getControllerReplicationSvcPath(StorageSystem storageDevice) {
String wql = format("SELECT * FROM %s WHERE SystemName like '%s'", prefixWithParamName(REPLICATION_SERVICE), storageDevice.getSerialNumber());
CIMObjectPath queryClass = getQueryClass(REPLICATION_SERVICE);
CIMObjectPath[] paths = execQuery(storageDevice, queryClass, wql);
if (paths.length == 0) {
return null;
}
return paths[0];
}
use of javax.cim.CIMObjectPath in project coprhd-controller by CoprHD.
the class ExportProcessor method processResult.
/*
* (non-Javadoc)
*
* @see com.emc.storageos.plugins.common.Processor#processResult(com.emc.storageos.plugins.common.domainmodel.Operation,
* java.lang.Object, java.util.Map)
*/
@SuppressWarnings("unchecked")
@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException {
initialize(operation, resultObj, keyMap);
CloseableIterator<CIMInstance> it = null;
EnumerateResponse<CIMInstance> response = null;
List<Initiator> matchedInitiators = new ArrayList<Initiator>();
List<StoragePort> matchedPorts = new ArrayList<StoragePort>();
WBEMClient client = SMICommunicationInterface.getCIMClient(keyMap);
StringSet knownIniSet = new StringSet();
StringSet knownNetworkIdSet = new StringSet();
StringSet knownPortSet = new StringSet();
StringSet knownVolumeSet = new StringSet();
try {
// set lun masking view CIM path
CIMObjectPath path = this.getObjectPathfromCIMArgument(_args, keyMap);
UnManagedExportMask mask = this.getUnManagedExportMask(path);
mask.setMaskingViewPath(path.toString());
_logger.info("looking at lun masking view: " + path.toString());
CIMInstance lunMaskingView = client.getInstance(path, false, false, null);
if (lunMaskingView != null) {
String maskName = CIMPropertyFactory.getPropertyValue(lunMaskingView, SmisConstants.CP_NAME);
if (maskName != null) {
mask.setMaskName(maskName);
}
_logger.info("set UnManagedExportMask maskName to " + mask.getMaskName());
} else {
_logger.info("lunMaskingView was null");
}
CIMProperty<String> deviceIdProperty = (CIMProperty<String>) path.getKey(SmisConstants.CP_DEVICE_ID);
if (deviceIdProperty != null) {
mask.setNativeId(deviceIdProperty.getValue());
}
_logger.info("set UnManagedExportMask nativeId to " + mask.getNativeId());
// set storage system id
URI systemId = (URI) keyMap.get(Constants.SYSTEMID);
mask.setStorageSystemUri(systemId);
response = (EnumerateResponse<CIMInstance>) resultObj;
processVolumesAndInitiatorsPaths(response.getResponses(), mask, matchedInitiators, matchedPorts, knownIniSet, knownNetworkIdSet, knownPortSet, knownVolumeSet);
while (!response.isEnd()) {
_logger.info("Processing next Chunk");
response = client.getInstancesWithPath(Constants.MASKING_PATH, response.getContext(), new UnsignedInteger32(BATCH_SIZE));
processVolumesAndInitiatorsPaths(response.getResponses(), mask, matchedInitiators, matchedPorts, knownIniSet, knownNetworkIdSet, knownPortSet, knownVolumeSet);
}
// CTRL - 8918 - always update the mask with new initiators and volumes.
mask.replaceNewWithOldResources(knownIniSet, knownNetworkIdSet, knownVolumeSet, knownPortSet);
// get zones and store them?
updateZoningMap(mask, matchedInitiators, matchedPorts);
updateVplexBackendVolumes(mask, matchedInitiators);
updateRecoverPointVolumes(mask, matchedInitiators);
} catch (Exception e) {
_logger.error("something failed", e);
} finally {
if (it != null) {
it.close();
}
wrapUp();
if (response != null) {
try {
client.closeEnumeration(Constants.MASKING_PATH, response.getContext());
} catch (Exception e) {
_logger.debug("Exception occurred while closing enumeration", e);
}
}
}
}
use of javax.cim.CIMObjectPath in project coprhd-controller by CoprHD.
the class AbstractFASTPolicyProcessor method addStoragePoolstoPolicy.
/**
* add StoragePools to FAST Policy Object
* Existing Pools associated with Policy will get replaced.
*
* @param policyObjectPath
* @param it
* @param dbClient
* @throws IOException
*/
@SuppressWarnings("unchecked")
protected void addStoragePoolstoPolicy(List<CIMObjectPath> policyObjectPaths, Iterator<CIMObjectPath> it, DbClient dbClient, Map<String, Object> keyMap, String tierID) throws IOException {
// PolicyToPoolInfo ---> Map <PolicyName, Set<String> Pools>
// set already at runtime
Map<String, Set<String>> policytopoolMapping = (Map<String, Set<String>>) keyMap.get(Constants.POLICY_TO_POOLS_MAPPING);
while (it.hasNext()) {
CIMObjectPath poolObjectPath = it.next();
URI poolURI = getStoragePoolURI(poolObjectPath, dbClient);
if (null != poolURI) {
for (CIMObjectPath policyObjectPath : policyObjectPaths) {
String policyID = getFASTPolicyID(policyObjectPath);
if (!policytopoolMapping.containsKey(policyID)) {
policytopoolMapping.put(policyID, new HashSet<String>());
}
policytopoolMapping.get(policyID).add(poolURI.toString());
}
}
}
}
Aggregations