use of javax.cim.CIMInstance in project coprhd-controller by CoprHD.
the class SettingsInstanceProcessor method processResult.
@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException {
try {
final CIMInstance poolSettingInstance = (CIMInstance) resultObj;
addInstance(keyMap, operation.getResult(), poolSettingInstance);
} catch (Exception e) {
_logger.error("Processing Pool Setting Instances failed :", e);
}
}
use of javax.cim.CIMInstance in project coprhd-controller by CoprHD.
the class VNXTierDomainToTiersProcessor method processResult.
@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException {
try {
_dbClient = (DbClient) keyMap.get(Constants.dbClient);
@SuppressWarnings("unchecked") final Iterator<CIMInstance> it = (Iterator<CIMInstance>) resultObj;
// indicates ExtremePerformance or Performance or Capacity Tier
Object[] arguments = (Object[]) _args.get(0);
CIMObjectPath tierDomainPath = (CIMObjectPath) arguments[0];
CIMObjectPath storagePoolpath = (CIMObjectPath) keyMap.get(tierDomainPath.getKey(Constants.NAME).getValue());
addTiersToPool(storagePoolpath, it, _dbClient, keyMap);
} catch (Exception e) {
_logger.error("VNX TierDomain to Tier Processing failed :", e);
}
}
use of javax.cim.CIMInstance in project coprhd-controller by CoprHD.
the class XIVStorageConfigurationCapabilitiesProcessor method processResult.
@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException {
@SuppressWarnings("unchecked") final Iterator<CIMInstance> it = (Iterator<CIMInstance>) resultObj;
_profile = (AccessProfile) keyMap.get(Constants.ACCESSPROFILE);
_dbClient = (DbClient) keyMap.get(Constants.dbClient);
try {
StorageSystem system = _dbClient.queryObject(StorageSystem.class, _profile.getSystemId());
while (it.hasNext()) {
CIMInstance storageConfigurationInstance = it.next();
UnsignedInteger16[] supportedElementTypeArr = (UnsignedInteger16[]) storageConfigurationInstance.getPropertyValue(SUPPORTED_ELEMENT_TYPES);
String supportedElementTypes = Arrays.toString(supportedElementTypeArr);
if (_logger.isDebugEnabled()) {
_logger.debug("Capability:" + supportedElementTypes);
}
if (supportedElementTypes.contains(THIN_VOLUME_SUPPORTED) && supportedElementTypes.contains(THICK_VOLUME_SUPPORTED)) {
system.setSupportedProvisioningType(SupportedProvisioningTypes.THIN_AND_THICK.name());
} else if (supportedElementTypes.contains(THIN_VOLUME_SUPPORTED)) {
system.setSupportedProvisioningType(SupportedProvisioningTypes.THIN.name());
} else if (supportedElementTypes.contains(THICK_VOLUME_SUPPORTED)) {
system.setSupportedProvisioningType(SupportedProvisioningTypes.THICK.name());
} else {
system.setSupportedProvisioningType(SupportedProvisioningTypes.NONE.name());
}
// should have only one instance
break;
}
_dbClient.persistObject(system);
} catch (Exception e) {
_logger.error("Finding out Storage System Capability on Volume Creation failed: ", e);
}
}
use of javax.cim.CIMInstance in project coprhd-controller by CoprHD.
the class XIVStoragePoolProcessor method processResult.
/**
* {@inheritDoc}
*/
@SuppressWarnings("unchecked")
@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException {
final Iterator<CIMInstance> it = (Iterator<CIMInstance>) resultObj;
_profile = (AccessProfile) keyMap.get(Constants.ACCESSPROFILE);
try {
_newPoolList = new ArrayList<StoragePool>();
_updatePoolList = new ArrayList<StoragePool>();
_dbClient = (DbClient) keyMap.get(Constants.dbClient);
StorageSystem device = getStorageSystem(_dbClient, _profile.getSystemId());
if (SupportedProvisioningTypes.NONE.name().equalsIgnoreCase(device.getSupportedProvisioningType())) {
_logger.info("Storage System doesn't support volume creations :" + device.getLabel());
return;
}
Set<String> protocols = (Set<String>) keyMap.get(Constants.PROTOCOLS);
Map<URI, StoragePool> poolsToMatchWithVpool = new HashMap<URI, StoragePool>();
while (it.hasNext()) {
CIMInstance poolInstance = it.next();
try {
addPath(keyMap, operation.getResult(), poolInstance.getObjectPath());
String hardSizeStr = getCIMPropertyValue(poolInstance, HARD_SIZE);
long hardSize = Long.parseLong(hardSizeStr);
String softSizeStr = getCIMPropertyValue(poolInstance, SOFT_SIZE);
long softSize = Long.parseLong(softSizeStr);
SupportedResourceTypes type = SupportedResourceTypes.THICK_ONLY;
if (hardSize < softSize) {
type = SupportedResourceTypes.THIN_ONLY;
}
createStoragePool(_dbClient, device, poolInstance, PoolClassNames.IBMTSDS_VirtualPool.name(), type.name(), protocols, poolsToMatchWithVpool, _newPoolList, _updatePoolList);
} catch (Exception e) {
_logger.warn("StoragePool Discovery failed for {}", getCIMPropertyValue(poolInstance, Constants.INSTANCEID), getMessage(e));
}
}
// set the pools whose properties got changed.
keyMap.put(Constants.MODIFIED_STORAGEPOOLS, poolsToMatchWithVpool);
_dbClient.createObject(_newPoolList);
_dbClient.updateAndReindexObject(_updatePoolList);
// find the pools not visible in this discovery
List<StoragePool> discoveredPools = new ArrayList<StoragePool>(_newPoolList);
discoveredPools.addAll(_updatePoolList);
List<StoragePool> notVisiblePools = DiscoveryUtils.checkStoragePoolsNotVisible(discoveredPools, _dbClient, device.getId());
for (StoragePool notVisiblePool : notVisiblePools) {
poolsToMatchWithVpool.put(notVisiblePool.getId(), notVisiblePool);
}
// If any storage ports on the storage system are in a transport
// zone, there is an implicit connection to the transport zone
// varray. We need to add these implicit varray
// connections for the new storage pool.
StoragePoolAssociationHelper.setStoragePoolVarrays(device.getId(), _newPoolList, _dbClient);
} catch (Exception e) {
_logger.error("StoragePool Discovery failed", e);
} finally {
_newPoolList = null;
_updatePoolList = null;
}
}
use of javax.cim.CIMInstance in project coprhd-controller by CoprHD.
the class XIVStoragePortProcessor method processResult.
/**
* {@inheritDoc}
*/
@SuppressWarnings("unchecked")
@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException {
try {
final Iterator<CIMInstance> it = (Iterator<CIMInstance>) resultObj;
_profile = (AccessProfile) keyMap.get(Constants.ACCESSPROFILE);
Set<String> protocols = (Set<String>) keyMap.get(Constants.PROTOCOLS);
_newPortList = new ArrayList<StoragePort>();
_updatePortList = new ArrayList<StoragePort>();
_dbClient = (DbClient) keyMap.get(Constants.dbClient);
Map<URI, StoragePool> poolsToMatchWithVpool = (Map<URI, StoragePool>) keyMap.get(Constants.MODIFIED_STORAGEPOOLS);
StorageSystem device = _dbClient.queryObject(StorageSystem.class, _profile.getSystemId());
while (it.hasNext()) {
CIMInstance portInstance = null;
StoragePort port = null;
try {
portInstance = it.next();
String protocol = getCIMPropertyValue(portInstance, LINKTECHNOLOGY);
String className = portInstance.getClassName();
// FC Port - 4
if ("4".equals(protocol)) {
port = checkStoragePortExistsInDB(portInstance, device, _dbClient);
checkProtocolAlreadyExists(protocols, FC);
createStoragePort(port, portInstance, _profile, true, FC, device);
} else if (IPPORT_CLASS_NAME.equals(className)) {
port = createStoragePort(null, portInstance, _profile, false, IP, device);
checkProtocolAlreadyExists(protocols, ISCSI);
keyMap.put(portInstance.getObjectPath().toString(), port);
addPath(keyMap, operation.getResult(), portInstance.getObjectPath());
} else {
_logger.debug("Unsupported Port : {}", getCIMPropertyValue(portInstance, DEVICEID));
}
} catch (Exception e) {
_logger.warn("Port Discovery failed for {}", getCIMPropertyValue(portInstance, DEVICEID), e);
}
}
_dbClient.createObject(_newPortList);
_dbClient.persistObject(_updatePortList);
// ports used later to run Transport Zone connectivity
List<List<StoragePort>> portsUsedToRunTZoneConnectivity = (List<List<StoragePort>>) keyMap.get(Constants.STORAGE_PORTS);
portsUsedToRunTZoneConnectivity.add(_newPortList);
portsUsedToRunTZoneConnectivity.add(_updatePortList);
List<StoragePool> modifiedPools = StoragePoolAssociationHelper.getStoragePoolsFromPorts(_dbClient, _newPortList, _updatePortList);
for (StoragePool pool : modifiedPools) {
// pool matcher will be invoked on this pool
if (!poolsToMatchWithVpool.containsKey(pool.getId())) {
poolsToMatchWithVpool.put(pool.getId(), pool);
}
}
_logger.debug("# Pools used in invoking PoolMatcher during StoragePortProcessor {}", Joiner.on("\t").join(poolsToMatchWithVpool.keySet()));
// discovered ports used later to check for not visible ports
List<StoragePort> discoveredPorts = (List<StoragePort>) keyMap.get(Constants.DISCOVERED_PORTS);
discoveredPorts.addAll(_newPortList);
discoveredPorts.addAll(_updatePortList);
// if the port's end point is in a transport zone, associate the the
// port to the
// transport zone. Also update the storage pools and varray
// association if needed.
StoragePortAssociationHelper.updatePortAssociations(_newPortList, _dbClient);
StoragePortAssociationHelper.updatePortAssociations(_updatePortList, _dbClient);
} catch (Exception e) {
_logger.error("Port Discovery failed -->{}", getMessage(e));
} finally {
_newPortList = null;
_updatePortList = null;
}
}
Aggregations