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
This commit is contained in:
parent
600784a91e
commit
0c7a52b624
@ -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 '
|
||||
|
@ -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 []
|
||||
|
@ -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):
|
||||
|
@ -0,0 +1,5 @@
|
||||
---
|
||||
upgrade:
|
||||
- |
|
||||
The deprecated configuration option ``[DEFAULT]node_status_keep_time``
|
||||
was removed.
|
Loading…
Reference in New Issue
Block a user