From 2f828aed46656a64e0cbb6a4b67f1ea56a57aac6 Mon Sep 17 00:00:00 2001 From: Julia Kreger Date: Thu, 11 Jun 2020 11:46:35 -0700 Subject: [PATCH] Allow operators to disable clean_up sync Some operators simply don't need the periodic clean up sync task as part of their ironic deployment with ironic-inspector as they are not using the PXE filtering to manage access for machines as part of discovery. In these "standalone" use cases, there is typically no neutron, and everything is managed externally from ironic-inspector. Change-Id: I0036b2cdb7d562e90855ccabd108392f2f97c6f9 --- ironic_inspector/conductor/manager.py | 6 ++++-- ironic_inspector/conf/default.py | 11 +++++++++-- ...ty-to-turn-off-periodic-sync-5309ff2aa8a9ec14.yaml | 8 ++++++++ 3 files changed, 21 insertions(+), 4 deletions(-) create mode 100644 releasenotes/notes/ability-to-turn-off-periodic-sync-5309ff2aa8a9ec14.yaml diff --git a/ironic_inspector/conductor/manager.py b/ironic_inspector/conductor/manager.py index 55cf897fb..884ad4883 100644 --- a/ironic_inspector/conductor/manager.py +++ b/ironic_inspector/conductor/manager.py @@ -81,11 +81,13 @@ class ConductorManager(object): driver.init_filter() periodic_clean_up_ = periodics.periodic( - spacing=CONF.clean_up_period + spacing=CONF.clean_up_period, + enabled=(CONF.clean_up_period != 0) )(periodic_clean_up) sync_with_ironic_ = periodics.periodic( - spacing=CONF.clean_up_period + spacing=CONF.clean_up_period, + enabled=(CONF.clean_up_period != 0) )(sync_with_ironic) callables = [(periodic_clean_up_, None, None), diff --git a/ironic_inspector/conf/default.py b/ironic_inspector/conf/default.py index 4b25fe422..1fdae690c 100644 --- a/ironic_inspector/conf/default.py +++ b/ironic_inspector/conf/default.py @@ -55,8 +55,15 @@ _OPTS = [ 'failed, set to 0 to disable.')), cfg.IntOpt('clean_up_period', default=60, + min=0, help=_('Amount of time in seconds, after which repeat clean up ' - 'of timed out nodes and old nodes status information.')), + 'of timed out nodes and old nodes status information. ' + 'WARNING: If set to a value of 0, then the periodic ' + 'task is disabled and inspector will not sync with ' + 'ironic to complete the internal clean-up process. ' + 'Not advisable if the deployment uses a PXE filter, ' + 'and will result in the ironic-inspector ceasing ' + 'periodic cleanup activities.')), cfg.BoolOpt('use_ssl', default=False, help=_('SSL Enabled/Disabled')), @@ -90,7 +97,7 @@ _OPTS = [ 'endpoint via multicast DNS.')), cfg.BoolOpt('standalone', default=True, help=_('Whether to run ironic-inspector as a standalone ' - 'service. It\'s EXPERIMENTAL to set to False.')) + 'service. It\'s EXPERIMENTAL to set to False.')), ] diff --git a/releasenotes/notes/ability-to-turn-off-periodic-sync-5309ff2aa8a9ec14.yaml b/releasenotes/notes/ability-to-turn-off-periodic-sync-5309ff2aa8a9ec14.yaml new file mode 100644 index 000000000..79ff9a927 --- /dev/null +++ b/releasenotes/notes/ability-to-turn-off-periodic-sync-5309ff2aa8a9ec14.yaml @@ -0,0 +1,8 @@ +--- +features: + - | + Adds the ability for periodic clean-up and synchronization tasks with + ``ironic`` to be able to be disabled by setting the + ``[DEFAULT]clean_up_period`` to a value of ``0``. This is intended for + "stand-alone" operators only as it may result in unexpected behaviors if + used in a non-standalone environment.