use of javax.cim.CIMInstance in project coprhd-controller by CoprHD.
the class AllocatedFromStoragePoolProcessor method processInstances.
/**
* {@inheritDoc}
*/
@Override
protected int processInstances(Iterator<CIMInstance> instances, WBEMClient client) {
int count = 0;
while (instances.hasNext()) {
try {
count++;
CIMInstance instance = instances.next();
CIMObjectPath volPath = (CIMObjectPath) instance.getObjectPath().getKeyValue(DEPENDENT);
if (_symmvolume.equals(volPath.getObjectName())) {
String spaceConsumed = getCIMPropertyValue(instance, SPACE_CONSUMED);
_volumeToSpaceConsumedMap.put(volPath.toString(), spaceConsumed);
}
} catch (Exception e) {
_logger.error("Exception on processing instances", e);
}
}
return count;
}
use of javax.cim.CIMInstance in project coprhd-controller by CoprHD.
the class FirmwareProcessor method processResult.
/**
* {@inheritDoc}
*/
@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException {
try {
String serialNumber = null;
@SuppressWarnings("unchecked") final Iterator<CIMInstance> it = (Iterator<CIMInstance>) resultObj;
_dbClient = (DbClient) keyMap.get(Constants.dbClient);
coordinator = (CoordinatorClient) keyMap.get(Constants.COORDINATOR_CLIENT);
AccessProfile profile = (AccessProfile) keyMap.get(Constants.ACCESSPROFILE);
String delimiter = Constants.PATH_DELIMITER_REGEX;
if (Type.ibmxiv.name().equals(profile.getSystemType())) {
delimiter = Pattern.quote(Constants.COLON);
}
if (it.hasNext()) {
// e.g., IBM XIV InstanceID, IBMTSDS:IBM.2810-7825363
CIMInstance firmwareInstance = it.next();
serialNumber = firmwareInstance.getPropertyValue(INSTANCEID).toString().split(delimiter)[1];
String nativeGuid = NativeGUIDGenerator.generateNativeGuid(profile.getSystemType(), serialNumber);
List<StorageSystem> systems = CustomQueryUtility.getActiveStorageSystemByNativeGuid(_dbClient, nativeGuid);
if (!systems.isEmpty()) {
StorageSystem system = systems.get(0);
checkFirmwareVersion(firmwareInstance, system);
}
} else {
String errMsg = String.format("No information obtained from Provider %s for Firmware version", profile.getIpAddress());
throw new SMIPluginException(errMsg, SMIPluginException.ERRORCODE_OPERATIONFAILED);
}
} catch (SMIPluginException e) {
throw e;
} catch (Exception e) {
String errMsg = String.format("An error occurred while verifying Firmware version: %s", e.getMessage());
throw new SMIPluginException(SMIPluginException.ERRORCODE_OPERATIONFAILED, e, errMsg);
}
}
use of javax.cim.CIMInstance 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.CIMInstance in project coprhd-controller by CoprHD.
the class PoolCapabilitiesProcessor 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;
_dbClient = (DbClient) keyMap.get(Constants.dbClient);
AccessProfile profile = (AccessProfile) keyMap.get(Constants.ACCESSPROFILE);
StorageSystem device = getStorageSystem(_dbClient, profile.getSystemId());
while (it.hasNext()) {
CIMInstance capabilitiesInstance = null;
try {
capabilitiesInstance = it.next();
String instanceID = capabilitiesInstance.getPropertyValue(Constants.INSTANCEID).toString();
if (DiscoveredDataObject.Type.vnxblock.toString().equalsIgnoreCase(device.getSystemType())) {
insertExpectedPoolSettingsPerTier(capabilitiesInstance.getObjectPath(), keyMap);
addPath(keyMap, Constants.VNXPOOLCAPABILITIES, capabilitiesInstance.getObjectPath());
}
addPath(keyMap, operation.getResult(), capabilitiesInstance.getObjectPath());
} catch (Exception e) {
_logger.warn("Pool Capabilities Discovery failed for {}-->{}", capabilitiesInstance.getObjectPath(), getMessage(e));
}
}
} catch (Exception e) {
_logger.error("Pool Capabilities Discovery failed -->{}", getMessage(e));
}
}
use of javax.cim.CIMInstance in project coprhd-controller by CoprHD.
the class ProfileProcessor method isRegisteredProfileValid.
/**
* is Registered Profile Valid.
*
* @param profileinstances
* @return
*/
private CIMInstance isRegisteredProfileValid(Iterator<CIMInstance> profileinstances) {
CIMInstance profileInstance = null;
while (profileinstances.hasNext()) {
profileInstance = profileinstances.next();
String registeredName = getCIMPropertyValue(profileInstance, REGISTEREDNAME);
String registeredVersion = getCIMPropertyValue(profileInstance, REGISTEREDVERSION);
String registeredOrganization = getCIMPropertyValue(profileInstance, REGISTEREDORGANIZATION);
if (registeredName.contains(ARRAY) && registeredOrganization.equalsIgnoreCase(ELEVEN)) {
if (highestVersion.isEmpty()) {
highestVersionRegProfile = profileInstance;
highestVersion = registeredVersion;
} else if (compareVersions(registeredVersion, highestVersion) > 0) {
highestVersionRegProfile = profileInstance;
highestVersion = registeredVersion;
}
}
}
return highestVersionRegProfile;
}
Aggregations