Merge "Remove deprecated option node_status_keep_time"

This commit is contained in:
Zuul 2018-08-13 18:59:12 +00:00 committed by Gerrit Code Review
commit be06e77dab
4 changed files with 6 additions and 41 deletions

View File

@ -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 '

View File

@ -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 []

View File

@ -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):

View File

@ -0,0 +1,5 @@
---
upgrade:
- |
The deprecated configuration option ``[DEFAULT]node_status_keep_time``
was removed.