Sync in charms.ceph

This patch looks for multiple nodes in the OSD tree with type root and
iterates through all root parent node children to allow for upgrading ceph-osd
cluster/devices when running both a default and an ssd pool of OSD hosts,
for instance.

Change-Id: Iea9812ee7ac67f9b45a6b38c43c130353e68ad8f
Closes-Bug: #1788722
Depends-On: I69d653f9f3ea4ee8469f3d7323ee68435ba22099
This commit is contained in:
Chris MacNaughton 2018-08-24 16:32:47 +02:00
parent 8875a7a685
commit 0cb16d8c66
1 changed files with 10 additions and 1 deletions

View File

@ -579,7 +579,15 @@ def get_osd_tree(service):
# Make sure children are present in the json
if not json_tree['nodes']:
return None
child_ids = json_tree['nodes'][0]['children']
parent_nodes = [
node for node in json_tree['nodes'] if node['type'] == 'root']
child_ids = []
for node in parent_nodes:
try:
child_ids = child_ids + node['children']
except KeyError:
# skip if this parent has no children
continue
for child in json_tree['nodes']:
if child['id'] in child_ids:
crush_list.append(
@ -1287,6 +1295,7 @@ def add_keyring_to_ceph(keyring, secret, hostname, path, done, init_marker):
subprocess.check_call(['ceph-mon', '--mkfs',
'-i', hostname,
'--keyring', keyring])
chownr('/var/log/ceph', ceph_user(), ceph_user())
chownr(path, ceph_user(), ceph_user())
with open(done, 'w'):
pass