Skip to content

Commit

Permalink
Add new config option use_aggregated_uve_db
Browse files Browse the repository at this point in the history
    Provide an option to enable/disable serve UVE queries from the aggregated
    UVE db. In a scale setup, HA event (alarm-gen down), alarm-gen may take a
    long time to aggregate the UVEs depending on the number of UVEs, number
    of partitions it owns, etc., So, enabling this option would reduce the
    down time in case of HA events (collector down - time taken for generators
     to connect to the new collector and resync the UVEs, alarm-gen down - no
    impact on UVE queries, only the alarms would be reevaluated)

    This commit fix bug: legacy get_alarm do not use _usecache flag

    Closes-Bug: #1719236

Change-Id: I03dcee1a1b4103587197774cccd2901e4faa3a42
  • Loading branch information
ZhiqiangCui committed Jun 29, 2018
1 parent 6c60236 commit 5901f91
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions src/opserver/uveserver.py
Expand Up @@ -358,15 +358,32 @@ def get_uve_regex(self, key):
# end get_uve_regex

def get_alarms(self, filters):
tables = filters.get('tablefilt')
tablesfilt = filters.get('tablefilt')
kfilter = filters.get('kfilt')
patterns = None
if kfilter is not None:
patterns = set()
for filt in kfilter:
patterns.add(self.get_uve_regex(filt))

rsp = self._uvedbcache.get_uve_list(tables, filters, patterns, False)
if self._usecache:
rsp = self._uvedbcache.get_uve_list(tablesfilt, filters, patterns, False)
else:
tables = self.get_tables()
rsp = {}
uve_list = {}
for table in tables:
if tablesfilt is not None:
if table not in tablesfilt:
continue
uve_keys = self.get_uve_list(table, filters, False)
for uve_key in uve_keys:
_,uve_val = self.get_uve(
table + ':' + uve_key, True, filters)
if uve_val == {}:
continue
else:
uve_list[uve_key] = uve_val
rsp[table] = uve_list
return rsp
# end get_alarms

Expand Down

0 comments on commit 5901f91

Please sign in to comment.