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)

Change-Id: If39df7650ec514d4645e3eae30edc7b8ed0b5d1d
Closes-Bug: #1719236
  • Loading branch information
ZhiqiangCui committed Apr 25, 2018
1 parent 459a746 commit fdda437
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/opserver/opserver.py
Expand Up @@ -445,6 +445,7 @@ def _reject_auth_headers(self):
def __init__(self, args_str=' '.join(sys.argv[1:])):
self.gevs = []
self._args = None
self._usecache = True
self._parse_args(args_str)
print args_str

Expand Down Expand Up @@ -534,7 +535,6 @@ def __init__(self, args_str=' '.join(sys.argv[1:])):

# On olders version of linux, kafka cannot be
# relied upon. DO NOT use it to serve UVEs
self._usecache = True
(PLATFORM, VERSION, EXTRA) = platform.linux_distribution()
if PLATFORM.lower() == 'ubuntu':
if VERSION.find('12.') == 0:
Expand Down Expand Up @@ -849,6 +849,7 @@ def _parse_args(self, args_str=' '.join(sys.argv[1:])):
'admin_port' : OpServerAdminPort,
'cloud_admin_role' : CLOUD_ADMIN_ROLE,
'api_server_use_ssl': False,
'use_aggregated_uve_db' : 'true',
}
redis_opts = {
'redis_server_port' : 6379,
Expand Down Expand Up @@ -1009,6 +1010,8 @@ def _parse_args(self, args_str=' '.join(sys.argv[1:])):
help="Port with local auth for admin access")
parser.add_argument("--api_server_use_ssl",
help="Use SSL to connect with API server")
parser.add_argument("--use_aggregated_uve_db",
help="enable/disbale read uve from aggregated uve db")
self._args = parser.parse_args(remaining_argv)
if type(self._args.collectors) is str:
self._args.collectors = self._args.collectors.split()
Expand All @@ -1035,6 +1038,9 @@ def _parse_args(self, args_str=' '.join(sys.argv[1:])):
auth_conf_info['api_server_ip'] = api_server_info[0]
auth_conf_info['api_server_port'] = int(api_server_info[1])
self._args.auth_conf_info = auth_conf_info
if self._args.use_aggregated_uve_db.lower() == 'false' or\
self._args.use_aggregated_uve_db == '0':
self._usecache = False
# end _parse_args

def get_args(self):
Expand Down Expand Up @@ -2462,10 +2468,11 @@ def get_agp(self):
return self.agp

def run(self):
self._uvedbstream.start()
if self._usecache:
self._uvedbstream.start()
self.gevs.append(self._uvedbstream)

self.gevs += [
self._uvedbstream,
gevent.spawn(self.start_webserver),
gevent.spawn(self.start_uve_server),
]
Expand Down

0 comments on commit fdda437

Please sign in to comment.