diff --git a/lib/ceph/utils.py b/lib/ceph/utils.py index 4d6ac326..53281ea7 100644 --- a/lib/ceph/utils.py +++ b/lib/ceph/utils.py @@ -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