Merge "Remove deprecated option node_status_keep_time"
This commit is contained in:
commit
be06e77dab
|
@ -33,13 +33,6 @@ _OPTS = [
|
||||||
default=3600,
|
default=3600,
|
||||||
help=_('Timeout after which introspection is considered '
|
help=_('Timeout after which introspection is considered '
|
||||||
'failed, set to 0 to disable.')),
|
'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',
|
cfg.IntOpt('clean_up_period',
|
||||||
default=60,
|
default=60,
|
||||||
help=_('Amount of time in seconds, after which repeat clean up '
|
help=_('Amount of time in seconds, after which repeat clean up '
|
||||||
|
|
|
@ -874,19 +874,10 @@ def find_node(**attributes):
|
||||||
def clean_up():
|
def clean_up():
|
||||||
"""Clean up the cache.
|
"""Clean up the cache.
|
||||||
|
|
||||||
* Finish introspection for timed out nodes.
|
Finish introspection for timed out nodes.
|
||||||
* Drop outdated node status information.
|
|
||||||
|
|
||||||
:return: list of timed out node UUID's
|
: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
|
timeout = CONF.timeout
|
||||||
if timeout <= 0:
|
if timeout <= 0:
|
||||||
return []
|
return []
|
||||||
|
|
|
@ -413,30 +413,6 @@ class TestNodeCacheCleanUp(test_base.NodeTest):
|
||||||
[(istate.States.error, current_time, 'Introspection timeout')],
|
[(istate.States.error, current_time, 'Introspection timeout')],
|
||||||
res)
|
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):
|
class TestNodeCacheGetNode(test_base.NodeTest):
|
||||||
def test_ok(self):
|
def test_ok(self):
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
upgrade:
|
||||||
|
- |
|
||||||
|
The deprecated configuration option ``[DEFAULT]node_status_keep_time``
|
||||||
|
was removed.
|
Loading…
Reference in New Issue