8484 * <p>Runs are booked one at a time: after each cycle starts, the next run is scheduled for
8585 * {@link OntapConfigurationManager#AsupIntervalHours} after that start, so production
8686 * intervals (hours) are start-to-start. REST work sits inside the interval; it is not added
87- * after it. Editing either ONTAP ASUP setting re-books the pending run immediately, with no
87+ * after it. Editing the ONTAP ASUP interval re-books the pending run immediately, with no
8888 * management-server restart.</p>
8989 */
9090public class OntapAsupManager extends ManagerBase {
@@ -143,7 +143,7 @@ public class OntapAsupManager extends ManagerBase {
143143 @ Override
144144 public boolean configure (String name , Map <String , Object > params ) throws ConfigurationException {
145145 super .configure (name , params );
146- // React to edits of the ONTAP ASUP settings so a new interval re-books the pending run
146+ // React to edits of ontap.autosupport.interval so a new value re-books the pending run
147147 // instead of waiting for it to fire on the old schedule.
148148 messageBus .subscribe (EventTypes .EVENT_CONFIGURATION_VALUE_EDIT , this ::onAsupConfigEdited );
149149 return true ;
@@ -152,8 +152,7 @@ public boolean configure(String name, Map<String, Object> params) throws Configu
152152 @ Override
153153 public boolean start () {
154154 asupScheduler = Executors .newSingleThreadScheduledExecutor (new NamedThreadFactory ("OntapAsup" ));
155- logger .info ("OntapAsupManager started; ASUP telemetry enabled={}, interval={}h" ,
156- OntapConfigurationManager .AsupEnabled .value (),
155+ logger .info ("OntapAsupManager started; ASUP telemetry interval={}h" ,
157156 getAsupIntervalHours (OntapConfigurationManager .AsupIntervalHours .value ()));
158157 scheduleNextRun ();
159158 return super .start ();
@@ -169,11 +168,12 @@ public boolean stop() {
169168
170169 /**
171170 * Books the single pending run for the moment the configured interval elapses, cancelling
172- * whatever was booked before. Called at start-up, after every run, and whenever one of the
173- * ONTAP ASUP settings is edited, so the live config always decides the next run.
171+ * whatever was booked before. Called at start-up, after every run, and whenever
172+ * {@code ontap.autosupport.interval} is edited, so the live config always decides the next run.
174173 *
175- * <p>When ASUP is disabled nothing is booked; re-enabling it publishes a configuration-edit
176- * event, which books a run again.</p>
174+ * <p>When the interval is {@link OntapStorageConstants#ASUP_DISABLED_INTERVAL_HOURS}
175+ * nothing is booked; setting a non-zero interval publishes a configuration-edit event,
176+ * which books a run again.</p>
177177 */
178178 private synchronized void scheduleNextRun () {
179179 if (asupScheduler == null || asupScheduler .isShutdown ()) {
@@ -183,9 +183,11 @@ private synchronized void scheduleNextRun() {
183183 pendingRun .cancel (false );
184184 pendingRun = null ;
185185 }
186- if (Boolean .FALSE .equals (OntapConfigurationManager .AsupEnabled .value ())) {
187- logger .debug ("ONTAP ASUP: telemetry is disabled ({}=false); no run scheduled." ,
188- OntapConfigurationManager .AsupEnabled .key ());
186+ int intervalHours = getAsupIntervalHours (OntapConfigurationManager .AsupIntervalHours .value ());
187+ if (intervalHours == OntapStorageConstants .ASUP_DISABLED_INTERVAL_HOURS ) {
188+ logger .debug ("ONTAP ASUP: telemetry is disabled ({}={}); no run scheduled." ,
189+ OntapStorageConstants .ASUP_INTERVAL_CONFIG_KEY ,
190+ OntapStorageConstants .ASUP_DISABLED_INTERVAL_HOURS );
189191 return ;
190192 }
191193 long delayMs = millisUntilNextPush ();
@@ -218,8 +220,7 @@ private void onAsupConfigEdited(String senderAddress, String subject, Object arg
218220 return ;
219221 }
220222 String updatedKey = ((Ternary <String , ConfigKey .Scope , Long >) args ).first ();
221- if (!OntapConfigurationManager .AsupEnabled .key ().equals (updatedKey )
222- && !OntapConfigurationManager .AsupIntervalHours .key ().equals (updatedKey )) {
223+ if (!OntapConfigurationManager .AsupIntervalHours .key ().equals (updatedKey )) {
223224 return ;
224225 }
225226 logger .debug ("ONTAP ASUP: [{}] was updated; re-booking the next push." , updatedKey );
@@ -618,15 +619,18 @@ private String defaultUnknown(String value) {
618619 }
619620
620621 /**
621- * Returns a usable interval in hours. Out-of-range or missing DB values
622- * (for example set outside the API) fall back to the default so ASUP is not
623- * sent on an unintended cadence. The scheduler converts this to seconds via
624- * {@link Duration#ofHours(long)}.
622+ * Returns a usable interval in hours. {@link OntapStorageConstants#ASUP_DISABLED_INTERVAL_HOURS}
623+ * means telemetry is off. Out-of-range or missing DB values (for example set outside the API)
624+ * fall back to the default so ASUP is not sent on an unintended cadence. The scheduler
625+ * converts a non-zero value to seconds via {@link Duration#ofHours(long)}.
625626 */
626627 int getAsupIntervalHours (Integer configured ) {
627628 if (configured == null ) {
628629 return OntapStorageConstants .ASUP_DEFAULT_INTERVAL_HOURS ;
629630 }
631+ if (configured == OntapStorageConstants .ASUP_DISABLED_INTERVAL_HOURS ) {
632+ return OntapStorageConstants .ASUP_DISABLED_INTERVAL_HOURS ;
633+ }
630634 if (configured < OntapStorageConstants .ASUP_MIN_INTERVAL_HOURS
631635 || configured > OntapStorageConstants .ASUP_MAX_INTERVAL_HOURS ) {
632636 logger .warn ("ONTAP ASUP: {} value [{}] is outside [{}-{}]; using default [{}]" ,
0 commit comments