public static void setSystemResourcesIncompatible( DbClient dbClient, CoordinatorClient coordinator, URI storageSystemId) { // Mark all Pools as incompatible URIQueryResultList storagePoolURIs = new URIQueryResultList(); dbClient.queryByConstraint( ContainmentConstraint.Factory.getStorageDeviceStoragePoolConstraint(storageSystemId), storagePoolURIs); Iterator<URI> storagePoolIter = storagePoolURIs.iterator(); List<StoragePool> modifiedPools = new ArrayList<StoragePool>(); while (storagePoolIter.hasNext()) { StoragePool pool = dbClient.queryObject(StoragePool.class, storagePoolIter.next()); modifiedPools.add(pool); pool.setCompatibilityStatus(DiscoveredDataObject.CompatibilityStatus.INCOMPATIBLE.name()); dbClient.persistObject(pool); } ImplicitPoolMatcher.matchModifiedStoragePoolsWithAllVirtualPool( modifiedPools, dbClient, coordinator); ; // Mark all Ports as incompatible URIQueryResultList storagePortURIs = new URIQueryResultList(); dbClient.queryByConstraint( ContainmentConstraint.Factory.getStorageDeviceStoragePortConstraint(storageSystemId), storagePortURIs); Iterator<URI> storagePortIter = storagePortURIs.iterator(); while (storagePortIter.hasNext()) { StoragePort port = dbClient.queryObject(StoragePort.class, storagePortIter.next()); port.setCompatibilityStatus(DiscoveredDataObject.CompatibilityStatus.INCOMPATIBLE.name()); dbClient.persistObject(port); } }
/** * Verify the firmware version for the NetworkSystem * * @param uri - Device URI * @throws ControllerException thrown if firmware version is not supported */ public void verifyVersion(URI uri) throws ControllerException { // Retrieve the storage device info from the database. NetworkSystem networkDev = getDeviceObject(uri); NetworkSystemDevice networkDevice = getDevice(); if (networkDevice == null) { throw NetworkDeviceControllerException.exceptions.verifyVersionFailedNull(uri.toString()); } String version = null; try { version = networkDevice.getVersion(networkDev); networkDev.setVersion(version); String minimumSupportedVersion = VersionChecker.getMinimumSupportedVersion(Type.valueOf(networkDev.getSystemType())); _log.info( "Verifying version details : Minimum Supported Version {} - Discovered Firmware Version {}", minimumSupportedVersion, version); if (VersionChecker.verifyVersionDetails(minimumSupportedVersion, version) < 0) { networkDev.setCompatibilityStatus( DiscoveredDataObject.CompatibilityStatus.INCOMPATIBLE.name()); throw NetworkDeviceControllerException.exceptions.versionNotSupported( version, minimumSupportedVersion); } else { networkDev.setCompatibilityStatus( DiscoveredDataObject.CompatibilityStatus.COMPATIBLE.name()); } } catch (Exception ex) { Date date = new Date(); networkDev.setLastDiscoveryStatusMessage(ex.getMessage()); throw NetworkDeviceControllerException.exceptions.verifyVersionFailed( uri.toString(), date.toString(), ex); } finally { if (networkDev != null) { try { dbClient.persistObject(networkDev); } catch (DatabaseException ex) { _log.error("Error while persisting object to DB", ex); } } } }
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); } }