@Override public void startMonitoring(AsyncTask task, Type deviceType) throws ControllerException { try { MonitoringJob job = new MonitoringJob(); job.setCompleter(new MonitorTaskCompleter(task)); job.setDeviceType(deviceType); ControllerServiceImpl.enqueueMonitoringJob(job); } catch (Exception e) { throw ClientControllerException.fatals.unableToMonitorSMISProvider( task, deviceType.toString(), e); } }
/** * 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); } } } }