From 0c7a52b62450197dc3cdce3c7ea1755b6ae89110 Mon Sep 17 00:00:00 2001 From: Kaifeng Wang Date: Wed, 8 Aug 2018 17:41:49 +0800 Subject: [PATCH] Remove deprecated option node_status_keep_time [DEFAULT]node_status_keep_time is deprecated long ago [1], this patch removes it so that inspector will not automatically remove node status in regards to configuration option. This also make sense when we use other store backends in the future. Change-Id: I8261ce115fdb03ffcfe3a1cc4ca7c8ec747be832 Related-Bug: #1695858 --- ironic_inspector/conf/default.py | 7 ------ ironic_inspector/node_cache.py | 11 +-------- ironic_inspector/test/unit/test_node_cache.py | 24 ------------------- ...opt-keep-node-status-7d6b96f1a6e498a8.yaml | 5 ++++ 4 files changed, 6 insertions(+), 41 deletions(-) create mode 100644 releasenotes/notes/remove-opt-keep-node-status-7d6b96f1a6e498a8.yaml diff --git a/ironic_inspector/conf/default.py b/ironic_inspector/conf/default.py index 5c7c75a97..b840341be 100644 --- a/ironic_inspector/conf/default.py +++ b/ironic_inspector/conf/default.py @@ -33,13 +33,6 @@ _OPTS = [ default=3600, help=_('Timeout after which introspection is considered ' 'failed, set to 0 to disable.')), - cfg.IntOpt('node_status_keep_time', - default=0, - help=_('For how much time (in seconds) to keep status ' - 'information about nodes after introspection was ' - 'finished for them. Set to 0 (the default) ' - 'to disable the timeout.'), - deprecated_for_removal=True), cfg.IntOpt('clean_up_period', default=60, help=_('Amount of time in seconds, after which repeat clean up ' diff --git a/ironic_inspector/node_cache.py b/ironic_inspector/node_cache.py index 4dcc78b21..3e9ca3e83 100644 --- a/ironic_inspector/node_cache.py +++ b/ironic_inspector/node_cache.py @@ -874,19 +874,10 @@ def find_node(**attributes): def clean_up(): """Clean up the cache. - * Finish introspection for timed out nodes. - * Drop outdated node status information. + Finish introspection for timed out nodes. :return: list of timed out node UUID's """ - if CONF.node_status_keep_time > 0: - status_keep_threshold = (timeutils.utcnow() - datetime.timedelta( - seconds=CONF.node_status_keep_time)) - with db.ensure_transaction() as session: - db.model_query(db.Node, session=session).filter( - db.Node.finished_at.isnot(None), - db.Node.finished_at < status_keep_threshold).delete() - timeout = CONF.timeout if timeout <= 0: return [] diff --git a/ironic_inspector/test/unit/test_node_cache.py b/ironic_inspector/test/unit/test_node_cache.py index 8bddf32c8..9ad9b6ff5 100644 --- a/ironic_inspector/test/unit/test_node_cache.py +++ b/ironic_inspector/test/unit/test_node_cache.py @@ -413,30 +413,6 @@ class TestNodeCacheCleanUp(test_base.NodeTest): [(istate.States.error, current_time, 'Introspection timeout')], res) - def test_old_status(self): - CONF.set_override('node_status_keep_time', 42) - session = db.get_writer_session() - with session.begin(): - db.model_query(db.Node).update( - {'finished_at': (datetime.datetime.utcnow() - - datetime.timedelta(seconds=100))}) - - self.assertEqual([], node_cache.clean_up()) - - self.assertEqual([], db.model_query(db.Node).all()) - - def test_old_status_disabled(self): - # Status clean up is disabled by default - session = db.get_writer_session() - with session.begin(): - db.model_query(db.Node).update( - {'finished_at': (datetime.datetime.utcnow() - - datetime.timedelta(days=10000))}) - - self.assertEqual([], node_cache.clean_up()) - - self.assertNotEqual([], db.model_query(db.Node).all()) - class TestNodeCacheGetNode(test_base.NodeTest): def test_ok(self): diff --git a/releasenotes/notes/remove-opt-keep-node-status-7d6b96f1a6e498a8.yaml b/releasenotes/notes/remove-opt-keep-node-status-7d6b96f1a6e498a8.yaml new file mode 100644 index 000000000..23ac19c77 --- /dev/null +++ b/releasenotes/notes/remove-opt-keep-node-status-7d6b96f1a6e498a8.yaml @@ -0,0 +1,5 @@ +--- +upgrade: + - | + The deprecated configuration option ``[DEFAULT]node_status_keep_time`` + was removed.