Skip to content

Commit

Permalink
Move coordination_url option out of the storage section
Browse files Browse the repository at this point in the history
The coordination url is more used by the incoming driver for sacks than for the
storage. It has been there fore historical purpose. Move it out to DEFAULT.
  • Loading branch information
jd authored and pastamaker[bot] committed Oct 27, 2017
1 parent 1cefef0 commit 70b9ca4
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 20 deletions.
2 changes: 1 addition & 1 deletion devstack/plugin.sh
Expand Up @@ -215,7 +215,7 @@ function configure_gnocchi {
fi

if [ -n "$GNOCCHI_COORDINATOR_URL" ]; then
iniset $GNOCCHI_CONF storage coordination_url "$GNOCCHI_COORDINATOR_URL"
iniset $GNOCCHI_CONF coordination_url "$GNOCCHI_COORDINATOR_URL"
fi

if is_service_enabled gnocchi-statsd ; then
Expand Down
2 changes: 1 addition & 1 deletion gnocchi/cli/metricd.py
Expand Up @@ -66,7 +66,7 @@ def wakeup(self):

def _configure(self):
self.coord = retry_on_exception(get_coordinator_and_start,
self.conf.storage.coordination_url)
self.conf.coordination_url)
self.store = retry_on_exception(
storage.get_driver, self.conf, self.coord)
self.incoming = retry_on_exception(incoming.get_driver, self.conf)
Expand Down
7 changes: 6 additions & 1 deletion gnocchi/opts.py
Expand Up @@ -94,6 +94,11 @@ def __getitem__(self, key):
def list_opts():
return [
("DEFAULT", _cli_options + (
cfg.StrOpt(
'coordination_url',
secret=True,
deprecated_group="storage",
help='Coordination driver URL'),
cfg.IntOpt(
'parallel_operations',
min=1,
Expand Down Expand Up @@ -174,7 +179,7 @@ def list_opts():
'to force refresh of metric.'),
) + API_OPTS,
),
("storage", _STORAGE_OPTS + gnocchi.storage._CARBONARA_OPTS),
("storage", _STORAGE_OPTS),
("incoming", _INCOMING_OPTS),
("statsd", (
cfg.HostAddressOpt('host',
Expand Down
3 changes: 1 addition & 2 deletions gnocchi/rest/app.py
Expand Up @@ -93,8 +93,7 @@ def load_app(conf, indexer=None, storage=None, incoming=None, coord=None,
# NOTE(jd) This coordinator is never stop. I don't think it's a
# real problem since the Web app can never really be stopped
# anyway, except by quitting it entirely.
coord = metricd.get_coordinator_and_start(
conf.storage.coordination_url)
coord = metricd.get_coordinator_and_start(conf.coordination_url)
storage = gnocchi_storage.get_driver(conf, coord)
if not incoming:
incoming = gnocchi_incoming.get_driver(conf)
Expand Down
11 changes: 4 additions & 7 deletions gnocchi/service.py
Expand Up @@ -84,24 +84,21 @@ def prepare_service(args=None, conf=None,

# If no coordination URL is provided, default to using the indexer as
# coordinator
if conf.storage.coordination_url is None:
if conf.coordination_url is None:
if conf.storage.driver == "redis":
conf.set_default("coordination_url",
conf.storage.redis_url,
"storage")
conf.storage.redis_url)
elif conf.incoming.driver == "redis":
conf.set_default("coordination_url",
conf.incoming.redis_url,
"storage")
conf.incoming.redis_url)
else:
parsed = urlparse.urlparse(conf.indexer.url)
proto, _, _ = parsed.scheme.partition("+")
parsed = list(parsed)
# Set proto without the + part
parsed[0] = proto
conf.set_default("coordination_url",
urlparse.urlunparse(parsed),
"storage")
urlparse.urlunparse(parsed))

conf.log_opt_values(LOG, logging.DEBUG)

Expand Down
5 changes: 0 additions & 5 deletions gnocchi/storage/__init__.py
Expand Up @@ -35,11 +35,6 @@
help='Storage driver to use'),
]

_CARBONARA_OPTS = [
cfg.StrOpt('coordination_url',
secret=True,
help='Coordination driver URL'),
]

LOG = daiquiri.getLogger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion gnocchi/tests/base.py
Expand Up @@ -301,7 +301,7 @@ def setUpClass(self):
self.index = indexer.get_driver(self.conf)

self.coord = metricd.get_coordinator_and_start(
self.conf.storage.coordination_url)
self.conf.coordination_url)

# NOTE(jd) So, some driver, at least SQLAlchemy, can't create all
# their tables in a single transaction even with the
Expand Down
3 changes: 1 addition & 2 deletions gnocchi/tests/functional/fixtures.py
Expand Up @@ -127,8 +127,7 @@ def start_fixture(self):

self.index = index

self.coord = metricd.get_coordinator_and_start(
conf.storage.coordination_url)
self.coord = metricd.get_coordinator_and_start(conf.coordination_url)
s = storage.get_driver(conf, self.coord)
s.upgrade()
i = incoming.get_driver(conf)
Expand Down

0 comments on commit 70b9ca4

Please sign in to comment.