// For VMAX V3 only for now public CIMInstance getDefaultReplicationSettingData(StorageSystem storage) throws WBEMException { CIMInstance defaultInstance = null; CloseableIterator<CIMInstance> repSvcCapIter = null; try { repSvcCapIter = _helper.getAssociatorInstances( storage, _cimPath.getControllerReplicationSvcPath(storage), null, _cimPath.prefixWithParamName(SmisConstants.REPLICATION_SERVICE_CAPABILTIES), null, null, null); if (repSvcCapIter != null && repSvcCapIter.hasNext()) { CIMInstance instance = repSvcCapIter.next(); CIMArgument[] in = _helper.getDefaultReplicationSettingDataInputArgumentsForLocalMirror(); CIMArgument[] out = new CIMArgument[5]; _helper.invokeMethod( storage, instance.getObjectPath(), SmisConstants.GET_DEFAULT_REPLICATION_SETTING_DATA, in, out); defaultInstance = (CIMInstance) _cimPath.getFromOutputArgs(out, SmisConstants.DEFAULT_INSTANCE); } } finally { if (repSvcCapIter != null) { repSvcCapIter.close(); } } return defaultInstance; }
/** * Include only Unified,Virtual [Thin] and Device Storage Pools (Thick Pool) * * @param poolInstance * @return String [] array of pool class name (as a first element) and supported volume types (as * a second element) */ private String[] determinePoolClassNameAndSupportedVolumeTypes( CIMInstance poolInstance, StorageSystem system) { if (StoragePool.PoolClassNames.Clar_DeviceStoragePool.toString() .equalsIgnoreCase(poolInstance.getClassName())) { return new String[] { StoragePool.PoolClassNames.Clar_DeviceStoragePool.toString(), StoragePool.SupportedResourceTypes.THICK_ONLY.toString() }; } else if (StoragePool.PoolClassNames.Clar_UnifiedStoragePool.toString() .equalsIgnoreCase(poolInstance.getClassName())) { return new String[] { StoragePool.PoolClassNames.Clar_UnifiedStoragePool.toString(), StoragePool.SupportedResourceTypes.THIN_AND_THICK.toString() }; } if (!system.checkIfVmax3()) { if (StoragePool.PoolClassNames.Symm_DeviceStoragePool.toString() .equalsIgnoreCase(poolInstance.getClassName()) && !SupportedProvisioningTypes.THIN .toString() .equalsIgnoreCase(system.getSupportedProvisioningType())) { return new String[] { StoragePool.PoolClassNames.Symm_DeviceStoragePool.toString(), StoragePool.SupportedResourceTypes.THICK_ONLY.toString() }; } else if (StoragePool.PoolClassNames.Symm_VirtualProvisioningPool.toString() .equalsIgnoreCase(poolInstance.getClassName()) && !SupportedProvisioningTypes.THICK .toString() .equalsIgnoreCase(system.getSupportedProvisioningType())) { return new String[] { StoragePool.PoolClassNames.Symm_VirtualProvisioningPool.toString(), StoragePool.SupportedResourceTypes.THIN_ONLY.toString() }; } } else { // VMAX3 has StorageResourcePools (SRP). These are composed of ThinPools, which we can // discover, but would not have write access to. So, we will only discovery SRP pools // and skip over other pool discoveries. if (StoragePool.PoolClassNames.Symm_SRPStoragePool.toString() .equalsIgnoreCase(poolInstance.getClassName())) { return new String[] { StoragePool.PoolClassNames.Symm_SRPStoragePool.toString(), StoragePool.SupportedResourceTypes.THIN_ONLY.toString() }; } } return null; }
private String[] getVMAX3PoolDriveTypes(StorageSystem storageDevice, CIMInstance poolInstance) { Set<String> driveTypes = new HashSet<String>(); CloseableIterator<CIMInstance> virtualProvisioningPoolItr = null; _logger.info( "Trying to get all VirtualProvisioningPools for storage pool {}", poolInstance.getProperty(SmisConstants.CP_INSTANCE_ID).toString()); CIMObjectPath poolPath = poolInstance.getObjectPath(); try { virtualProvisioningPoolItr = getAssociatorInstances( poolPath, null, SmisConstants.SYMM_VIRTUAL_PROVISIONING_POOL, null, null, SmisConstants.PS_V3_VIRTUAL_PROVISIONING_POOL_PROPERTIES); while (virtualProvisioningPoolItr != null && virtualProvisioningPoolItr.hasNext()) { CIMInstance virtualProvisioningPoolInstance = virtualProvisioningPoolItr.next(); String diskDriveType = CIMPropertyFactory.getPropertyValue( virtualProvisioningPoolInstance, SmisConstants.CP_DISK_DRIVE_TYPE); if (diskDriveType != null) { driveTypes.add(diskDriveType); } } } catch (WBEMException e) { _logger.error("Error getting VirtualProvisioningPools", e); } finally { if (virtualProvisioningPoolItr != null) { virtualProvisioningPoolItr.close(); } } String[] driveTypesArr = driveTypes.toArray(new String[driveTypes.size()]); return driveTypesArr; }
/* * determine Operational Status of Pool * READY , if any of the status Value is 2 (OK). * otherwise NOTREADY */ private String determineOperationalStatus(CIMInstance poolInstance) { String operationalStatus = StoragePool.PoolOperationalStatus.NOTREADY.toString(); try { UnsignedInteger16[] opStatus = (UnsignedInteger16[]) poolInstance.getPropertyValue(OPERATIONAL_STATUS); for (UnsignedInteger16 status : opStatus) { if (status.compareTo(new UnsignedInteger16(TWO)) == 0) { operationalStatus = StoragePool.PoolOperationalStatus.READY.toString(); } } } catch (Exception ex) { _logger.error( "Discovering Pool Operational Status failed : {}-->", getCIMPropertyValue(poolInstance, Constants.INSTANCEID), ex); } return operationalStatus; }
private void setCompatibilityByACLXFlag( StorageSystem storageSystem, CIMInstance portInstance, StoragePort port) { Object portAttributesValue = portInstance.getPropertyValue(EMC_PORT_ATTRIBUTES); if (portAttributesValue != null && storageSystem.checkIfVmax3()) { boolean foundACLXFlag = false; UnsignedInteger16[] portAttributes = (UnsignedInteger16[]) portAttributesValue; for (UnsignedInteger16 portAttribute : portAttributes) { if (portAttribute.equals(EMC_PORT_ATTRIBUTE_ACLX_FLAG)) { foundACLXFlag = true; break; } } String compatibilityStatus = (foundACLXFlag) ? DiscoveredDataObject.CompatibilityStatus.COMPATIBLE.name() : DiscoveredDataObject.CompatibilityStatus.INCOMPATIBLE.name(); _logger.info( String.format( "setCompatibilityByACLXFlag(%s) = %s", port.getNativeGuid(), compatibilityStatus)); port.setCompatibilityStatus(compatibilityStatus); } }
private void setStorageAdapterReference( StoragePort port, CIMInstance portInstance, StorageSystem device) { String adapterName = null; try { adapterName = portInstance.getObjectPath().getKey(SYSTEMNAME).getValue().toString(); Iterable<String> adapterItr = Splitter.on(Constants.PATH_DELIMITER_PATTERN).limit(3).split(adapterName); URIQueryResultList result = new URIQueryResultList(); _dbClient.queryByConstraint( AlternateIdConstraint.Factory.getStorageHADomainByNativeGuidConstraint( NativeGUIDGenerator.generateNativeGuid( device, Iterables.getLast(adapterItr), NativeGUIDGenerator.ADAPTER)), result); if (result.iterator().hasNext()) { URI portGroup = result.iterator().next(); port.setStorageHADomain(portGroup); StorageHADomain haDomain = _dbClient.queryObject(StorageHADomain.class, portGroup); port.setPortGroup(haDomain.getAdapterName()); } } catch (Exception e) { _logger.warn("Storage Port not found : {}", adapterName); } }
/** {@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); CoordinatorClient coordinator = (CoordinatorClient) keyMap.get(Constants.COORDINATOR_CLIENT); Map<URI, StoragePool> poolsToMatchWithVpool = (Map<URI, StoragePool>) keyMap.get(Constants.MODIFIED_STORAGEPOOLS); Set<URI> systemsToRunRPConnectivity = (HashSet<URI>) keyMap.get(Constants.SYSTEMS_RUN_RP_CONNECTIVITY); StorageSystem device = _dbClient.queryObject(StorageSystem.class, profile.getSystemId()); CIMObjectPath storageAdapterPath = getObjectPathfromCIMArgument(args); Iterable<String> adapterItr = Splitter.on(Constants.PATH_DELIMITER_PATTERN) .limit(3) .split(storageAdapterPath.getKey(Constants.NAME).getValue().toString()); String adapterNativeGuid = NativeGUIDGenerator.generateNativeGuid( device, Iterables.getLast(adapterItr), NativeGUIDGenerator.ADAPTER); StorageHADomain haDomain = getStorageAdapter(_dbClient, adapterNativeGuid); if (null == haDomain) { _logger.info("Adapter Not found"); return; } while (it.hasNext()) { CIMInstance portInstance = null; StoragePort port = null; try { portInstance = it.next(); // skip back end ports other than RDF Ports if (!HADomainType.REMOTE.name().equalsIgnoreCase(haDomain.getAdapterType()) && "3".equalsIgnoreCase(getCIMPropertyValue(portInstance, USAGERESTRICTION))) { continue; } // only if its an EthernetPort, as protocolEnd point needs // to run only for Ethernet // Ports , because SCSI address we don't have it in // CIM_LogicalPort Class // 2 - Ethernet Port 4 - FC Port if ("2".equalsIgnoreCase(getCIMPropertyValue(portInstance, LINKTECHNOLOGY))) { port = createStoragePort(null, portInstance, profile, haDomain, false, IP, device); checkProtocolAlreadyExists(protocols, ISCSI); String deviceId = getCIMPropertyValue(portInstance, DEVICEID); /* * For SMI-S 8.x, While getting the iSCSI Port details, we use SystemName property * (Ex. SYMMETRIX-+-<<SERIAL>>-+-SE-1G-+-0) * Where this call just add the deviceId to the KeyMap (i.e SE-1G-+-0). * Hence manually constructing the key. */ if (device.getUsingSmis80()) { String systemName = getCIMPropertyValue(portInstance, SYSTEM_NAME); StringBuffer deviceIdStrBuf = new StringBuffer(systemName); deviceIdStrBuf.append(Constants.SMIS80_DELIMITER).append(deviceId); deviceId = deviceIdStrBuf.toString(); } _logger.debug("Adding iSCSI Port instance {} to keyMap", deviceId); keyMap.put(deviceId, port); addPath(keyMap, operation.getResult(), portInstance.getObjectPath()); } else if ("4".equalsIgnoreCase(getCIMPropertyValue(portInstance, LINKTECHNOLOGY))) { port = checkStoragePortExistsInDB(portInstance, device, _dbClient); checkProtocolAlreadyExists(protocols, FC); createStoragePort(port, portInstance, profile, haDomain, true, FC, device); } 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); } } // Systems used to run RP connectivity later after runing pool matcher systemsToRunRPConnectivity.addAll( StoragePoolAssociationHelper.getStorageSytemsFromPorts(_newPortList, null)); systemsToRunRPConnectivity.addAll( StoragePoolAssociationHelper.getStorageSytemsFromPorts(_updatePortList, null)); // 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); _logger.debug( "# Pools used in invoking PoolMatcher during StoragePortProcessor {}", Joiner.on("\t").join(poolsToMatchWithVpool.keySet())); } catch (Exception e) { _logger.error("Port Discovery failed -->{}", getMessage(e)); } finally { _newPortList = null; _updatePortList = null; } }
/** * 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)); // if true, then its FC Port or else its Ethernet, PORTID // 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); } 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; }
/** * create StorageVolume Info Object * * @param unManagedVolume * @param volumeInstance * @param unManagedVolumeNativeGuid * @param pool * @return */ private UnManagedVolume createUnManagedVolume( UnManagedVolume unManagedVolume, CIMInstance volumeInstance, String unManagedVolumeNativeGuid, StoragePool pool, StorageSystem system, String volumeNativeGuid, // to make the code uniform, passed in all the below sets as // arguments Map<String, VolHostIOObject> exportedVolumes, Set<String> existingVolumesInCG, Map<String, RemoteMirrorObject> volumeToRAGroupMap, Map<String, LocalReplicaObject> volumeToLocalReplicaMap, Set<String> poolSupportedSLONames, Map<String, Object> keyMap) { _logger.info("Process UnManagedVolume {}", unManagedVolumeNativeGuid); try { boolean created = false; if (null == unManagedVolume) { unManagedVolume = new UnManagedVolume(); unManagedVolume.setId(URIUtil.createId(UnManagedVolume.class)); unManagedVolume.setNativeGuid(unManagedVolumeNativeGuid); unManagedVolume.setStorageSystemUri(system.getId()); created = true; } // reset the auto-tiering info for unmanaged volumes already present // in db // so that the tiering info is updated correctly later if (!created) { unManagedVolume .getVolumeInformation() .put(SupportedVolumeInformation.AUTO_TIERING_POLICIES.toString(), ""); unManagedVolume.putVolumeCharacterstics( SupportedVolumeCharacterstics.IS_AUTO_TIERING_ENABLED.toString(), "false"); // reset local replica info unManagedVolume.putVolumeCharacterstics( SupportedVolumeCharacterstics.IS_FULL_COPY.name(), FALSE); unManagedVolume.putVolumeCharacterstics( SupportedVolumeCharacterstics.IS_LOCAL_MIRROR.name(), FALSE); unManagedVolume.putVolumeCharacterstics( SupportedVolumeCharacterstics.IS_SNAP_SHOT.name(), FALSE); unManagedVolume.putVolumeCharacterstics( SupportedVolumeCharacterstics.HAS_REPLICAS.name(), FALSE); unManagedVolume .getVolumeInformation() .put(SupportedVolumeInformation.REPLICA_STATE.name(), new StringSet()); unManagedVolume .getVolumeInformation() .put(SupportedVolumeInformation.LOCAL_REPLICA_SOURCE_VOLUME.name(), new StringSet()); unManagedVolume .getVolumeInformation() .put(SupportedVolumeInformation.SYNC_STATE.name(), new StringSet()); unManagedVolume .getVolumeInformation() .put(SupportedVolumeInformation.SYNC_TYPE.name(), new StringSet()); unManagedVolume .getVolumeInformation() .put(SupportedVolumeInformation.SYNCHRONIZED_INSTANCE.name(), new StringSet()); unManagedVolume .getVolumeInformation() .put(SupportedVolumeInformation.IS_SYNC_ACTIVE.name(), new StringSet()); unManagedVolume .getVolumeInformation() .put(SupportedVolumeInformation.NEEDS_COPY_TO_TARGET.name(), new StringSet()); unManagedVolume .getVolumeInformation() .put(SupportedVolumeInformation.TECHNOLOGY_TYPE.name(), new StringSet()); unManagedVolume .getVolumeInformation() .put(SupportedVolumeInformation.SETTINGS_INSTANCE.name(), new StringSet()); unManagedVolume .getVolumeInformation() .put(SupportedVolumeInformation.FULL_COPIES.name(), new StringSet()); unManagedVolume .getVolumeInformation() .put(SupportedVolumeInformation.MIRRORS.name(), new StringSet()); unManagedVolume .getVolumeInformation() .put(SupportedVolumeInformation.SNAPSHOTS.name(), new StringSet()); } Map<String, StringSet> unManagedVolumeInformation = new HashMap<String, StringSet>(); Map<String, String> unManagedVolumeCharacteristics = new HashMap<String, String>(); if (null != system) { StringSet systemTypes = new StringSet(); systemTypes.add(system.getSystemType()); unManagedVolumeInformation.put( SupportedVolumeInformation.SYSTEM_TYPE.toString(), systemTypes); } if (exportedVolumes != null && exportedVolumes.containsKey(volumeNativeGuid)) { VolHostIOObject obj = exportedVolumes.get(volumeNativeGuid); if (null != obj) { StringSet bwValues = new StringSet(); bwValues.add(obj.getHostIoBw()); if (unManagedVolumeInformation.get( SupportedVolumeInformation.EMC_MAXIMUM_IO_BANDWIDTH.toString()) == null) { unManagedVolumeInformation.put( SupportedVolumeInformation.EMC_MAXIMUM_IO_BANDWIDTH.toString(), bwValues); } else { unManagedVolumeInformation .get(SupportedVolumeInformation.EMC_MAXIMUM_IO_BANDWIDTH.toString()) .replace(bwValues); } StringSet iopsVal = new StringSet(); iopsVal.add(obj.getHostIops()); if (unManagedVolumeInformation.get(SupportedVolumeInformation.EMC_MAXIMUM_IOPS.toString()) == null) { unManagedVolumeInformation.put( SupportedVolumeInformation.EMC_MAXIMUM_IOPS.toString(), iopsVal); } else { unManagedVolumeInformation .get(SupportedVolumeInformation.EMC_MAXIMUM_IOPS.toString()) .replace(iopsVal); } } unManagedVolumeCharacteristics.put( SupportedVolumeCharacterstics.IS_VOLUME_EXPORTED.toString(), TRUE); } else { unManagedVolumeCharacteristics.put( SupportedVolumeCharacterstics.IS_VOLUME_EXPORTED.toString(), FALSE); StringSet bwValues = new StringSet(); bwValues.add("0"); if (unManagedVolumeInformation.get( SupportedVolumeInformation.EMC_MAXIMUM_IO_BANDWIDTH.toString()) == null) { unManagedVolumeInformation.put( SupportedVolumeInformation.EMC_MAXIMUM_IO_BANDWIDTH.toString(), bwValues); } else { unManagedVolumeInformation .get(SupportedVolumeInformation.EMC_MAXIMUM_IO_BANDWIDTH.toString()) .replace(bwValues); } StringSet iopsVal = new StringSet(); iopsVal.add("0"); if (unManagedVolumeInformation.get(SupportedVolumeInformation.EMC_MAXIMUM_IOPS.toString()) == null) { unManagedVolumeInformation.put( SupportedVolumeInformation.EMC_MAXIMUM_IOPS.toString(), iopsVal); } else { unManagedVolumeInformation .get(SupportedVolumeInformation.EMC_MAXIMUM_IOPS.toString()) .replace(iopsVal); } } // Set SLOName only for VMAX3 exported volumes if (system.checkIfVmax3()) { // If there are no slonames defined for a pool or no slo // set for a volume, update the tiering_enabled to false. if (poolSupportedSLONames.isEmpty() || !keyMap.containsKey(Constants.VOLUMES_WITH_SLOS)) { unManagedVolumeCharacteristics.put( SupportedVolumeCharacterstics.IS_AUTO_TIERING_ENABLED.toString(), Boolean.FALSE.toString()); } else { Map<String, String> volumesWithSLO = (Map<String, String>) keyMap.get(Constants.VOLUMES_WITH_SLOS); if (volumesWithSLO.containsKey(volumeNativeGuid)) { String sloName = volumesWithSLO.get(volumeNativeGuid); _logger.debug("formattedSLOName: {}", sloName); updateSLOPolicies( poolSupportedSLONames, unManagedVolumeInformation, unManagedVolumeCharacteristics, sloName); } else { unManagedVolumeCharacteristics.put( SupportedVolumeCharacterstics.IS_AUTO_TIERING_ENABLED.toString(), Boolean.FALSE.toString()); } } } if (existingVolumesInCG != null && existingVolumesInCG.contains(volumeNativeGuid)) { unManagedVolumeCharacteristics.put( SupportedVolumeCharacterstics.IS_VOLUME_ADDED_TO_CONSISTENCYGROUP.toString(), TRUE); } else { unManagedVolumeCharacteristics.put( SupportedVolumeCharacterstics.IS_VOLUME_ADDED_TO_CONSISTENCYGROUP.toString(), FALSE); } Object raidLevelObj; boolean isIngestable; String isBound; String isThinlyProvisioned; String isMetaVolume; String allocCapacity; // Set the attributes for new smis version. if (keyMap.containsKey(Constants.IS_NEW_SMIS_PROVIDER) && Boolean.valueOf(keyMap.get(Constants.IS_NEW_SMIS_PROVIDER).toString())) { unManagedVolume.setLabel(getCIMPropertyValue(volumeInstance, NAME)); raidLevelObj = volumeInstance.getPropertyValue( SupportedVolumeInformation.RAID_LEVEL.getAlternateKey()); isBound = getCIMPropertyValue( volumeInstance, SupportedVolumeCharacterstics.IS_BOUND.getAlterCharacterstic()); isIngestable = isVolumeIngestable(volumeInstance, isBound, USAGE); isThinlyProvisioned = getCIMPropertyValue(volumeInstance, THINLY_PROVISIONED); isMetaVolume = getCIMPropertyValue( volumeInstance, SupportedVolumeCharacterstics.IS_METAVOLUME.getAlterCharacterstic()); allocCapacity = getAllocatedCapacity(volumeInstance, _volumeToSpaceConsumedMap, system.checkIfVmax3()); } else { unManagedVolume.setLabel(getCIMPropertyValue(volumeInstance, SVELEMENT_NAME)); isBound = getCIMPropertyValue( volumeInstance, SupportedVolumeCharacterstics.IS_BOUND.getCharacterstic()); raidLevelObj = volumeInstance.getPropertyValue(SupportedVolumeInformation.RAID_LEVEL.getInfoKey()); isIngestable = isVolumeIngestable(volumeInstance, isBound, SVUSAGE); isThinlyProvisioned = getCIMPropertyValue(volumeInstance, EMC_THINLY_PROVISIONED); isMetaVolume = getCIMPropertyValue( volumeInstance, SupportedVolumeCharacterstics.IS_METAVOLUME.getCharacterstic()); allocCapacity = getCIMPropertyValue(volumeInstance, EMC_ALLOCATED_CAPACITY); } if (null != raidLevelObj) { StringSet raidLevels = new StringSet(); raidLevels.add(raidLevelObj.toString()); unManagedVolumeInformation.put( SupportedVolumeInformation.RAID_LEVEL.toString(), raidLevels); } if (null != isBound) { unManagedVolumeCharacteristics.put( SupportedVolumeCharacterstics.IS_BOUND.toString(), isBound); } if (null != isThinlyProvisioned) { unManagedVolumeCharacteristics.put( SupportedVolumeCharacterstics.IS_THINLY_PROVISIONED.toString(), isThinlyProvisioned); } if (null != isMetaVolume) { unManagedVolumeCharacteristics.put( SupportedVolumeCharacterstics.IS_METAVOLUME.toString(), isMetaVolume); } // only Volumes with Usage 2 can be ingestable, other volumes // [SAVE,VAULT...] apart from replicas have usage other than 2 // Volumes which are set EMCIsBound as false cannot be ingested if (isIngestable) { unManagedVolumeCharacteristics.put( SupportedVolumeCharacterstics.IS_INGESTABLE.toString(), TRUE); } else { unManagedVolumeCharacteristics.put( SupportedVolumeCharacterstics.IS_INGESTABLE.toString(), FALSE); } if (volumeToRAGroupMap.containsKey(unManagedVolume.getNativeGuid())) { RemoteMirrorObject rmObj = volumeToRAGroupMap.get(unManagedVolume.getNativeGuid()); _logger.info("Found RA Object {}", rmObj.toString()); if (RemoteMirrorObject.Types.SOURCE.toString().equalsIgnoreCase(rmObj.getType())) { _logger.info("Found Source, updating targets {}", rmObj.getTargetVolumenativeGuids()); // setting target Volumes if (unManagedVolumeInformation.get(SupportedVolumeInformation.REMOTE_MIRRORS.toString()) == null) { unManagedVolumeInformation.put( SupportedVolumeInformation.REMOTE_MIRRORS.toString(), rmObj.getTargetVolumenativeGuids()); } else { if (null == rmObj.getTargetVolumenativeGuids() || rmObj.getTargetVolumenativeGuids().size() == 0) { unManagedVolumeInformation .get(SupportedVolumeInformation.REMOTE_MIRRORS.toString()) .clear(); } else { unManagedVolumeInformation .get(SupportedVolumeInformation.REMOTE_MIRRORS.toString()) .replace(rmObj.getTargetVolumenativeGuids()); } } } else if (RemoteMirrorObject.Types.TARGET.toString().equalsIgnoreCase(rmObj.getType())) { _logger.info( "Found Target {}, updating copyMode {}, RA Group", unManagedVolume.getNativeGuid(), rmObj.getCopyMode()); // setting srdfParent StringSet parentVolume = new StringSet(); parentVolume.add(rmObj.getSourceVolumeNativeGuid()); unManagedVolumeInformation.put( SupportedVolumeInformation.REMOTE_MIRROR_SOURCE_VOLUME.toString(), parentVolume); // setting RAGroup StringSet raGroup = new StringSet(); raGroup.add(rmObj.getRaGroupUri().toString()); unManagedVolumeInformation.put( SupportedVolumeInformation.REMOTE_MIRROR_RDF_GROUP.toString(), raGroup); } // setting Copy Modes StringSet copyModes = new StringSet(); copyModes.add(rmObj.getCopyMode()); if (unManagedVolumeInformation.get(SupportedVolumeInformation.REMOTE_COPY_MODE.toString()) == null) { unManagedVolumeInformation.put( SupportedVolumeInformation.REMOTE_COPY_MODE.toString(), copyModes); } else { unManagedVolumeInformation .get(SupportedVolumeInformation.REMOTE_COPY_MODE.toString()) .replace(copyModes); } // setting Volume Type StringSet volumeType = new StringSet(); volumeType.add(rmObj.getType()); unManagedVolumeInformation.put( SupportedVolumeInformation.REMOTE_VOLUME_TYPE.toString(), volumeType); unManagedVolumeCharacteristics.put( SupportedVolumeCharacterstics.REMOTE_MIRRORING.toString(), TRUE); } else { unManagedVolumeCharacteristics.put( SupportedVolumeCharacterstics.REMOTE_MIRRORING.toString(), FALSE); } // handle clones, local mirrors and snapshots boolean isLocalReplica = false; if (volumeToLocalReplicaMap.containsKey(unManagedVolume.getNativeGuid())) { _logger.info("Found in localReplicaMap {}", unManagedVolume.getNativeGuid()); LocalReplicaObject lrObj = volumeToLocalReplicaMap.get(unManagedVolume.getNativeGuid()); isLocalReplica = lrObj.isReplica(); // setting targets StringSet fullCopies = lrObj.getFullCopies(); if (fullCopies != null && !fullCopies.isEmpty()) { unManagedVolumeInformation.put(SupportedVolumeInformation.FULL_COPIES.name(), fullCopies); } StringSet mirrors = lrObj.getMirrors(); if (mirrors != null && !mirrors.isEmpty()) { unManagedVolumeInformation.put(SupportedVolumeInformation.MIRRORS.name(), mirrors); } StringSet snapshots = lrObj.getSnapshots(); if (snapshots != null && !snapshots.isEmpty()) { unManagedVolumeInformation.put(SupportedVolumeInformation.SNAPSHOTS.name(), snapshots); } if (lrObj.hasReplica()) { // set the HAS_REPLICAS property unManagedVolumeCharacteristics.put( SupportedVolumeCharacterstics.HAS_REPLICAS.name(), TRUE); } if (LocalReplicaObject.Types.FullCopy.equals(lrObj.getType())) { _logger.info("Found Clone {}", unManagedVolume.getNativeGuid()); // setting clone specific info unManagedVolumeCharacteristics.put( SupportedVolumeCharacterstics.IS_FULL_COPY.name(), TRUE); StringSet sourceVolume = new StringSet(); sourceVolume.add(lrObj.getSourceNativeGuid()); unManagedVolumeInformation.put( SupportedVolumeInformation.LOCAL_REPLICA_SOURCE_VOLUME.name(), sourceVolume); StringSet isSyncActive = new StringSet(); isSyncActive.add(new Boolean(lrObj.isSyncActive()).toString()); unManagedVolumeInformation.put( SupportedVolumeInformation.IS_SYNC_ACTIVE.name(), isSyncActive); StringSet replicaState = new StringSet(); replicaState.add(lrObj.getReplicaState()); unManagedVolumeInformation.put( SupportedVolumeInformation.REPLICA_STATE.name(), replicaState); } else if (LocalReplicaObject.Types.BlockMirror.equals(lrObj.getType())) { _logger.info("Found Local Mirror {}", unManagedVolume.getNativeGuid()); // setting local mirror specific info unManagedVolumeCharacteristics.put( SupportedVolumeCharacterstics.IS_LOCAL_MIRROR.name(), TRUE); StringSet sourceVolume = new StringSet(); sourceVolume.add(lrObj.getSourceNativeGuid()); unManagedVolumeInformation.put( SupportedVolumeInformation.LOCAL_REPLICA_SOURCE_VOLUME.name(), sourceVolume); StringSet syncState = new StringSet(); syncState.add(lrObj.getSyncState()); unManagedVolumeInformation.put(SupportedVolumeInformation.SYNC_STATE.name(), syncState); StringSet syncType = new StringSet(); syncType.add(lrObj.getSyncType()); unManagedVolumeInformation.put(SupportedVolumeInformation.SYNC_TYPE.name(), syncType); String syncedInst = lrObj.getSynchronizedInstance(); if (syncedInst != null) { StringSet synchronizedInstance = new StringSet(); synchronizedInstance.add(syncedInst); unManagedVolumeInformation.put( SupportedVolumeInformation.SYNCHRONIZED_INSTANCE.name(), synchronizedInstance); } } else if (LocalReplicaObject.Types.BlockSnapshot.equals(lrObj.getType())) { _logger.info("Found Snapshot {}", unManagedVolume.getNativeGuid()); // setting snapshot specific info unManagedVolumeCharacteristics.put( SupportedVolumeCharacterstics.IS_SNAP_SHOT.name(), TRUE); StringSet sourceVolume = new StringSet(); sourceVolume.add(lrObj.getSourceNativeGuid()); unManagedVolumeInformation.put( SupportedVolumeInformation.LOCAL_REPLICA_SOURCE_VOLUME.name(), sourceVolume); StringSet isSyncActive = new StringSet(); isSyncActive.add(new Boolean(lrObj.isSyncActive()).toString()); unManagedVolumeInformation.put( SupportedVolumeInformation.IS_SYNC_ACTIVE.name(), isSyncActive); StringSet needsCopyToTarget = new StringSet(); needsCopyToTarget.add(new Boolean(lrObj.isNeedsCopyToTarget()).toString()); unManagedVolumeInformation.put( SupportedVolumeInformation.NEEDS_COPY_TO_TARGET.name(), needsCopyToTarget); StringSet technologyType = new StringSet(); technologyType.add(lrObj.getTechnologyType()); unManagedVolumeInformation.put( SupportedVolumeInformation.TECHNOLOGY_TYPE.name(), technologyType); String settingsInst = lrObj.getSettingsInstance(); if (settingsInst != null) { StringSet settingsInstance = new StringSet(); settingsInstance.add(settingsInst); unManagedVolumeInformation.put( SupportedVolumeInformation.SETTINGS_INSTANCE.name(), settingsInstance); } } } // set volume's isSyncActive if (!isLocalReplica) { StringSet isSyncActive = new StringSet(); isSyncActive.add(TRUE); unManagedVolumeInformation.put( SupportedVolumeInformation.IS_SYNC_ACTIVE.name(), isSyncActive); } if (null != pool) { unManagedVolume.setStoragePoolUri(pool.getId()); StringSet pools = new StringSet(); pools.add(pool.getId().toString()); unManagedVolumeInformation.put(SupportedVolumeInformation.STORAGE_POOL.toString(), pools); StringSet driveTypes = pool.getSupportedDriveTypes(); if (null != driveTypes) { unManagedVolumeInformation.put( SupportedVolumeInformation.DISK_TECHNOLOGY.toString(), driveTypes); } StringSet matchedVPools = DiscoveryUtils.getMatchedVirtualPoolsForPool( _dbClient, pool.getId(), unManagedVolumeCharacteristics.get( SupportedVolumeCharacterstics.IS_THINLY_PROVISIONED.toString())); if (unManagedVolumeInformation.containsKey( SupportedVolumeInformation.SUPPORTED_VPOOL_LIST.toString())) { _logger.debug("Matched Pools :" + Joiner.on("\t").join(matchedVPools)); if (null != matchedVPools && matchedVPools.size() == 0) { // replace with empty string set doesn't work, hence // added explicit code to remove all unManagedVolumeInformation .get(SupportedVolumeInformation.SUPPORTED_VPOOL_LIST.toString()) .clear(); } else { // replace with new StringSet unManagedVolumeInformation .get(SupportedVolumeInformation.SUPPORTED_VPOOL_LIST.toString()) .replace(matchedVPools); _logger.info( "Replaced Pools :" + Joiner.on("\t") .join( unManagedVolumeInformation.get( SupportedVolumeInformation.SUPPORTED_VPOOL_LIST.toString()))); } } else { unManagedVolumeInformation.put( SupportedVolumeInformation.SUPPORTED_VPOOL_LIST.toString(), matchedVPools); } } // set allocated capacity if (allocCapacity != null) { StringSet allocCapacitySet = new StringSet(); allocCapacitySet.add(allocCapacity); unManagedVolumeInformation.put( SupportedVolumeInformation.ALLOCATED_CAPACITY.toString(), allocCapacitySet); } StringSet provCapacity = new StringSet(); provCapacity.add(String.valueOf(returnProvisionedCapacity(volumeInstance, keyMap))); unManagedVolumeInformation.put( SupportedVolumeInformation.PROVISIONED_CAPACITY.toString(), provCapacity); injectVolumeInformation(unManagedVolume, volumeInstance, unManagedVolumeInformation); injectVolumeCharacterstics(unManagedVolume, volumeInstance, unManagedVolumeCharacteristics); unManagedVolume.getUnmanagedExportMasks().clear(); unManagedVolume.getInitiatorUris().clear(); unManagedVolume.getInitiatorNetworkIds().clear(); if (created) { _unManagedVolumesInsert.add(unManagedVolume); } else { _unManagedVolumesUpdate.add(unManagedVolume); } } catch (Exception e) { _logger.error("Exception: ", e); } return unManagedVolume; }
/** * Process the volumes to find the unmanaged volumes and populate the volume supported * information. * * @param it * @param keyMap * @param operation * @param pool * @param system * @param exportedVolumes * @param volumesAndReplicas * @param existingVolumesInCG * @param volumeToRAGroupMap * @param poolSupportedSLONames * @param boundVolumes */ private void processVolumes( Iterator<CIMInstance> it, Map<String, Object> keyMap, Operation operation, StoragePool pool, StorageSystem system, Map<String, VolHostIOObject> exportedVolumes, Set<String> existingVolumesInCG, Map<String, RemoteMirrorObject> volumeToRAGroupMap, Map<String, LocalReplicaObject> volumeToLocalReplicaMap, Set<String> poolSupportedSLONames, Set<String> boundVolumes) { List<CIMObjectPath> metaVolumes = new ArrayList<CIMObjectPath>(); List<CIMObjectPath> metaVolumeViews = new ArrayList<CIMObjectPath>(); while (it.hasNext()) { CIMInstance volumeViewInstance = null; try { volumeViewInstance = it.next(); String volumeNativeGuid = getVolumeViewNativeGuid(volumeViewInstance.getObjectPath(), keyMap); Volume volume = checkStorageVolumeExistsInDB(volumeNativeGuid, _dbClient); if (null != volume) { _logger.debug( "Skipping discovery, as this Volume {} is already being managed by ViPR.", volumeNativeGuid); continue; } // skip non-bound volumes for this pool if (boundVolumes != null) { String deviceId = null; if (system.getUsingSmis80()) { deviceId = volumeViewInstance.getObjectPath().getKey(DEVICE_ID).getValue().toString(); } else { deviceId = volumeViewInstance.getObjectPath().getKey(SVDEVICEID).getValue().toString(); } if (!boundVolumes.contains(deviceId)) { _logger.info( "Skipping volume, as this Volume {} is not bound to this Thin Storage Pool {}", volumeNativeGuid, pool.getLabel()); continue; } } addPath(keyMap, operation.get_result(), volumeViewInstance.getObjectPath()); String unManagedVolumeNativeGuid = getUnManagedVolumeNativeGuid(volumeViewInstance.getObjectPath(), keyMap); UnManagedVolume unManagedVolume = checkUnManagedVolumeExistsInDB(unManagedVolumeNativeGuid, _dbClient); unManagedVolume = createUnManagedVolume( unManagedVolume, volumeViewInstance, unManagedVolumeNativeGuid, pool, system, volumeNativeGuid, exportedVolumes, existingVolumesInCG, volumeToRAGroupMap, volumeToLocalReplicaMap, poolSupportedSLONames, keyMap); // set up UnManagedExportMask information @SuppressWarnings("unchecked") Map<String, Set<UnManagedExportMask>> masksMap = (Map<String, Set<UnManagedExportMask>>) keyMap.get(Constants.UNMANAGED_EXPORT_MASKS_MAP); if (masksMap != null) { Set<UnManagedExportMask> uems = masksMap.get(unManagedVolume.getNativeGuid()); if (uems != null) { _logger.info( "{} UnManagedExportMasks found in the keyMap for volume {}", uems.size(), unManagedVolume.getNativeGuid()); for (UnManagedExportMask uem : uems) { _logger.info( " adding UnManagedExportMask {} to UnManagedVolume", uem.getMaskingViewPath()); unManagedVolume.getUnmanagedExportMasks().add(uem.getId().toString()); uem.getUnmanagedVolumeUris().add(unManagedVolume.getId().toString()); _unManagedExportMasksUpdate.add(uem); // add the known initiators, too for (String initUri : uem.getKnownInitiatorUris()) { _logger.info(" adding known Initiator URI {} to UnManagedVolume", initUri); unManagedVolume.getInitiatorUris().add(initUri); Initiator init = _dbClient.queryObject(Initiator.class, URI.create(initUri)); unManagedVolume.getInitiatorNetworkIds().add(init.getInitiatorPort()); } // log this info for debugging for (String path : uem.getUnmanagedInitiatorNetworkIds()) { _logger.info(" UnManagedExportMask has this initiator unknown to ViPR: {}", path); } // check if this volume is in a vplex backend mask // and mark it as such if it is Object o = keyMap.get(Constants.UNMANAGED_VPLEX_BACKEND_MASKS_SET); if (o != null) { Set<String> unmanagedVplexBackendMasks = (Set<String>) o; if (unmanagedVplexBackendMasks.size() > 0) { if (unmanagedVplexBackendMasks.contains(uem.getId().toString())) { _logger.info( "unmanaged volume {} is a vplex backend volume", unManagedVolume.getLabel()); unManagedVolume.putVolumeCharacterstics( SupportedVolumeCharacterstics.IS_VPLEX_BACKEND_VOLUME.toString(), "true"); } } } } } } _logger.debug( "Going to check if the volume is meta: {}, volume meta property: {}", volumeViewInstance.getObjectPath(), unManagedVolume .getVolumeCharacterstics() .get(SupportedVolumeCharacterstics.IS_METAVOLUME.toString())); // Check if the volume is meta volume and add it to the meta // volume list String isMetaVolume = unManagedVolume .getVolumeCharacterstics() .get(SupportedVolumeCharacterstics.IS_METAVOLUME.toString()); if (null != isMetaVolume && Boolean.valueOf(isMetaVolume)) { if (keyMap.containsKey(Constants.IS_NEW_SMIS_PROVIDER) && Boolean.valueOf(keyMap.get(Constants.IS_NEW_SMIS_PROVIDER).toString())) { metaVolumes.add(volumeViewInstance.getObjectPath()); } else { metaVolumeViews.add(volumeViewInstance.getObjectPath()); } _logger.info( "Found meta volume: {}, name: {}", volumeViewInstance.getObjectPath(), unManagedVolume.getLabel()); } // if volumes size reaches 200 , then dump to Db. if (_unManagedVolumesInsert.size() > BATCH_SIZE) { _partitionManager.insertInBatches( _unManagedVolumesInsert, getPartitionSize(keyMap), _dbClient, UNMANAGED_VOLUME); _unManagedVolumesInsert.clear(); } if (_unManagedVolumesUpdate.size() > BATCH_SIZE) { _partitionManager.updateInBatches( _unManagedVolumesUpdate, getPartitionSize(keyMap), _dbClient, UNMANAGED_VOLUME); _unManagedVolumesUpdate.clear(); } if (_unManagedExportMasksUpdate.size() > BATCH_SIZE) { _partitionManager.updateInBatches( _unManagedExportMasksUpdate, getPartitionSize(keyMap), _dbClient, UNMANAGED_EXPORT_MASK); _unManagedExportMasksUpdate.clear(); } unManagedVolumesReturnedFromProvider.add(unManagedVolume.getId()); } catch (Exception ex) { _logger.error( "Processing UnManaged Storage Volume {} ", volumeViewInstance.getObjectPath(), ex); } } // Add meta volumes to the keyMap try { if (metaVolumes != null && !metaVolumes.isEmpty()) { _metaVolumePaths.addAll(metaVolumes); _logger.info("Added {} meta volumes.", metaVolumes.size()); } if (metaVolumeViews != null && !metaVolumeViews.isEmpty()) { _metaVolumeViewPaths.addAll(metaVolumeViews); _logger.info("Added {} meta volume views.", metaVolumeViews.size()); } } catch (Exception ex) { _logger.error("Processing UnManaged meta volumes.", ex); } }
/** * Called to update the job status when the volume expand job completes. * * @param jobContext The job context. */ public void updateStatus(JobContext jobContext) throws Exception { CloseableIterator<CIMObjectPath> associatorIterator = null; CloseableIterator<CIMInstance> instanceIterator = null; JobStatus jobStatus = getJobStatus(); try { if (jobStatus == JobStatus.IN_PROGRESS) { return; } DbClient dbClient = jobContext.getDbClient(); CIMConnectionFactory cimConnectionFactory = jobContext.getCimConnectionFactory(); WBEMClient client = getWBEMClient(dbClient, cimConnectionFactory); // If terminal state update storage pool capacity and remove reservation for volume capacity // from pool's reserved capacity map. if (jobStatus == JobStatus.SUCCESS || jobStatus == JobStatus.FAILED || jobStatus == JobStatus.FATAL_ERROR) { SmisUtils.updateStoragePoolCapacity(dbClient, client, _storagePoolURI); StoragePool pool = dbClient.queryObject(StoragePool.class, _storagePoolURI); StringMap reservationMap = pool.getReservedCapacityMap(); URI volumeId = getTaskCompleter().getId(); // remove from reservation map reservationMap.remove(volumeId.toString()); dbClient.persistObject(pool); } String opId = getTaskCompleter().getOpId(); StringBuilder logMsgBuilder = new StringBuilder( String.format( "Updating status of job %s to %s, task: %s", this.getJobName(), jobStatus.name(), opId)); if (jobStatus == JobStatus.SUCCESS) { VolumeExpandCompleter taskCompleter = (VolumeExpandCompleter) getTaskCompleter(); Volume volume = dbClient.queryObject(Volume.class, taskCompleter.getId()); // set requested capacity volume.setCapacity(taskCompleter.getSize()); // set meta related properties volume.setTotalMetaMemberCapacity(taskCompleter.getTotalMetaMembersSize()); volume.setMetaMemberCount(taskCompleter.getMetaMemberCount()); volume.setMetaMemberSize(taskCompleter.getMetaMemberSize()); volume.setIsComposite(taskCompleter.isComposite()); volume.setCompositionType(taskCompleter.getMetaVolumeType()); // set provisioned capacity associatorIterator = client.associatorNames(getCimJob(), null, SmisConstants.CIM_STORAGE_VOLUME, null, null); if (associatorIterator.hasNext()) { CIMObjectPath volumePath = associatorIterator.next(); CIMInstance volumeInstance = client.getInstance(volumePath, true, false, null); if (volumeInstance != null) { CIMProperty consumableBlocks = volumeInstance.getProperty(SmisConstants.CP_CONSUMABLE_BLOCKS); CIMProperty blockSize = volumeInstance.getProperty(SmisConstants.CP_BLOCK_SIZE); // calculate provisionedCapacity = consumableBlocks * block size Long provisionedCapacity = Long.valueOf(consumableBlocks.getValue().toString()) * Long.valueOf(blockSize.getValue().toString()); volume.setProvisionedCapacity(provisionedCapacity); } // set allocated capacity instanceIterator = client.referenceInstances( volumePath, SmisConstants.CIM_ALLOCATED_FROM_STORAGEPOOL, null, false, SmisConstants.PS_SPACE_CONSUMED); if (instanceIterator.hasNext()) { CIMInstance allocatedFromStoragePoolPath = instanceIterator.next(); CIMProperty spaceConsumed = allocatedFromStoragePoolPath.getProperty(SmisConstants.CP_SPACE_CONSUMED); if (null != spaceConsumed) { volume.setAllocatedCapacity(Long.valueOf(spaceConsumed.getValue().toString())); } } } logMsgBuilder.append( String.format( "%n Capacity: %s, Provisioned capacity: %s, Allocated Capacity: %s", volume.getCapacity(), volume.getProvisionedCapacity(), volume.getAllocatedCapacity())); if (volume.getIsComposite()) { logMsgBuilder.append( String.format( "%n Is Meta: %s, Total meta member capacity: %s, Meta member count %s, Meta member size: %s", volume.getIsComposite(), volume.getTotalMetaMemberCapacity(), volume.getMetaMemberCount(), volume.getMetaMemberSize())); } _log.info(logMsgBuilder.toString()); // Reset list of meta member volumes in the volume if (volume.getMetaVolumeMembers() != null) { volume.getMetaVolumeMembers().clear(); } StorageSystem storageSystem = dbClient.queryObject(StorageSystem.class, volume.getStorageController()); // set the RP tag on the volume if the volume is RP protected if (volume.checkForRp() && storageSystem.getSystemType() != null && storageSystem .getSystemType() .equalsIgnoreCase(DiscoveredDataObject.Type.vmax.toString())) { SmisCommandHelper helper = jobContext.getSmisCommandHelper(); List<CIMObjectPath> volumePathList = new ArrayList<CIMObjectPath>(); volumePathList.add(helper.getVolumeMember(storageSystem, volume)); helper.setRecoverPointTag(storageSystem, volumePathList, true); } dbClient.persistObject(volume); // Reset list of meta members native ids in WF data (when meta is created meta members are // removed from array) WorkflowService.getInstance().storeStepData(opId, new ArrayList<String>()); } } catch (Exception e) { _log.error("Caught an exception while trying to updateStatus for SmisVolumeExpandJob", e); setPostProcessingErrorStatus( "Encountered an internal error during volume expand job status processing : " + e.getMessage()); } finally { _metaVolumeTaskCompleter.setLastStepStatus(jobStatus); if (associatorIterator != null) { associatorIterator.close(); } if (instanceIterator != null) { instanceIterator.close(); } super.updateStatus(jobContext); } }
private void processVolumes( CloseableIterator<CIMInstance> volumeInstances, Map<String, Object> keyMap) throws IOException { List<CIMObjectPath> metaVolumes = new ArrayList<>(); while (volumeInstances.hasNext()) { CIMInstance volumeViewInstance = volumeInstances.next(); String nativeGuid = getVolumeViewNativeGuid(volumeViewInstance.getObjectPath(), keyMap); if (isSnapShot(volumeViewInstance)) { BlockSnapshot snapShot = checkSnapShotExistsInDB(nativeGuid, _dbClient); if (null == snapShot || snapShot.getInactive()) { _logger.debug("Skipping Snapshot, as its not being managed in Bourne"); continue; } updateBlockSnapShot(volumeViewInstance, snapShot, keyMap); if (_updateSnapShots.size() > BATCH_SIZE) { _partitionManager.updateInBatches( _updateSnapShots, getPartitionSize(keyMap), _dbClient, BLOCK_SNAPSHOT); _updateSnapShots.clear(); } } else if (isMirror(volumeViewInstance)) { BlockMirror mirror = checkBlockMirrorExistsInDB(nativeGuid, _dbClient); if (null == mirror || mirror.getInactive()) { _logger.debug("Skipping Mirror, as its not being managed in Bourne"); continue; } updateBlockMirror(volumeViewInstance, mirror, keyMap); if (_updateMirrors.size() > BATCH_SIZE) { _partitionManager.updateInBatches( _updateMirrors, getPartitionSize(keyMap), _dbClient, BLOCK_MIRROR); _updateMirrors.clear(); } } else { Volume storageVolume = checkStorageVolumeExistsInDB(nativeGuid, _dbClient); if (null == storageVolume || storageVolume.getInactive()) { continue; } _logger.debug("Volume managed by Bourne :" + storageVolume.getNativeGuid()); updateStorageVolume(volumeViewInstance, storageVolume, keyMap); // Check if this is a meta volume and if we need to set missing meta volume related // properties. // This is applicable for meta volumes discovered as unmanaged volumes and ingested prior to // vipr controller 2.2 . if (storageVolume.getIsComposite() && (storageVolume.getCompositionType() == null || storageVolume.getCompositionType().isEmpty())) { // meta volume is missing meta related data. Need to discover this data and set in the // volume. metaVolumes.add(volumeViewInstance.getObjectPath()); _logger.info( "Found meta volume in vipr with missing data: {}, name: {}", volumeViewInstance.getObjectPath(), storageVolume.getLabel()); } } if (_updateVolumes.size() > BATCH_SIZE) { _partitionManager.updateInBatches( _updateVolumes, getPartitionSize(keyMap), _dbClient, VOLUME); _updateVolumes.clear(); } } // Add meta volumes to the keyMap try { if (metaVolumes != null && !metaVolumes.isEmpty()) { _metaVolumeViewPaths.addAll(metaVolumes); _logger.info("Added {} meta volumes.", metaVolumes.size()); } } catch (Exception ex) { _logger.error("Processing meta volumes.", ex); } }
/** {@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); _cimClient = (WBEMClient) keyMap.get(Constants._cimClient); _coordinator = (CoordinatorClient) keyMap.get(Constants.COORDINATOR_CLIENT); _eventManager = (RecordableEventManager) keyMap.get(Constants.EVENT_MANAGER); _logger.info("StoragePoolProcessor --- event manager: " + _eventManager); StorageSystem device = getStorageSystem(_dbClient, profile.getSystemId()); if (SupportedProvisioningTypes.NONE .toString() .equalsIgnoreCase(device.getSupportedProvisioningType())) { _logger.info( "Storage System doesn't support volume creations :" + device.getSerialNumber()); return; } Set<String> protocols = (Set<String>) keyMap.get(Constants.PROTOCOLS); Map<URI, StoragePool> poolsToMatchWithVpool = (Map<URI, StoragePool>) keyMap.get(Constants.MODIFIED_STORAGEPOOLS); while (it.hasNext()) { CIMInstance poolInstance = null; try { poolInstance = it.next(); // Supporting both thick and thin pools String[] poolClassNameAndSupportedVolumeTypes = determinePoolClassNameAndSupportedVolumeTypes(poolInstance, device); if (null != poolClassNameAndSupportedVolumeTypes) { String instanceID = getCIMPropertyValue(poolInstance, Constants.INSTANCEID); addPath(keyMap, operation.getResult(), poolInstance.getObjectPath()); StoragePool pool = checkStoragePoolExistsInDB(getNativeIDFromInstance(instanceID), _dbClient, device); createStoragePool( pool, poolInstance, profile, poolClassNameAndSupportedVolumeTypes[0], poolClassNameAndSupportedVolumeTypes[1], protocols, poolsToMatchWithVpool, device); if (DiscoveredDataObject.Type.vnxblock .toString() .equalsIgnoreCase(device.getSystemType())) { addPath(keyMap, Constants.VNXPOOLS, poolInstance.getObjectPath()); } if (DiscoveredDataObject.Type.vmax .toString() .equalsIgnoreCase(device.getSystemType())) { addPath(keyMap, Constants.VMAXPOOLS, poolInstance.getObjectPath()); if (!device.checkIfVmax3()) { addPath(keyMap, Constants.VMAX2POOLS, poolInstance.getObjectPath()); } } // This approach deviates from the existing built plugin framework for plugin // Discovery // To follow the existing pattern, we need to have different SMI-S calls // 1st to get Device StoragePools alone ,and 2nd to get Thin Pools. // Its a tradeoff between whether to go with the current plugin design or // reduce the number of calls to SMI Provider. // I chose the 2nd option. if (!poolClassNameAndSupportedVolumeTypes[0].contains(DEVICE_STORAGE_POOL)) { addPath(keyMap, Constants.THINPOOLS, poolInstance.getObjectPath()); } addPath(keyMap, Constants.DEVICEANDTHINPOOLS, poolInstance.getObjectPath()); } else { _logger.debug( "Skipping Pools other than Unified & Virtual & Device : {}", poolInstance.getObjectPath().toString()); } } catch (Exception e) { _logger.warn( "StoragePool Discovery failed for {}", getCIMPropertyValue(poolInstance, Constants.INSTANCEID), e); } } _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 --> {}", getMessage(e)); } finally { _newPoolList = null; _updatePoolList = null; } }
private void processVolumes( Iterator<CIMInstance> it, Map<String, Object> keyMap, Operation operation) { while (it.hasNext()) { try { CIMInstance volumeInstance = it.next(); CIMObjectPath volumePath = volumeInstance.getObjectPath(); // TODO add logic to get Access String access = null; Object value = volumeInstance.getPropertyValue(SupportedVolumeInformation.ACCESS.toString()); if (value != null) { access = value.toString(); } StringSet statusDesc = new StringSet(); String[] descriptions = null; value = volumeInstance.getPropertyValue( SupportedVolumeInformation.STATUS_DESCRIPTIONS.toString()); if (value != null) { descriptions = (String[]) value; for (String desc : descriptions) { statusDesc.add(desc); } } String volumeNativeGuid = getVolumeNativeGuid(volumePath); Volume volume = checkStorageVolumeExistsInDB(volumeNativeGuid, _dbClient); if (null != volume) { _logger.debug( "Skipping discovery, as this Volume is already being managed by ViPR :" + volumeNativeGuid); continue; } String unManagedVolumeNativeGuid = getUnManagedVolumeNativeGuidFromVolumePath(volumePath); UnManagedVolume unManagedVolume = checkUnManagedVolumeExistsInDB(unManagedVolumeNativeGuid, _dbClient); if (null != unManagedVolume) { _logger.debug("Adding Access {}", unManagedVolumeNativeGuid); StringSet accessSet = new StringSet(); if (access != null) { accessSet.add(access); } if (null == unManagedVolume .getVolumeInformation() .get(SupportedVolumeInformation.ACCESS.toString())) { unManagedVolume .getVolumeInformation() .put(SupportedVolumeInformation.ACCESS.toString(), accessSet); } else { unManagedVolume .getVolumeInformation() .get(SupportedVolumeInformation.ACCESS.toString()) .replace(accessSet); } if (null == unManagedVolume .getVolumeInformation() .get(SupportedVolumeInformation.STATUS_DESCRIPTIONS.toString())) { unManagedVolume .getVolumeInformation() .put(SupportedVolumeInformation.STATUS_DESCRIPTIONS.toString(), statusDesc); } else { unManagedVolume .getVolumeInformation() .get(SupportedVolumeInformation.STATUS_DESCRIPTIONS.toString()) .replace(statusDesc); } _unManagedVolumesUpdate.add(unManagedVolume); } if (_unManagedVolumesUpdate.size() > BATCH_SIZE) { _partitionManager.updateInBatches( _unManagedVolumesUpdate, getPartitionSize(keyMap), _dbClient, "UnManagedVolume"); _unManagedVolumesUpdate.clear(); } } catch (Exception ex) { _logger.error("Processing UnManaged Storage Volume", ex); } } }
/** * Adds the computer system to DB and determines what path to go based on the * CIM_ComputerSystem.dedicated * * @param cc * @param cim_class */ @SuppressWarnings("unchecked") public void getComputerSystem(WBEMClient cc, String cim_class, String namespace) { if (cc != null) { try { this.cim_DT = new CIM_DataTypes(); CIMObjectPath cop = new CIMObjectPath(cim_class, namespace); PerformanceMetrics pm = new PerformanceMetrics(); long statInstanceMean = pm.enumerationTime(cc, cop); CloseableIterator computerSystemEnum = cc.enumerateInstances(cop, true, false, false, null); while (computerSystemEnum.hasNext()) { this.cs = new CIM_ComputerSystem(); Calendar statCalBefore = Calendar.getInstance(); long msBeforeforTotalDisc = statCalBefore.getTimeInMillis(); this.cs.setInstanceTimeMean(Long.valueOf(statInstanceMean)); CIMInstance ci = (CIMInstance) computerSystemEnum.next(); int instancePropertySize = ci.getPropertyCount(); this.cs.setInstancePropertySize(instancePropertySize); CIMObjectPath instanceCOP = ci.getObjectPath(); CIMProperty cp = instanceCOP.getKey("Name"); this.enumerationNameKey = cp.getValue().toString(); // this.logger.info("Name = " + this.enumerationNameKey); // this.logger.debug(this.CN + " computerSystemName " + this.enumerationNameKey); String enumerationNameKey = null; String enumerationCreationClassNameKey = null; String elementName = "Not Available"; String operationalStatus = null; String statusDescriptions = null; String description = null; int enabledState = 0; enumerationNameKey = cp.getValue().toString(); cp = instanceCOP.getKey("CreationClassName"); enumerationCreationClassNameKey = cp.getValue().toString(); // this.logger.info("CreationClassName = " + enumerationCreationClassNameKey); String caption = ""; try { caption = this.cim_DT.getCIMInstancePropertyValueString(ci, "Caption"); } catch (Exception e) { caption = "Not Available"; } // this.logger.info("Caption = " + caption); String description1 = ""; try { description1 = this.cim_DT.getCIMInstancePropertyValueString(ci, "Description"); } catch (Exception e) { description1 = "Not Available"; } // this.logger.info("Description = " + description1); try { elementName = this.cim_DT.getCIMInstancePropertyValueString(ci, "ElementName"); } catch (Exception e) { elementName = "Not Available"; } // this.logger.info("ElementName = " + elementName); int requestedState = 0; try { requestedState = this.cim_DT .getCIMInstancePropertyUnsignedInt16Value(ci, "RequestedState") .intValue(); } catch (Exception localException1) { } int enabledDefault = 0; try { enabledDefault = this.cim_DT .getCIMInstancePropertyUnsignedInt16Value(ci, "EnabledDefault") .intValue(); } catch (Exception localException2) { } String nameFormat = null; try { nameFormat = this.cim_DT.getCIMInstancePropertyValueString(ci, "NameFormat"); } catch (Exception e) { // this.logger.error(this.CN, e); } try { UnsignedInteger16[] operationalStatusArray = this.cim_DT.getUint16ArrayPropertyValue(ci, "OperationalStatus"); int operationalStatusSize = 0; if (operationalStatusArray != null) { operationalStatusSize = operationalStatusArray.length; } // this.logger.debug("operationalStatusSize = " + operationalStatusSize); Vector operationalStatusString = new Vector(); for (int x = 0; x < operationalStatusSize; ++x) { UnsignedInteger16 opstsint = operationalStatusArray[x]; int operationalStatusInt = Integer.parseInt(opstsint.toString()); String operationalStatusValue = this.cim_Q.operationalStatus(operationalStatusInt); operationalStatusString.add(operationalStatusValue); } String operationalStatusFinal = this.cim_Q.buildStringFromVector(operationalStatusString, ","); this.cs.setOperationalStatus(operationalStatusFinal); } catch (Exception e) { // this.logger.error("OperationalStatus", e); this.cs.setOperationalStatus("Unknown"); } String statusDescriptionsFinal = null; try { String[] statusDescriptionsArray = this.cim_DT.getStringArrayPropertyValue(ci, "StatusDescriptions"); int statusDescriptionsSize = 0; if (statusDescriptionsArray != null) { statusDescriptionsSize = statusDescriptionsArray.length; } // this.logger.debug("statusDescriptionsSize = " + statusDescriptionsSize); Vector statusDescriptionsString = new Vector(); for (int y = 0; y < statusDescriptionsSize; ++y) { String statusDescriptionsValue = statusDescriptionsArray[y].toString(); statusDescriptionsString.add(statusDescriptionsValue); } statusDescriptionsFinal = this.cim_Q.buildStringFromVector(statusDescriptionsString, ","); } catch (Exception e) { // this.logger.error("StatusDescriptions", e); } String otherIdentifyingInfoFinal = null; try { String[] otherIdentifyingInfoArray = this.cim_DT.getStringArrayPropertyValue(ci, "OtherIdentifyingInfo"); int otherIdentifyingInfoSize = 0; if (otherIdentifyingInfoArray != null) { otherIdentifyingInfoSize = otherIdentifyingInfoArray.length; } // this.logger.debug("otherIdentifyingInfoSize = " + otherIdentifyingInfoSize); Vector otherIdentifyingInfoString = new Vector(); for (int y = 0; y < otherIdentifyingInfoSize; ++y) { String otherIdentifyingInfoValue = otherIdentifyingInfoArray[y].toString(); otherIdentifyingInfoString.add(otherIdentifyingInfoValue); } otherIdentifyingInfoFinal = this.cim_Q.buildStringFromVector(otherIdentifyingInfoString, ","); // this.logger.info("OtherIdentifyingInfo = " + otherIdentifyingInfoFinal); } catch (Exception e) { // this.logger.error("OtherIdentifyingInfo", e); } String identifyingDescriptionsFinal = null; try { String[] identifyingDescriptionsArray = this.cim_DT.getStringArrayPropertyValue(ci, "IdentifyingDescriptions"); int identifyingDescriptionsSize = 0; if (identifyingDescriptionsArray != null) { identifyingDescriptionsSize = identifyingDescriptionsArray.length; } // this.logger.debug("identifyingDescriptinsSize = " + identifyingDescriptionsSize); Vector identifyingDescriptionsString = new Vector(); for (int y = 0; y < identifyingDescriptionsSize; ++y) { String identfyingDescriptionsValue = identifyingDescriptionsArray[y].toString(); identifyingDescriptionsString.add(identfyingDescriptionsValue); } identifyingDescriptionsFinal = this.cim_Q.buildStringFromVector(identifyingDescriptionsString, ","); // this.logger.info("IdentifyingDescriptions = " + identifyingDescriptionsFinal); } catch (Exception e) { // this.logger.error("IdentifyingDescriptions", e); } try { enabledState = Integer.parseInt( this.cim_DT .getCIMInstancePropertyUnsignedInt16Value(ci, "enabledState") .toString()); } catch (Exception e) { // this.logger.warn("enabledState does not exist for CIMOM = " + enumerationNameKey); } // this.logger.debug("description = " + description + // " operationalStatus = " + operationalStatus + " statusDescriptions = " + // statusDescriptions + // " enabledState = " + enabledState); this.cs.setName(enumerationNameKey); this.cs.setCreationClassName(enumerationCreationClassNameKey); this.cs.setCaption(caption); this.cs.setDescription(description1); this.cs.setRequestedState(requestedState); this.cs.setElementName(elementName); this.cs.setStatusDescriptions(statusDescriptionsFinal); this.cs.setEnabledDefault(enabledDefault); this.cs.setNameFormat(nameFormat); this.cs.setEnabledState(enabledState); Calendar cal = Calendar.getInstance(); Date now = new Date(); this.cs.setTimeOfCreation(cal); this.cs.setTimeOfCreationString( DateFormat.getDateTimeInstance(3, 3).format(now).toString()); // Integer cimom_Id_Integer = new Integer(cimom_Id); // this.cs.setCimomID(cimom_Id_Integer); int dedicatedSize = 0; UnsignedInteger16 dedicatedFill = new UnsignedInteger16("555"); UnsignedInteger16[] dedicated = {dedicatedFill}; try { dedicated = this.cim_DT.getUint16ArrayPropertyValue(ci, "Dedicated"); if (dedicated != null) dedicatedSize = dedicated.length; } catch (Exception e) { // this.logger.error(this.CN, e); } // this.logger.info("dedicatedSize = " + dedicatedSize); int intDedicated1 = 0; int intDedicated2 = 0; int intDedicated3 = 0; int intDedicated4 = 0; int intDedicated5 = 0; this.cs.setDedicated("555"); String dedicated1; if (dedicatedSize == 1) { dedicated1 = dedicated[0].toString(); intDedicated1 = Integer.parseInt(dedicated1); this.cs.setDedicated(dedicated1); // this.logger.info("DedicateFilter1 = " + intDedicated1); } else { String dedicated2; if (dedicatedSize == 2) { dedicated1 = dedicated[0].toString(); intDedicated1 = Integer.parseInt(dedicated1); dedicated2 = dedicated[1].toString(); intDedicated2 = Integer.parseInt(dedicated2); this.cs.setDedicated(dedicated1 + "," + dedicated2); // this.logger.info("DedicateFilter1 = " + intDedicated1 + " DedicatedFilter2 = " + // intDedicated2); } else { String dedicated3; if (dedicatedSize == 3) { dedicated1 = dedicated[0].toString(); intDedicated1 = Integer.parseInt(dedicated1); dedicated2 = dedicated[1].toString(); intDedicated2 = Integer.parseInt(dedicated2); dedicated3 = dedicated[2].toString(); intDedicated3 = Integer.parseInt(dedicated3); this.cs.setDedicated(dedicated1 + "," + dedicated2 + "," + dedicated3); // this.logger.info("DedicateFilter1 = " + intDedicated1 + " DedicatedFilter2 = " + // intDedicated2 + " DedicatedFilter3 = " + intDedicated3); } else { String dedicated4; if (dedicatedSize == 4) { dedicated1 = dedicated[0].toString(); intDedicated1 = Integer.parseInt(dedicated1); dedicated2 = dedicated[1].toString(); intDedicated2 = Integer.parseInt(dedicated2); dedicated3 = dedicated[2].toString(); intDedicated3 = Integer.parseInt(dedicated3); dedicated4 = dedicated[3].toString(); intDedicated4 = Integer.parseInt(dedicated4); this.cs.setDedicated( dedicated1 + "," + dedicated2 + "," + dedicated3 + "," + dedicated4); // this.logger.info("DedicateFilter1 = " + intDedicated1 + " DedicatedFilter2 = " // + intDedicated2 + " DedicateFilter3 = " + intDedicated3 + " DedicatedFilter4 = // " + intDedicated4); } else if (dedicatedSize == 5) { dedicated1 = dedicated[0].toString(); intDedicated1 = Integer.parseInt(dedicated1); dedicated2 = dedicated[1].toString(); intDedicated2 = Integer.parseInt(dedicated2); dedicated3 = dedicated[2].toString(); intDedicated3 = Integer.parseInt(dedicated3); dedicated4 = dedicated[3].toString(); intDedicated4 = Integer.parseInt(dedicated4); String dedicated5 = dedicated[4].toString(); intDedicated5 = Integer.parseInt(dedicated5); this.cs.setDedicated( dedicated1 + "," + dedicated2 + "," + dedicated3 + "," + dedicated4 + "," + dedicated5); // this.logger.info("DedicateFilter1 = " + intDedicated1 + " DedicatedFilter2 = " // + intDedicated2 + " DedicateFilter3 = " + intDedicated3 + " DedicatedFilter4 = // " + intDedicated4 + " DedicatedFilter5 = " + intDedicated5); } } } } // this.logger.info("Dedicated = " + this.cs.getDedicated()); // this.logger.info("------------------------------------------COMPUTER SYSTEM // END------------------------------------------"); try { CloseableIterator cim_PhysicalPackageEnum = cc.associators( instanceCOP, "CIM_SystemPackaging", "CIM_PhysicalPackage", "Dependent", "Antecedent", false, false, null); this.fujitsuE6000Model = false; this.ibm511Model = false; this.netappManufacturer = false; while (cim_PhysicalPackageEnum.hasNext()) { // this.logger.debug(this.CN + " Enumerated PhysicalPackage and has more elements"); CIMInstance cim_PhysicalPackageCI = (CIMInstance) cim_PhysicalPackageEnum.next(); this.fujitsuE6000Model = false; this.ibm511Model = false; if (cim_PhysicalPackageEnum == null) continue; try { this.model = this.cim_DT.getCIMInstancePropertyValueString(cim_PhysicalPackageCI, "Model"); this.fujitsuE6000Model = this.model.startsWith("E6000"); this.ibm511Model = this.model.startsWith("511"); this.ibm921Model = this.model.startsWith("921"); this.ibm931Model = this.model.startsWith("931"); } catch (NullPointerException npe) { this.model = null; } try { this.manufacturer = this.cim_DT.getCIMInstancePropertyValueString( cim_PhysicalPackageCI, "Manufacturer"); this.netappManufacturer = this.manufacturer.startsWith("Network Appliance"); } catch (NullPointerException npe) { this.manufacturer = null; } } } catch (Exception e) { // this.logger.warn("No Physical Package for " + this.cs.getCreationClassName()); } if ((!(this.cs.getDedicated().equals("555"))) && (!(this.cs.getCreationClassName().equals("LSISSI_StorageProcessorSystem"))) && (!(this.cs.getCreationClassName().equals("HPEVA_StorageProcessorSystem"))) && (!(this.cs.getCreationClassName().equals("HITACHI_StorageProcessorSystem"))) && (!(this.cs.getCreationClassName().equals("Brocade_PhysicalComputerSystem"))) && (!(this.cs.getCreationClassName().equals("CISCO_LogicalComputerSystem"))) && (!(this.cs.getCreationClassName().equals("SunStorEdge_DSPStorageProcessorSystem"))) && (!(this.cs.getCreationClassName().equals("OpenWBEM_UnitaryComputerSystem"))) && (!(this.cs.getCreationClassName().equals("IBMTSSVC_IOGroup"))) && (!(this.cs.getCreationClassName().equals("HPMSA_ArrayController"))) && (((this.cs.getDedicated().equals("3,15")) || (this.cs.getDedicated().equals("15,3")) || (this.cs.getDedicated().equals("3")) || (this.cs.getDedicated().equals("0")) || (this.cs.getDedicated().equals("3,15,16,25")) || (this.cs.getDedicated().equals("3,15,16,21,25")) || (this.cs.getDedicated().equals("3,15,25")) || (this.cs.getDedicated().equals("15")) || (this.cs.getDedicated().equals("5")) || (this.cs.getDedicated().equals("3,22")) || (this.cs.getDedicated().equals("3,15,21")) || (this.cs.getDedicated().equals("15,21"))))) { // session.save(this.cs); /* String computerSystemID = session.getIdentifier(this.cs).toString(); Integer computerSystemIDp = Integer.valueOf(computerSystemID); setComputerSystemIDFinal(computerSystemIDp); */ // this.logger.debug("computerSystemIDp = " + computerSystemIDp); ///// && (computerSystemIDp != null) if ((enumerationNameKey != null) && (dedicated != null)) { // this.logger.info("Started Discovery For " + this.cs.getCreationClassName()); if (((intDedicated1 == 3) && (intDedicated2 == 15) && (intDedicated3 != 25)) || ((intDedicated1 == 15) && (intDedicated2 == 3) && (intDedicated3 != 25))) { if (this.cs.getCreationClassName().equals("Symm_StorageSystem")) { this.mapSymmDD = new MapSymmetrixDiskDrives(cc, instanceCOP, this.cs); } else { this.mapDD = new MapDiskDrives(cc, instanceCOP, this.cs); } this.mapIP = new MapInitiatorPorts(cc, instanceCOP, this.cs); if ((this.fujitsuE6000Model) || (this.ibm511Model) || (this.ibm921Model) || (this.ibm931Model) || (this.netappManufacturer)) { this.mapFujitsuFCP = new MapFCPortsFujitsuE6000(cc, instanceCOP, cs); } else { this.mapFCP = new MMapFCPorts(cc, instanceCOP, this.cs, ""); } this.mapV = new MMapVolumes(cc, instanceCOP, this.cs, ""); this.mapPP = new MapPhysicalPackages(cc, instanceCOP, this.cs); this.mapSI = new MapSoftwareIdentity(cc, instanceCOP, this.cs); this.mapAS = new MapArrayStats(cc, instanceCOP, this.cs); } else if ((intDedicated1 == 15) && (intDedicated2 == 21)) { this.mapFCP = new MMapFCPorts(cc, instanceCOP, this.cs, this.ftag); this.mapV = new MMapVolumes(cc, instanceCOP, this.cs, this.ftag); } else if (intDedicated1 == 0) { if (this.cs.getCreationClassName().equals("Linux_ComputerSystem")) { // this.logger.debug("Host For Linux"); // this.mapBase = new MapBase(session, cc, instanceCOP, // computerSystemIDp); // this.mapFSVol = new MapFSVol(session, cc, instanceCOP, // computerSystemIDp); // this.mapNetwork = new MapNetwork(session, cc, instanceCOP, // computerSystemIDp); } else { // this.logger.debug("Host For FCHBA"); // session, , computerSystemIDp this.mapHBA = new MapHBA(cc, instanceCOP, this.cs); } } else if ((intDedicated1 == 5) && (!(this.cs.getCreationClassName().equals("CISCO_LogicalComputerSystem")))) { if ((this.cs.getElementName() != null) || (!(this.cs.getElementName().equals("")))) { // this.logger.debug("Switch"); this.mapSwitchPP = new MapSwitchPhysicalPackages(cc, instanceCOP, cs); this.mapSwitchSI = new MapSwitchSoftwareIdentity(cc, instanceCOP, cs); this.mapSwitchFCP = new MapSwitchFCPorts(cc, instanceCOP, cs); this.mapSwitchF = new MapSwitchFabric(cc, instanceCOP, cs); } } else if ((intDedicated1 == 3) && (intDedicated2 == 22)) { // this.logger.debug("Tape"); // this.mapPhysicalPackagesTape = new // MapPhysicalPackagesTape(session, cc, instanceCOP, computerSystemIDp); // this.mapSoftwareIdentityTape = new // MapSoftwareIdentityTape(session, cc, instanceCOP, computerSystemIDp); // this.mapMediaAccessDevicesTape = new // MapMediaAccessDevicesTape(session, cc, instanceCOP, computerSystemIDp); // this.mapChangerDeviceTape = new MapChangerDeviceTape(session, cc, // instanceCOP, computerSystemIDp); // this.mapAccessPointsTape = new MapAccessPointsTape(session, cc, // instanceCOP, computerSystemIDp); // this.mapFCPortsTape = new MapFCPortsTape(session, cc, // instanceCOP, computerSystemIDp); // this.mapLimitedAccessPortTape = new MapLimitedAccessPort(session, // cc, instanceCOP, computerSystemIDp); } else if ((intDedicated1 == 3) && (intDedicated2 == 15) && (intDedicated3 == 25)) { // new MapNASDiskDrives(session, cc, instanceCOP, // computerSystemIDp); // new MapNASInitiatorPorts(session, cc, instanceCOP, // computerSystemIDp); // new MapNASFCPorts(session, cc, instanceCOP, computerSystemIDp); // new MapNASVolumes(session, cc, instanceCOP, computerSystemIDp); // new MapNASPhysicalPackages(session, cc, instanceCOP, // computerSystemIDp); // new MapNASSoftwareIdentity(session, cc, instanceCOP, // computerSystemIDp); } else if ((intDedicated1 == 15) && (this.cs.getCreationClassName().equals("VMWARE_ESXComputerSystem"))) { // this.logger.debug("VMWare"); // this.mapVM = new MapVirtualMachines(session, cc, instanceCOP, computerSystemIDp); // this.mapESXStorageExtents = new MapESXStorageExtents(session, cc, instanceCOP, // computerSystemIDp); // this.mapESXStoragePools = new MapESXStoragePools(session, cc, instanceCOP, // computerSystemIDp); // this.mapESXStorageVolumes = new MapESXStorageVolumes(session, cc, instanceCOP, // computerSystemIDp); } else { // this.logger.info("NOTHING"); } // this.logger.info("Finished Discovery For " + this.cs.getCreationClassName()); } } try { /* Calendar statCalAfter = Calendar.getInstance(); long msAfterforTotalDisc = statCalAfter.getTimeInMillis(); long totalDiscoveryTimeFinal = (msAfterforTotalDisc - msBeforeforTotalDisc) / 1000L; //this.logger.info("MSAFTERTIME = " + msAfterforTotalDisc + "MSBEFORE = " + msBeforeforTotalDisc); //this.logger.info("Discovery Time = " + totalDiscoveryTimeFinal); //this.logger.info("COMUTERSYSTEMID = " + getComputerSystemIDFinal()); CIM_ComputerSystem ccs1 = (CIM_ComputerSystem)session.get(CIM_ComputerSystem.class, getComputerSystemIDFinal()); ccs1.setTotalDiscoveryTime(Long.valueOf(totalDiscoveryTimeFinal)); //session.save(ccs1); setComputerSystemIDFinal(null); */ } catch (Exception localException3) { } } // session.getTransaction().commit(); // session.close(); // session.disconnect(); // session.flush(); // close session. if (cc != null) cc.close(); // Call the garbage collection to run // System.gc(); } catch (WBEMException ce) { ce.printStackTrace(); // logger.warn("Unable to login at this time"); } catch (Exception e) { e.printStackTrace(); e.getCause(); } finally { // session.close(); } } else { // logger.info("Unable to login at this time"); } }