use of javax.cim.CIMProperty in project coprhd-controller by CoprHD.
the class SmisCommandHelper method getReplicationSettingDataInstance.
public CIMInstance getReplicationSettingDataInstance(final StorageSystem sourceSystem) {
CIMInstance modifiedInstance = null;
try {
CIMObjectPath replicationSettingCapabilities = _cimPath.getReplicationServiceCapabilitiesPath(sourceSystem);
CIMArgument[] inArgs = getReplicationSettingDataInstance();
CIMArgument[] outArgs = new CIMArgument[5];
invokeMethod(sourceSystem, replicationSettingCapabilities, "GetDefaultReplicationSettingData", inArgs, outArgs);
for (CIMArgument<?> outArg : outArgs) {
if (null == outArg) {
continue;
}
if (outArg.getName().equalsIgnoreCase(DEFAULT_INSTANCE)) {
CIMInstance repInstance = (CIMInstance) outArg.getValue();
if (null != repInstance) {
CIMProperty<?> existingProp = repInstance.getProperty(EMC_CONSISTENCY_EXEMPT);
CIMProperty<?> prop = null;
if (existingProp == null) {
// ConsistencyExempt property is now part of the smi-s standard. Available in providers 8.0+
// (VMAX3 arrays)
// EMCConsistencyExempt property in ReplicationSettingData is removed
existingProp = repInstance.getProperty(CONSISTENCY_EXEMPT);
prop = new CIMProperty<Object>(CONSISTENCY_EXEMPT, existingProp.getDataType(), true);
} else {
prop = new CIMProperty<Object>(EMC_CONSISTENCY_EXEMPT, existingProp.getDataType(), true);
}
CIMProperty<?>[] propArray = new CIMProperty<?>[] { prop };
modifiedInstance = repInstance.deriveInstance(propArray);
break;
}
}
}
} catch (Exception e) {
_log.error("Error retrieving Replication Setting Data Instance ", e);
}
return modifiedInstance;
}
use of javax.cim.CIMProperty in project coprhd-controller by CoprHD.
the class SmisCommandHelper method getCreateVolumesInputArgumentsasList40.
public List<CIMArgument> getCreateVolumesInputArgumentsasList40(StorageSystem storageDevice, StoragePool pool, String label, Long capacity, int count, boolean isThinlyProvisioned) {
ArrayList<CIMArgument> list = new ArrayList<>();
try {
CIMProperty[] inPoolPropKeys = { _cimProperty.string(CP_INSTANCE_ID, _cimPath.getPoolName(storageDevice, pool.getNativeId())) };
CIMObjectPath inPoolPath = CimObjectPathCreator.createInstance(pool.getPoolClassName(), _cimConnection.getNamespace(storageDevice), inPoolPropKeys);
if (!storageDevice.checkIfVmax3()) {
// Use thick/thin volume type
int volumeType = isThinlyProvisioned ? STORAGE_VOLUME_TYPE_THIN : STORAGE_VOLUME_VALUE;
list.add(_cimArgument.uint16(CP_ELEMENT_TYPE, volumeType));
}
// Adding Goal parameter if volumes need to be FAST Enabled
list.add(_cimArgument.reference(CP_IN_POOL, inPoolPath));
list.add(_cimArgument.uint64(CP_SIZE, capacity));
list.add(_cimArgument.uint32(CP_EMC_NUMBER_OF_DEVICES, count));
if (label != null) {
list.add(_cimArgument.string(CP_ELEMENT_NAME, label));
}
} catch (Exception e) {
throw new IllegalStateException("Problem getting input arguments: " + storageDevice.getSerialNumber());
}
return list;
}
use of javax.cim.CIMProperty in project coprhd-controller by CoprHD.
the class SmisCommandHelper method getCreateVolumesInputArgumentsasList80.
public List<CIMArgument> getCreateVolumesInputArgumentsasList80(StorageSystem storageDevice, StoragePool pool, List<String> labels, Long capacity, int count, boolean isThinlyProvisioned) {
ArrayList<CIMArgument> list = new ArrayList<>();
try {
CIMProperty[] inPoolPropKeys = { _cimProperty.string(CP_INSTANCE_ID, _cimPath.getPoolName(storageDevice, pool.getNativeId())) };
CIMObjectPath inPoolPath = CimObjectPathCreator.createInstance(pool.getPoolClassName(), _cimConnection.getNamespace(storageDevice), inPoolPropKeys);
// Use thick/thin volume type
Integer volumeType = isThinlyProvisioned ? STORAGE_VOLUME_TYPE_THIN : STORAGE_VOLUME_VALUE;
// Create array values
// Adding Goal parameter if volumes need to be FAST Enabled
list.add(_cimArgument.referenceArray(CP_IN_POOL, toMultiElementArray(count, inPoolPath)));
list.add(_cimArgument.uint64Array(CP_SIZE, toMultiElementArray(count, new UnsignedInteger64(Long.toString(capacity)))));
list.add(_cimArgument.uint32Array(CP_EMC_NUMBER_OF_DEVICE_FOR_EACH_CONFIG, toMultiElementArray(count, SINGLE_DEVICE_FOR_EACH_CONFIG)));
if (labels != null) {
// Convert labels to array
String[] labelsArray = labels.toArray(new String[] {});
list.add(_cimArgument.stringArray(CP_ELEMENT_NAMES, labelsArray));
}
// Add CIMArgument instances to the list
if (!storageDevice.checkIfVmax3()) {
list.add(_cimArgument.uint16Array(CP_ELEMENT_TYPE, toMultiElementArray(count, new UnsignedInteger16(volumeType))));
}
} catch (Exception e) {
throw new IllegalStateException("Problem getting input arguments: " + storageDevice.getSerialNumber());
}
return list;
}
use of javax.cim.CIMProperty in project coprhd-controller by CoprHD.
the class SmisCommandHelper method deleteParkingSLOStorageGroupsIfEmpty.
/**
* This is a distributed process protected operation that checks each CIMInstance in
* the 'parkingSLOStorageGroups' set to see if it has no volumes associated it.
* If so, it will be deleted.
*
* @param storage
* [in] - StorageSystem object against which the StorageGroups belong
* @param _locker
* [in] - Locking service to protect access across
* @param parkingSLOStorageGroups
* [in] - Set of SE_DeviceMaskingGroup CIMInstance objects
* @throws Exception if there is a issue in deleting ParikingSLOStorageGroup
*/
public void deleteParkingSLOStorageGroupsIfEmpty(StorageSystem storage, Set<CIMInstance> parkingSLOStorageGroups) throws Exception {
String currentHeldLockName = null;
CloseableIterator<CIMObjectPath> volumeIterator = null;
try {
for (CIMInstance seDeviceMaskingInstance : parkingSLOStorageGroups) {
CIMProperty elementNameProperty = seDeviceMaskingInstance.getProperty(SmisConstants.CP_ELEMENT_NAME);
String groupName = elementNameProperty.getValue().toString();
String lockName = generateParkingSLOSGLockName(storage, groupName);
// Get the lock for this StorageGroup and process it
if (_locker.acquireLock(lockName, PARKING_SLO_SG_LOCK_WAIT_SECS)) {
currentHeldLockName = lockName;
volumeIterator = getAssociatorNames(storage, seDeviceMaskingInstance.getObjectPath(), null, CIM_STORAGE_VOLUME, null, null);
if (volumeIterator != null && !volumeIterator.hasNext()) {
// There are no volume paths associated to this DeviceMaskingGroup, so we can delete it now.
deleteMaskingGroup(storage, groupName, MASKING_GROUP_TYPE.SE_DeviceMaskingGroup);
volumeIterator.close();
volumeIterator = null;
}
_locker.releaseLock(lockName);
currentHeldLockName = null;
} else {
currentHeldLockName = null;
_log.warn(String.format("Could not get lock %s while trying to deleteParkingSLOStorageGroupsIfEmpty", lockName));
throw DeviceControllerException.exceptions.failedToAcquireLock(lockName, "deleteParkingSLOStorageGroupsIfEmpty");
}
}
// Refresh the SMI-S provider to make sure that any other clients of SMI-S have the current
// state of the changes on the array after we've processed all the StorageGroups.
callRefreshSystem(storage, null);
} catch (Exception e) {
_log.error("An exception while processing deleteParkingSLOStorageGroupsIfEmpty", e);
throw e;
} finally {
// Cleanup any iterator that may have been open but not yet closed
if (volumeIterator != null) {
volumeIterator.close();
}
// In case of some failure, release any lock that might have been acquired
if (currentHeldLockName != null) {
_locker.releaseLock(currentHeldLockName);
}
}
}
use of javax.cim.CIMProperty in project coprhd-controller by CoprHD.
the class SmisCommandHelper method getCreateMetaVolumeMembersInputArguments.
public CIMArgument[] getCreateMetaVolumeMembersInputArguments(StorageSystem storageDevice, StoragePool pool, int count, Long capacity, boolean isThinlyProvisioned) {
ArrayList<CIMArgument> list = new ArrayList<CIMArgument>();
try {
CIMProperty[] inPoolPropKeys = { _cimProperty.string(CP_INSTANCE_ID, _cimPath.getPoolName(storageDevice, pool.getNativeId())) };
CIMObjectPath inPoolPath = CimObjectPathCreator.createInstance(pool.getPoolClassName(), _cimConnection.getNamespace(storageDevice), inPoolPropKeys);
// Use thick/thin volume type
int volumeType = isThinlyProvisioned ? STORAGE_VOLUME_TYPE_THIN : STORAGE_VOLUME_VALUE;
list.add(_cimArgument.uint16(CP_ELEMENT_TYPE, volumeType));
// do not bind thin members (SMI-S requires thin members to be unbound)
if (volumeType == STORAGE_VOLUME_TYPE_THIN) {
list.add(_cimArgument.bool(CP_EMC_BIND_ELEMENTS, false));
}
list.add(_cimArgument.reference(CP_IN_POOL, inPoolPath));
list.add(_cimArgument.uint64(CP_SIZE, capacity));
list.add(_cimArgument.uint32(CP_EMC_NUMBER_OF_DEVICES, count));
} catch (Exception e) {
throw new IllegalStateException("Problem getting input arguments: " + storageDevice.getSerialNumber());
}
CIMArgument[] result = {};
result = list.toArray(result);
return result;
}
Aggregations