summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZuul <zuul@review.openstack.org>2018-08-13 18:59:12 +0000
committerGerrit Code Review <review@openstack.org>2018-08-13 18:59:12 +0000
commitbe06e77dabbbd5ffa4ff48a1a676305c4db2f581 (patch)
treeb85cd00d35c0977553ae2135438424261c5fd772
parentd188c10791127ab6572dfd311c81776315ff4260 (diff)
parent0c7a52b62450197dc3cdce3c7ea1755b6ae89110 (diff)
Merge "Remove deprecated option node_status_keep_time"
-rw-r--r--ironic_inspector/conf/default.py7
-rw-r--r--ironic_inspector/node_cache.py11
-rw-r--r--ironic_inspector/test/unit/test_node_cache.py24
-rw-r--r--releasenotes/notes/remove-opt-keep-node-status-7d6b96f1a6e498a8.yaml5
4 files changed, 6 insertions, 41 deletions
diff --git a/ironic_inspector/conf/default.py b/ironic_inspector/conf/default.py
index 5c7c75a..b840341 100644
--- a/ironic_inspector/conf/default.py
+++ b/ironic_inspector/conf/default.py
@@ -33,13 +33,6 @@ _OPTS = [
33 default=3600, 33 default=3600,
34 help=_('Timeout after which introspection is considered ' 34 help=_('Timeout after which introspection is considered '
35 'failed, set to 0 to disable.')), 35 'failed, set to 0 to disable.')),
36 cfg.IntOpt('node_status_keep_time',
37 default=0,
38 help=_('For how much time (in seconds) to keep status '
39 'information about nodes after introspection was '
40 'finished for them. Set to 0 (the default) '
41 'to disable the timeout.'),
42 deprecated_for_removal=True),
43 cfg.IntOpt('clean_up_period', 36 cfg.IntOpt('clean_up_period',
44 default=60, 37 default=60,
45 help=_('Amount of time in seconds, after which repeat clean up ' 38 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 4dcc78b..3e9ca3e 100644
--- a/ironic_inspector/node_cache.py
+++ b/ironic_inspector/node_cache.py
@@ -874,19 +874,10 @@ def find_node(**attributes):
874def clean_up(): 874def clean_up():
875 """Clean up the cache. 875 """Clean up the cache.
876 876
877 * Finish introspection for timed out nodes. 877 Finish introspection for timed out nodes.
878 * Drop outdated node status information.
879 878
880 :return: list of timed out node UUID's 879 :return: list of timed out node UUID's
881 """ 880 """
882 if CONF.node_status_keep_time > 0:
883 status_keep_threshold = (timeutils.utcnow() - datetime.timedelta(
884 seconds=CONF.node_status_keep_time))
885 with db.ensure_transaction() as session:
886 db.model_query(db.Node, session=session).filter(
887 db.Node.finished_at.isnot(None),
888 db.Node.finished_at < status_keep_threshold).delete()
889
890 timeout = CONF.timeout 881 timeout = CONF.timeout
891 if timeout <= 0: 882 if timeout <= 0:
892 return [] 883 return []
diff --git a/ironic_inspector/test/unit/test_node_cache.py b/ironic_inspector/test/unit/test_node_cache.py
index 8bddf32..9ad9b6f 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):
413 [(istate.States.error, current_time, 'Introspection timeout')], 413 [(istate.States.error, current_time, 'Introspection timeout')],
414 res) 414 res)
415 415
416 def test_old_status(self):
417 CONF.set_override('node_status_keep_time', 42)
418 session = db.get_writer_session()
419 with session.begin():
420 db.model_query(db.Node).update(
421 {'finished_at': (datetime.datetime.utcnow() -
422 datetime.timedelta(seconds=100))})
423
424 self.assertEqual([], node_cache.clean_up())
425
426 self.assertEqual([], db.model_query(db.Node).all())
427
428 def test_old_status_disabled(self):
429 # Status clean up is disabled by default
430 session = db.get_writer_session()
431 with session.begin():
432 db.model_query(db.Node).update(
433 {'finished_at': (datetime.datetime.utcnow() -
434 datetime.timedelta(days=10000))})
435
436 self.assertEqual([], node_cache.clean_up())
437
438 self.assertNotEqual([], db.model_query(db.Node).all())
439
440 416
441class TestNodeCacheGetNode(test_base.NodeTest): 417class TestNodeCacheGetNode(test_base.NodeTest):
442 def test_ok(self): 418 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 0000000..23ac19c
--- /dev/null
+++ b/releasenotes/notes/remove-opt-keep-node-status-7d6b96f1a6e498a8.yaml
@@ -0,0 +1,5 @@
1---
2upgrade:
3 - |
4 The deprecated configuration option ``[DEFAULT]node_status_keep_time``
5 was removed.