Skip to content

Commit

Permalink
Merge branch 'stable/4.3' into mergify/bp/stable/4.3/pr-1074
Browse files Browse the repository at this point in the history
  • Loading branch information
tobias-urdin authored Jan 12, 2021
2 parents 917f4e0 + 598b1ea commit 8f8819b
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 23 deletions.
14 changes: 8 additions & 6 deletions gnocchi/cli/metricd.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,14 @@ def wakeup(self):
self._wake_up.set()

def _configure(self):
member_id = "%s.%s.%s" % (socket.gethostname(),
self.worker_id,
# NOTE(jd) Still use a uuid here so we're
# sure there's no conflict in case of
# crash/restart
str(uuid.uuid4()))
member_id = (
"%s.%s.%s" % (socket.gethostname(),
self.worker_id,
# NOTE(jd) Still use a uuid here so we're
# sure there's no conflict in case of
# crash/restart
str(uuid.uuid4()))
).encode()
self.coord = get_coordinator_and_start(member_id,
self.conf.coordination_url)
self.store = storage.get_driver(self.conf)
Expand Down
8 changes: 0 additions & 8 deletions gnocchi/rest/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -2099,13 +2099,6 @@ def get(details=True):
metricd.MetricProcessor.GROUP_ID, member)
for member in members
]
<<<<<<< HEAD
report_dict['metricd']['processors'] = members
report_dict['metricd']['statistics'] = {
member: cap.get()
for member, cap in six.moves.zip(members, caps)
}
=======
report_dict['metricd']['processors'] = [
member.decode() for member in members
]
Expand All @@ -2117,7 +2110,6 @@ def get(details=True):
}
members_data[member.decode()] = caps_data
report_dict['metricd']['statistics'] = members_data
>>>>>>> bd2cafad... Ensure member statistics key is decoded
else:
report_dict['metricd']['processors'] = None
report_dict['metricd']['statistics'] = {}
Expand Down
2 changes: 1 addition & 1 deletion gnocchi/rest/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def _lazy_load(self, name):
# entirely.
self.backends[name] = (
metricd.get_coordinator_and_start(
str(uuid.uuid4()),
str(uuid.uuid4()).encode(),
self.conf.coordination_url)
)
elif name == "storage":
Expand Down
9 changes: 7 additions & 2 deletions gnocchi/tests/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,12 @@ def setUp(self):
'storage')
self.ceph_pool_name = uuid.uuid4().hex
with open(os.devnull, 'w') as f:
subprocess.call("rados -c %s mkpool %s" % (
subprocess.call(("ceph -c %s osd pool create %s "
"16 16 replicated") % (
os.getenv("CEPH_CONF"), self.ceph_pool_name), shell=True,
stdout=f, stderr=subprocess.STDOUT)
subprocess.call(("ceph -c %s osd pool application "
"enable %s rbd") % (
os.getenv("CEPH_CONF"), self.ceph_pool_name), shell=True,
stdout=f, stderr=subprocess.STDOUT)
self.conf.set_override('ceph_pool', self.ceph_pool_name, 'storage')
Expand Down Expand Up @@ -380,7 +385,7 @@ def tearDown(self):

if self.conf.storage.driver == 'ceph':
with open(os.devnull, 'w') as f:
ceph_rmpool_command = "rados -c %s rmpool %s %s \
ceph_rmpool_command = "ceph -c %s osd pool delete %s %s \
--yes-i-really-really-mean-it" % (os.getenv("CEPH_CONF"), self.ceph_pool_name,
self.ceph_pool_name)
subprocess.call(ceph_rmpool_command, shell=True,
Expand Down
21 changes: 17 additions & 4 deletions gnocchi/tests/functional/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,12 +135,17 @@ def start_fixture(self):
elif conf.storage.driver == 'ceph':
conf.set_override('ceph_conffile', os.getenv("CEPH_CONF"),
'storage')
pool_name = uuid.uuid4().hex
self.ceph_pool_name = uuid.uuid4().hex
with open(os.devnull, 'w') as f:
subprocess.call("rados -c %s mkpool %s" % (
os.getenv("CEPH_CONF"), pool_name), shell=True,
subprocess.call(("ceph -c %s osd pool create %s "
"16 16 replicated") % (
os.getenv("CEPH_CONF"), self.ceph_pool_name), shell=True,
stdout=f, stderr=subprocess.STDOUT)
conf.set_override('ceph_pool', pool_name, 'storage')
subprocess.call(("ceph -c %s osd pool application "
"enable %s rbd") % (
os.getenv("CEPH_CONF"), self.ceph_pool_name), shell=True,
stdout=f, stderr=subprocess.STDOUT)
conf.set_override('ceph_pool', self.ceph_pool_name, 'storage')
elif conf.storage.driver == "s3":
conf.set_override('s3_endpoint_url',
os.getenv("GNOCCHI_STORAGE_HTTP_URL"),
Expand Down Expand Up @@ -236,6 +241,14 @@ def stop_fixture(self):
module='sqlalchemy.engine.default')
sqlalchemy_utils.drop_database(self.conf.indexer.url)

if self.conf.storage.driver == 'ceph':
with open(os.devnull, 'w') as f:
ceph_rmpool_command = "ceph -c %s osd pool delete %s %s \
--yes-i-really-really-mean-it" % (os.getenv("CEPH_CONF"), self.ceph_pool_name,
self.ceph_pool_name)
subprocess.call(ceph_rmpool_command, shell=True,
stdout=f, stderr=subprocess.STDOUT)

if self.tmp_dir:
shutil.rmtree(self.tmp_dir)

Expand Down
2 changes: 1 addition & 1 deletion run-func-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ for storage in ${GNOCCHI_TEST_STORAGE_DRIVERS}; do
ceph)
eval $(pifpaf -e STORAGE run ceph)
check_empty_var STORAGE_URL
rados -c $STORAGE_CEPH_CONF mkpool gnocchi
ceph -c $STORAGE_CEPH_CONF osd pool create gnocchi 16 16 replicated
STORAGE_URL=ceph://$STORAGE_CEPH_CONF
;;
s3)
Expand Down
2 changes: 1 addition & 1 deletion run-upgrade-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ trap cleanup EXIT


if [ "$STORAGE_DAEMON" == "ceph" ]; then
rados -c $STORAGE_CEPH_CONF mkpool gnocchi
ceph -c $STORAGE_CEPH_CONF osd pool create gnocchi 16 16 replicated
STORAGE_URL=ceph://$STORAGE_CEPH_CONF
else
STORAGE_URL=file://$GNOCCHI_DATA
Expand Down

0 comments on commit 8f8819b

Please sign in to comment.