From 09a7f43927b9f7f4108bfaf1f49af97c811a6f87 Mon Sep 17 00:00:00 2001 From: Idan Hefetz Date: Wed, 25 Jul 2018 08:01:40 +0000 Subject: [PATCH] remove enable_persistency from configuration. Persistency wont be optional. This parameter was not used so far thus is simply removed, without deprecating it. Change-Id: I44baad84429c552b87364fa6659ca2ee193bef58 --- devstack/gate_hook.sh | 3 --- devstack/gate_hook_mock.sh | 3 --- vitrage/entity_graph/graph_persistency.py | 14 +++----------- vitrage/persistency/__init__.py | 6 +----- .../graph_persistor/test_graph_persistor.py | 1 - vitrage/tests/unit/entity_graph/base.py | 7 ------- 6 files changed, 4 insertions(+), 30 deletions(-) diff --git a/devstack/gate_hook.sh b/devstack/gate_hook.sh index 3215d29fb..2d2b85d9d 100644 --- a/devstack/gate_hook.sh +++ b/devstack/gate_hook.sh @@ -69,9 +69,6 @@ changes_interval = 5 [datasources] snapshots_interval = 120 - -[persistency] -enable_persistency=true EOF )" diff --git a/devstack/gate_hook_mock.sh b/devstack/gate_hook_mock.sh index 731068f8c..4831647ee 100644 --- a/devstack/gate_hook_mock.sh +++ b/devstack/gate_hook_mock.sh @@ -60,9 +60,6 @@ volumes_per_instance=2 vitrage_alarms_per_instance=0 tripleo_controllers=3 zabbix_alarms_per_controller=1 - -[persistency] -enable_persistency=true EOF )" diff --git a/vitrage/entity_graph/graph_persistency.py b/vitrage/entity_graph/graph_persistency.py index 156caeb71..ba8ac5a5b 100644 --- a/vitrage/entity_graph/graph_persistency.py +++ b/vitrage/entity_graph/graph_persistency.py @@ -33,12 +33,8 @@ class GraphPersistency(object): self.conf = conf self.db = db self.graph = graph - self.enabled = conf.persistency.enable_persistency def store_graph(self): - if not self.enabled: - return - LOG.info('Persisting graph...') try: last_event_id = self.db.events.get_last_event_id() @@ -59,8 +55,6 @@ class GraphPersistency(object): return t def query_recent_snapshot(self): - if not self.enabled: - return timestamp = self._recent_snapshot_time() return self.db.graph_snapshots.query(timestamp=timestamp) @@ -88,11 +82,9 @@ class GraphPersistency(object): def persist_event(self, before, current, is_vertex, graph, event_id=None): """Callback subscribed to driver.graph updates""" - if not self.enabled or\ - not self.is_important_change(before, - current, - VProps.UPDATE_TIMESTAMP, - VProps.VITRAGE_SAMPLE_TIMESTAMP): + if not self.is_important_change( + before, current, VProps.UPDATE_TIMESTAMP, + VProps.VITRAGE_SAMPLE_TIMESTAMP): return if is_vertex: diff --git a/vitrage/persistency/__init__.py b/vitrage/persistency/__init__.py index db8157379..355a41fec 100644 --- a/vitrage/persistency/__init__.py +++ b/vitrage/persistency/__init__.py @@ -17,9 +17,5 @@ from oslo_config import cfg OPTS = [ cfg.StrOpt('persistor_topic', default='vitrage_persistor', - help='The topic on which event will be sent from the ' - 'datasources to the persistor'), - cfg.BoolOpt('enable_persistency', - default=False, - help='Periodically store entity graph snapshot to database'), + help='persistor will listen on this topic for events to store'), ] diff --git a/vitrage/tests/functional/entity_graph/graph_persistor/test_graph_persistor.py b/vitrage/tests/functional/entity_graph/graph_persistor/test_graph_persistor.py index 0366c9959..a0abea6d0 100644 --- a/vitrage/tests/functional/entity_graph/graph_persistor/test_graph_persistor.py +++ b/vitrage/tests/functional/entity_graph/graph_persistor/test_graph_persistor.py @@ -34,7 +34,6 @@ class TestGraphPersistor(TestFunctionalBase, TestConfiguration): cls.conf = cfg.ConfigOpts() cls.conf.register_opts(cls.PROCESSOR_OPTS, group='entity_graph') cls.conf.register_opts(cls.DATASOURCES_OPTS, group='datasources') - cls.conf.register_opts(cls.PERSISTENCY_OPTS, group='persistency') cls.add_db(cls.conf) cls.load_datasources(cls.conf) graph_persistency.EPSILON = 0.1 diff --git a/vitrage/tests/unit/entity_graph/base.py b/vitrage/tests/unit/entity_graph/base.py index 321a9b31a..f146e7ff1 100644 --- a/vitrage/tests/unit/entity_graph/base.py +++ b/vitrage/tests/unit/entity_graph/base.py @@ -60,13 +60,6 @@ class TestEntityGraphUnitBase(base.BaseTest): min=1) ] - PERSISTENCY_OPTS = [ - cfg.StrOpt('persistor_topic', - default=None), - cfg.BoolOpt('enable_persistency', - default=True), - ] - NUM_CLUSTERS = 1 NUM_ZONES = 2 NUM_HOSTS = 4