use of javax.cim.UnsignedInteger16 in project coprhd-controller by CoprHD.
the class SmisStorageDevice method doesStorageSystemSupportVolumeExpand.
/**
* This method tests if the array represented by 'storageSystem' supports volume expand.
*
* @param storageSystem
* [IN] - StorageSystem object to check the volume expand capabilities
* @return true iff The array indicates that it supports volume expand.
*/
private boolean doesStorageSystemSupportVolumeExpand(StorageSystem storageSystem) throws WBEMException {
boolean expandSupported = false;
CloseableIterator<CIMInstance> cimInstances = null;
CIMObjectPath storageConfigServicePath = _cimPath.getConfigSvcPath(storageSystem);
try {
cimInstances = _helper.getAssociatorInstances(storageSystem, storageConfigServicePath, null, SmisConstants.EMC_STORAGE_CONFIGURATION_CAPABILITIES, null, null, SmisConstants.PS_SUPPORTED_STORAGE_ELEMENT_FEATURES);
if (cimInstances != null) {
while (cimInstances.hasNext()) {
CIMInstance capabilitiesInstance = cimInstances.next();
UnsignedInteger16[] supportedFeatures = (UnsignedInteger16[]) capabilitiesInstance.getPropertyValue(SmisConstants.CP_SUPPORTED_STORAGE_ELEMENT_FEATURES);
for (UnsignedInteger16 supportedFeatureEntry : supportedFeatures) {
if (supportedFeatureEntry.intValue() == SmisConstants.STORAGE_ELEMENT_CAPACITY_EXPANSION_VALUE) {
expandSupported = true;
return true;
}
}
}
}
} finally {
if (cimInstances != null) {
cimInstances.close();
}
_log.info(String.format("StorageSystem %s %s volume expand", storageSystem.getNativeGuid(), (expandSupported) ? "supports" : "does not support"));
}
return false;
}
use of javax.cim.UnsignedInteger16 in project coprhd-controller by CoprHD.
the class SmisAbstractCreateVolumeJob method processVolume.
/**
* Processes a newly created volume.
*
* @param jobContext The job context.
* @param volumePath The CIM object path for the volume.
* @param nativeID The native volume identifier.
* @param volumeId The Bourne volume id.
* @param client The CIM client.
* @param dbClient the database client.
* @param logMsgBuilder Holds a log message.
* @param creationTime Holds the date-time for the volume creation
* @throws java.io.IOException When an error occurs querying the database.
* @throws WorkflowException
*/
private void processVolume(JobContext jobContext, CIMObjectPath volumePath, String nativeID, URI volumeId, WBEMClient client, DbClient dbClient, StringBuilder logMsgBuilder, Calendar creationTime) throws Exception, IOException, DeviceControllerException, WBEMException {
Volume volume = dbClient.queryObject(Volume.class, volumeId);
// Honor that the job failed and do not commit the volume, which would make it active again.
if (volume.getInactive()) {
if (logMsgBuilder.length() != 0) {
logMsgBuilder.append("\n");
}
logMsgBuilder.append(String.format("Create volume job failed and volume set to inactive. Volume was likely created successfully and will be left on the array for ingestion. NativeId: %s, URI: %s", nativeID, getTaskCompleter().getId()));
return;
}
CIMInstance volumeInstance = commonVolumeUpdate(dbClient, client, volume, volumePath);
URI storageSystemURI = volume.getStorageController();
StorageSystem storageSystem = dbClient.queryObject(StorageSystem.class, storageSystemURI);
if (volume.getIsComposite() && _cimPath != null) {
// need to set meta volume member size (required for volume expansion).
// this call is context dependent --- this is why we check for cimPath be set.
// first, get meta members list;
// second, get second member and get its size (the first member is a head and it will show size of meta
// volume itself);
// third, set this size as meta volume size in vipr volume
ArrayList<CIMArgument> list = new ArrayList<CIMArgument>();
CIMArgument<CIMObjectPath> volumeReference = new CIMArgument<CIMObjectPath>(SmisConstants.CP_THE_ELEMENT, CIMDataType.getDataType(volumePath), volumePath);
// set request type to "children"
CIMArgument<UnsignedInteger16> requestType = new CIMArgument<UnsignedInteger16>("RequestType", CIMDataType.UINT16_T, new UnsignedInteger16(2));
list.add(volumeReference);
list.add(requestType);
CIMArgument[] inArgs = {};
inArgs = list.toArray(inArgs);
CIMArgument[] outArgs = new CIMArgument[5];
CIMObjectPath elementCompositionServicePath = _cimPath.getElementCompositionSvcPath(storageSystem);
SmisCommandHelper helper = jobContext.getSmisCommandHelper();
StorageSystem forProvider = helper.getStorageSystemForProvider(storageSystem, volume);
helper.invokeMethod(forProvider, elementCompositionServicePath, "GetCompositeElements", inArgs, outArgs);
// get member volumes from output
CIMObjectPath[] metaMembersPaths = (CIMObjectPath[]) _cimPath.getFromOutputArgs(outArgs, "OutElements");
// get meta member size. use second member --- the first member will show size of meta volume itself.
CIMObjectPath metaMemberPath = metaMembersPaths[1];
CIMInstance cimVolume = helper.getInstance(forProvider, metaMemberPath, false, false, new String[] { SmisConstants.CP_CONSUMABLE_BLOCKS, SmisConstants.CP_BLOCK_SIZE });
CIMProperty consumableBlocks = cimVolume.getProperty(SmisConstants.CP_CONSUMABLE_BLOCKS);
CIMProperty blockSize = cimVolume.getProperty(SmisConstants.CP_BLOCK_SIZE);
// calculate size = consumableBlocks * block size
Long size = Long.valueOf(consumableBlocks.getValue().toString()) * Long.valueOf(blockSize.getValue().toString());
// set member size for meta volume (required for volume expansion)
volume.setMetaMemberSize(size);
_log.info(String.format("Meta member info: blocks --- %s, block size --- %s, size --- %s .", consumableBlocks.getValue().toString(), blockSize.getValue().toString(), size));
}
specificProcessing(storageSystem, dbClient, client, volume, volumeInstance, volumePath);
dbClient.updateObject(volume);
if (logMsgBuilder.length() != 0) {
logMsgBuilder.append("\n");
}
logMsgBuilder.append(String.format("Created volume successfully .. NativeId: %s, URI: %s", nativeID, getTaskCompleter().getId()));
}
use of javax.cim.UnsignedInteger16 in project coprhd-controller by CoprHD.
the class StoragePortProcessor method createStoragePort.
/**
* create StoragePort Record, if not present already, else update only the properties.
*
* @param port
* @param portInstance
* @throws URISyntaxException
* @throws IOException
*/
private StoragePort createStoragePort(StoragePort port, CIMInstance portInstance, AccessProfile profile, StorageHADomain haDomain, boolean flag, String transportType, StorageSystem device) throws URISyntaxException, IOException {
boolean newPort = false;
if (null == port) {
newPort = true;
port = new StoragePort();
port.setId(URIUtil.createId(StoragePort.class));
// or ethernet will be updated later in ProtocolEndPoint Processor
if (flag) {
port.setPortNetworkId(WWNUtility.getWWNWithColons(getCIMPropertyValue(portInstance, PORTID)));
}
port.setStorageDevice(profile.getSystemId());
String portNativeGuid = NativeGUIDGenerator.generateNativeGuid(_dbClient, port);
port.setNativeGuid(portNativeGuid);
port.setLabel(portNativeGuid);
port.setPortGroup(haDomain.getAdapterName());
port.setStorageHADomain(haDomain.getId());
}
setPortType(port, portInstance);
port.setTransportType(transportType);
port.setPortName(getCIMPropertyValue(portInstance, PORTNAME));
port.setCompatibilityStatus(DiscoveredDataObject.CompatibilityStatus.COMPATIBLE.name());
port.setDiscoveryStatus(DiscoveredDataObject.DiscoveryStatus.VISIBLE.name());
UnsignedInteger16[] operationalStatusCodes = (UnsignedInteger16[]) portInstance.getPropertyValue(OPERATIONALSTATUS);
OperationalStatus operationalStatus = getPortOperationalStatus(operationalStatusCodes);
if (OperationalStatus.NOT_OK.equals(operationalStatus)) {
_logger.info("StoragePort {} operationalStatus is NOT_OK. operationalStatusCodes collected from SMI-S :{}", port.getId(), operationalStatusCodes);
} else {
_logger.debug("operationalStatusCodes :{}", operationalStatusCodes);
// there can be multiple statuses. {OK, Online}, {OK, Stopped}
if (operationalStatusCodes != null && operationalStatusCodes.length > 1 && Arrays.asList(operationalStatusCodes).contains(stopped_code)) {
_logger.info("StoragePort {} operational status is {OK, Stopped}. operationalStatusCodes :{}", port.getId(), operationalStatusCodes);
}
}
port.setOperationalStatus(operationalStatus.name());
String portSpeed = getCIMPropertyValue(portInstance, SPEED);
if (null != portSpeed) {
// SMI returns port speed in bits per sec ?? Is this always true?
Long portSpeedInBitsPerSec = Long.parseLong(portSpeed);
Long portSpeedInGbps = portSpeedInBitsPerSec / GB;
port.setPortSpeed(portSpeedInGbps);
}
if (FRONTEND_PORT.equalsIgnoreCase(getCIMPropertyValue(portInstance, USAGERESTRICTION))) {
setCompatibilityByACLXFlag(device, portInstance, port);
}
if (flag) {
if (newPort) {
_logger.info("Creating port - {}:{}", port.getLabel(), port.getNativeGuid());
_newPortList.add(port);
} else {
_logger.info("Updating port - {}:{}", port.getLabel(), port.getNativeGuid());
_updatePortList.add(port);
}
}
;
return port;
}
use of javax.cim.UnsignedInteger16 in project coprhd-controller by CoprHD.
the class SupportedAsynchronousActionsProcessor method addSupportedAsynchronousActionsToStorageSystem.
private void addSupportedAsynchronousActionsToStorageSystem(UnsignedInteger16[] supportedAsyncActions, StorageSystem device) {
StringSet set = new StringSet();
if (supportedAsyncActions != null) {
for (UnsignedInteger16 actionValue : supportedAsyncActions) {
switch(actionValue.intValue()) {
case Constants.CREATE_ELEMENT_REPLICA_ASYNC_ACTION:
set.add(StorageSystem.AsyncActions.CreateElementReplica.name());
break;
case Constants.CREATE_GROUP_REPLICA_ASYNC_ACTION:
set.add(StorageSystem.AsyncActions.CreateGroupReplica.name());
break;
default:
_log.warn("Encountered unknown supported asynchronous action {} for StorageSystem {}", actionValue.intValue(), device.getId());
}
}
}
device.setSupportedAsynchronousActions(set);
_dbClient.persistObject(device);
}
use of javax.cim.UnsignedInteger16 in project coprhd-controller by CoprHD.
the class SupportedCopyTypesProcessor method processResult.
@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException {
try {
_dbClient = (DbClient) keyMap.get(Constants.dbClient);
AccessProfile profile = (AccessProfile) keyMap.get(Constants.ACCESSPROFILE);
Map<URI, StoragePool> poolsToMatchWithVpool = (Map<URI, StoragePool>) keyMap.get(Constants.MODIFIED_STORAGEPOOLS);
StorageSystem device = getStorageSystem(_dbClient, profile.getSystemId());
boolean isVmax3 = device.checkIfVmax3();
Iterator<CIMInstance> iterator = (Iterator<CIMInstance>) resultObj;
while (iterator.hasNext()) {
CIMInstance instance = iterator.next();
String instanceID = getCIMPropertyValue(instance, Constants.INSTANCEID);
String thinProvisionedPreAllocateSupported = Boolean.FALSE.toString();
if (!isVmax3) {
thinProvisionedPreAllocateSupported = instance.getPropertyValue(Constants.THIN_PROVISIONED_CLIENT_SETTABLE_RESERVE).toString();
} else {
thinProvisionedPreAllocateSupported = Boolean.TRUE.toString();
}
UnsignedInteger16[] copyTypes = (UnsignedInteger16[]) instance.getPropertyValue(Constants.SUPPORTED_COPY_TYPES);
String nativeID = getNativeIDFromInstance(instanceID);
StoragePool storagePool = checkStoragePoolExistsInDB(nativeID, _dbClient, device);
if (storagePool == null) {
_log.warn("No storage pool");
continue;
}
addCopyTypesToStoragePool(copyTypes, storagePool, thinProvisionedPreAllocateSupported, poolsToMatchWithVpool);
}
} catch (Exception e) {
_log.error("Supported copy types processing failed", e);
}
}
Aggregations