From 61e20c2be3b3ed1a17895a81c6fe7933a4237550 Mon Sep 17 00:00:00 2001 From: James Page Date: Thu, 11 Oct 2018 15:12:39 +0100 Subject: [PATCH] Resync ceph helpers Resync ceph helpers, picking up fixes for: - Upgrades from Luminous to Mimic. - Correct build of OSD list in more complex CRUSH configurations, resolving upgrade issues. Add nova-cloud-controller to amulet tests to achieve a complete deployment post landing of changes for Nova Cells v2 support. Closes-Bug: 1788722 Change-Id: I7a5c53c792ab958d94301de62cdd4d804f8a54f7 --- lib/ceph/utils.py | 37 +++++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/lib/ceph/utils.py b/lib/ceph/utils.py index a958dfd8..2ef48abe 100644 --- a/lib/ceph/utils.py +++ b/lib/ceph/utils.py @@ -579,21 +579,23 @@ 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'] - for child in json_tree['nodes']: - if child['id'] in child_ids: - crush_list.append( - CrushLocation( - name=child.get('name'), - identifier=child['id'], - host=child.get('host'), - rack=child.get('rack'), - row=child.get('row'), - datacenter=child.get('datacenter'), - chassis=child.get('chassis'), - root=child.get('root') - ) + host_nodes = [ + node for node in json_tree['nodes'] + if node['type'] == 'host' + ] + for host in host_nodes: + crush_list.append( + CrushLocation( + name=host.get('name'), + identifier=host['id'], + host=host.get('host'), + rack=host.get('rack'), + row=host.get('row'), + datacenter=host.get('datacenter'), + chassis=host.get('chassis'), + root=host.get('root') ) + ) return crush_list except ValueError as v: log("Unable to parse ceph tree json: {}. Error: {}".format( @@ -1517,7 +1519,8 @@ def _ceph_disk(dev, osd_format, osd_journal, encrypt=False, bluestore=False): """ Prepare a device for usage as a Ceph OSD using ceph-disk - :param: dev: Full path to use for OSD block device setup + :param: dev: Full path to use for OSD block device setup, + The function looks up realpath of the device :param: osd_journal: List of block devices to use for OSD journals :param: encrypt: Use block device encryption (unsupported) :param: bluestore: Use bluestore storage for OSD @@ -1549,7 +1552,7 @@ def _ceph_disk(dev, osd_format, osd_journal, encrypt=False, bluestore=False): elif cmp_pkgrevno('ceph', '12.1.0') >= 0 and not bluestore: cmd.append('--filestore') - cmd.append(dev) + cmd.append(os.path.realpath(dev)) if osd_journal: least_used = find_least_used_utility_device(osd_journal) @@ -2531,6 +2534,7 @@ UPGRADE_PATHS = collections.OrderedDict([ ('firefly', 'hammer'), ('hammer', 'jewel'), ('jewel', 'luminous'), + ('luminous', 'mimic'), ]) # Map UCA codenames to ceph codenames @@ -2544,6 +2548,7 @@ UCA_CODENAME_MAP = { 'ocata': 'jewel', 'pike': 'luminous', 'queens': 'luminous', + 'rocky': 'mimic', }