use of javax.cim.UnsignedInteger16 in project coprhd-controller by CoprHD.
the class XIVStoragePortProcessor method createStoragePort.
/**
* create StoragePort Record, if not present already, else update only the
* properties.
*
* @param port
* @param portInstance
* @param profile
* @param isFCPort
* @param transportType
* @param device
*
* @throws URISyntaxException
* @throws IOException
*
* @return StoragePort
*/
private StoragePort createStoragePort(StoragePort port, CIMInstance portInstance, AccessProfile profile, boolean isFCPort, String transportType, StorageSystem device) throws URISyntaxException, IOException {
if (null == port) {
port = new StoragePort();
port.setId(URIUtil.createId(StoragePort.class));
// Ethernet will be updated later in ProtocolEndPoint Processor
if (isFCPort) {
port.setPortNetworkId(WWNUtility.getWWNWithColons(getCIMPropertyValue(portInstance, PORTID)));
_newPortList.add(port);
}
port.setStorageDevice(profile.getSystemId());
String portNativeGuid = NativeGUIDGenerator.generateNativeGuid(_dbClient, port);
port.setNativeGuid(portNativeGuid);
port.setLabel(portNativeGuid);
} else {
if (isFCPort) {
_updatePortList.add(port);
}
}
setPortType(port, portInstance);
port.setTransportType(transportType);
String[] identifiers = getCIMPropertyArrayValue(portInstance, IDENTIFYING_INFO);
String moduleName = null;
if (isFCPort) {
moduleName = identifiers[0];
String portName = getCIMPropertyValue(portInstance, PORTNAME);
port.setPortName(portName);
} else {
moduleName = identifiers[1];
port.setPortName(identifiers[1] + ":" + identifiers[0]);
// port type is not set for ethernet port in SMI
if (port.getPortType().equals(StoragePort.PortType.Unknown.name())) {
port.setPortType(StoragePort.PortType.frontend.name());
}
}
port.setPortGroup(moduleName);
StorageHADomain adapter = getStorageAdapter(moduleName, device);
port.setStorageHADomain(adapter.getId());
port.setCompatibilityStatus(DiscoveredDataObject.CompatibilityStatus.COMPATIBLE.name());
port.setDiscoveryStatus(DiscoveredDataObject.DiscoveryStatus.VISIBLE.name());
UnsignedInteger16[] operationalStatusCodes = (UnsignedInteger16[]) portInstance.getPropertyValue(OPERATIONALSTATUS);
OperationalStatus operationalStatus = StoragePortProcessor.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);
}
port.setOperationalStatus(operationalStatus.name());
String portSpeed = getCIMPropertyValue(portInstance, SPEED);
if (null != portSpeed) {
// SMI returns port speed in bits per sec
Long portSpeedInBitsPerSec = Long.parseLong(portSpeed);
Long portSpeedInGbps = portSpeedInBitsPerSec / GB;
port.setPortSpeed(portSpeedInGbps);
}
return port;
}
use of javax.cim.UnsignedInteger16 in project coprhd-controller by CoprHD.
the class XIVSupportedCopyTypesProcessor 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());
Iterator<CIMInstance> iterator = (Iterator<CIMInstance>) resultObj;
while (iterator.hasNext()) {
CIMInstance instance = iterator.next();
CIMObjectPath poolPath = getObjectPathfromCIMArgument();
String instanceId = poolPath.getKeyValue(Constants.INSTANCEID).toString();
// instanceId is the pool's nativeId
StoragePool storagePool = checkStoragePoolExistsInDB(instanceId, _dbClient, device);
if (storagePool == null) {
_log.warn("No storage pool");
continue;
}
String thinProvisionedPreAllocateSupported = instance.getPropertyValue(Constants.THIN_PROVISIONED_CLIENT_SETTABLE_RESERVE).toString();
UnsignedInteger16[] copyTypes = (UnsignedInteger16[]) instance.getPropertyValue(Constants.SUPPORTED_COPY_TYPES);
addCopyTypesToStoragePool(copyTypes, storagePool, thinProvisionedPreAllocateSupported, poolsToMatchWithVpool);
}
} catch (Exception e) {
_log.error("Supported copy types processing failed: ", e);
}
}
Aggregations