summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris MacNaughton <chris.macnaughton@canonical.com>2018-08-24 16:32:47 +0200
committerChris MacNaughton <chris.macnaughton@canonical.com>2018-08-24 16:38:06 +0200
commit0cb16d8c66680a36166c4a97062ebf2bfbdad192 (patch)
tree01f9071e1d211584a7d33e0ec9c522d47e36c094
parent8875a7a6851cf33ead2da50fbd77f1850e515d35 (diff)
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
Notes
Notes (review): Verified+1: Canonical CI <uosci-testing-bot@ubuntu.com> Code-Review+2: David Ames <david.ames@canonical.com> Workflow+1: David Ames <david.ames@canonical.com> Verified+2: Zuul Submitted-by: Zuul Submitted-at: Fri, 24 Aug 2018 20:36:28 +0000 Reviewed-on: https://review.openstack.org/596317 Project: openstack/charm-ceph-osd Branch: refs/heads/master
-rw-r--r--lib/ceph/utils.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/ceph/utils.py b/lib/ceph/utils.py
index 4d6ac32..53281ea 100644
--- a/lib/ceph/utils.py
+++ b/lib/ceph/utils.py
@@ -579,7 +579,15 @@ def get_osd_tree(service):
579 # Make sure children are present in the json 579 # Make sure children are present in the json
580 if not json_tree['nodes']: 580 if not json_tree['nodes']:
581 return None 581 return None
582 child_ids = json_tree['nodes'][0]['children'] 582 parent_nodes = [
583 node for node in json_tree['nodes'] if node['type'] == 'root']
584 child_ids = []
585 for node in parent_nodes:
586 try:
587 child_ids = child_ids + node['children']
588 except KeyError:
589 # skip if this parent has no children
590 continue
583 for child in json_tree['nodes']: 591 for child in json_tree['nodes']:
584 if child['id'] in child_ids: 592 if child['id'] in child_ids:
585 crush_list.append( 593 crush_list.append(
@@ -1287,6 +1295,7 @@ def add_keyring_to_ceph(keyring, secret, hostname, path, done, init_marker):
1287 subprocess.check_call(['ceph-mon', '--mkfs', 1295 subprocess.check_call(['ceph-mon', '--mkfs',
1288 '-i', hostname, 1296 '-i', hostname,
1289 '--keyring', keyring]) 1297 '--keyring', keyring])
1298 chownr('/var/log/ceph', ceph_user(), ceph_user())
1290 chownr(path, ceph_user(), ceph_user()) 1299 chownr(path, ceph_user(), ceph_user())
1291 with open(done, 'w'): 1300 with open(done, 'w'):
1292 pass 1301 pass