Merge "remove enable_persistency from configuration."

This commit is contained in:
Zuul 2018-07-26 10:52:42 +00:00 committed by Gerrit Code Review
commit f3e305fe5a
6 changed files with 4 additions and 30 deletions

View File

@ -69,9 +69,6 @@ changes_interval = 5
[datasources] [datasources]
snapshots_interval = 120 snapshots_interval = 120
[persistency]
enable_persistency=true
EOF EOF
)" )"

View File

@ -60,9 +60,6 @@ volumes_per_instance=2
vitrage_alarms_per_instance=0 vitrage_alarms_per_instance=0
tripleo_controllers=3 tripleo_controllers=3
zabbix_alarms_per_controller=1 zabbix_alarms_per_controller=1
[persistency]
enable_persistency=true
EOF EOF
)" )"

View File

@ -33,12 +33,8 @@ class GraphPersistency(object):
self.conf = conf self.conf = conf
self.db = db self.db = db
self.graph = graph self.graph = graph
self.enabled = conf.persistency.enable_persistency
def store_graph(self): def store_graph(self):
if not self.enabled:
return
LOG.info('Persisting graph...') LOG.info('Persisting graph...')
try: try:
last_event_id = self.db.events.get_last_event_id() last_event_id = self.db.events.get_last_event_id()
@ -59,8 +55,6 @@ class GraphPersistency(object):
return t return t
def query_recent_snapshot(self): def query_recent_snapshot(self):
if not self.enabled:
return
timestamp = self._recent_snapshot_time() timestamp = self._recent_snapshot_time()
return self.db.graph_snapshots.query(timestamp=timestamp) return self.db.graph_snapshots.query(timestamp=timestamp)
@ -88,10 +82,8 @@ class GraphPersistency(object):
def persist_event(self, before, current, is_vertex, graph, event_id=None): def persist_event(self, before, current, is_vertex, graph, event_id=None):
"""Callback subscribed to driver.graph updates""" """Callback subscribed to driver.graph updates"""
if not self.enabled or\ if not self.is_important_change(
not self.is_important_change(before, before, current, VProps.UPDATE_TIMESTAMP,
current,
VProps.UPDATE_TIMESTAMP,
VProps.VITRAGE_SAMPLE_TIMESTAMP): VProps.VITRAGE_SAMPLE_TIMESTAMP):
return return

View File

@ -17,9 +17,5 @@ from oslo_config import cfg
OPTS = [ OPTS = [
cfg.StrOpt('persistor_topic', cfg.StrOpt('persistor_topic',
default='vitrage_persistor', default='vitrage_persistor',
help='The topic on which event will be sent from the ' help='persistor will listen on this topic for events to store'),
'datasources to the persistor'),
cfg.BoolOpt('enable_persistency',
default=False,
help='Periodically store entity graph snapshot to database'),
] ]

View File

@ -34,7 +34,6 @@ class TestGraphPersistor(TestFunctionalBase, TestConfiguration):
cls.conf = cfg.ConfigOpts() cls.conf = cfg.ConfigOpts()
cls.conf.register_opts(cls.PROCESSOR_OPTS, group='entity_graph') cls.conf.register_opts(cls.PROCESSOR_OPTS, group='entity_graph')
cls.conf.register_opts(cls.DATASOURCES_OPTS, group='datasources') cls.conf.register_opts(cls.DATASOURCES_OPTS, group='datasources')
cls.conf.register_opts(cls.PERSISTENCY_OPTS, group='persistency')
cls.add_db(cls.conf) cls.add_db(cls.conf)
cls.load_datasources(cls.conf) cls.load_datasources(cls.conf)
graph_persistency.EPSILON = 0.1 graph_persistency.EPSILON = 0.1

View File

@ -60,13 +60,6 @@ class TestEntityGraphUnitBase(base.BaseTest):
min=1) min=1)
] ]
PERSISTENCY_OPTS = [
cfg.StrOpt('persistor_topic',
default=None),
cfg.BoolOpt('enable_persistency',
default=True),
]
NUM_CLUSTERS = 1 NUM_CLUSTERS = 1
NUM_ZONES = 2 NUM_ZONES = 2
NUM_HOSTS = 4 NUM_HOSTS = 4