Move datasource query_retry into baseclass.

Moves the query_retry method into the baseclass and makes the query
retry and timeout options part of the watcher_datasources config group.
This makes the query_retry behavior uniform across all datasources.

A new baseclass method named query_retry_reset is added so datasources
can define operations to perform when recovering from a query error.
Test cases are added to verify the behavior of query_retry.

The query_max_retries and query_timeout config parameters are
deprecated in the gnocchi_client group and will be removed in a future
release.

Change-Id: I33e9dc2d1f5ba8f83fcf1488ff583ca5be5529cc
This commit is contained in:
Dantali0n
2019-05-29 15:16:15 +02:00
parent 46a36d1ad7
commit 584eeefdc8
9 changed files with 141 additions and 43 deletions

View File

@@ -34,7 +34,19 @@ DATASOURCES_OPTS = [
" the default for all strategies unless a strategy has a"
" specific override.",
item_type=cfg.types.String(choices=possible_datasources),
default=possible_datasources)
default=possible_datasources),
cfg.IntOpt('query_max_retries',
min=1,
default=10,
mutable=True,
help='How many times Watcher is trying to query again',
deprecated_group="gnocchi_client"),
cfg.IntOpt('query_timeout',
min=0,
default=1,
mutable=True,
help='How many seconds Watcher should wait to do query again',
deprecated_group="gnocchi_client")
]

View File

@@ -32,15 +32,8 @@ GNOCCHI_CLIENT_OPTS = [
'The default is public.'),
cfg.StrOpt('region_name',
help='Region in Identity service catalog to use for '
'communication with the OpenStack service.'),
cfg.IntOpt('query_max_retries',
default=10,
mutable=True,
help='How many times Watcher is trying to query again'),
cfg.IntOpt('query_timeout',
default=1,
mutable=True,
help='How many seconds Watcher should wait to do query again')]
'communication with the OpenStack service.')
]
def register_opts(conf):