From 22881b1686dc040d8af01c66f59a935065bb680a Mon Sep 17 00:00:00 2001 From: Loic Dachary Date: Tue, 5 Jan 2016 17:42:11 +0100 Subject: [PATCH] ceph-disk: fix regression in cciss devices names The cciss driver has device paths such as /dev/cciss/c0d1 with a matching /sys/block/cciss!c0d1. The general case is that whenever a device name is found in /sys/block, the / is replaced by the !. When refactoring the ceph-disk list subcommand, this conversion was overlooked in a few places. All explicit concatenation of /dev with a device name are replaced with a call to get_dev_name which does the same but also converts all ! in /. http://tracker.ceph.com/issues/13970 Fixes: #13970 Signed-off-by: Loic Dachary (cherry picked from commit a2fd3a535e66b3a2b694cda9c6add33383ccfa4a) Conflicts: src/ceph-disk : trivial resolution --- src/ceph-disk | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/ceph-disk b/src/ceph-disk index a26c1083957e2..3b34a35986d22 100755 --- a/src/ceph-disk +++ b/src/ceph-disk @@ -571,7 +571,7 @@ def list_partitions_device(dev): Return a list of partitions on the given device name """ partitions = [] - basename = os.path.basename(dev) + basename = get_dev_name(dev) for name in os.listdir(block_path(dev)): if name.startswith(basename): partitions.append(name) @@ -592,7 +592,7 @@ def get_partition_base(dev): # find the base for basename in os.listdir('/sys/block'): if os.path.exists(os.path.join('/sys/block', basename, name)): - return '/dev/' + basename + return get_dev_path(basename) raise Error('no parent device for partition', dev) def is_partition_mpath(dev): @@ -2782,7 +2782,8 @@ def list_format_dev_plain(dev, devices=[], prefix=''): DMCRYPT_LUKS_JOURNAL_UUID): dmcrypt = dev['dmcrypt'] if dmcrypt['holders'] and len(dmcrypt['holders']) == 1: - desc = ['ceph journal (dmcrypt %s /dev/%s)' % (dmcrypt['type'], dmcrypt['holders'][0])] + holder = get_dev_path(dmcrypt['holders'][0]) + desc = ['ceph journal (dmcrypt %s %s)' % (dmcrypt['type'], holder)] else: desc = ['ceph journal (dmcrypt %s)' % dmcrypt['type']] if dev.get('journal_for'): @@ -2837,14 +2838,14 @@ def list_dev(dev, uuid_map, journal_map): info['dmcrypt']['holders'] = holders info['dmcrypt']['type'] = 'plain' if len(holders) == 1: - list_dev_osd('/dev/' + holders[0], uuid_map, info) + list_dev_osd(get_dev_path(holders[0]), uuid_map, info) elif ptype == DMCRYPT_LUKS_OSD_UUID: holders = is_held(dev) info['type'] = 'data' info['dmcrypt']['holders'] = holders info['dmcrypt']['type'] = 'LUKS' if len(holders) == 1: - list_dev_osd('/dev/' + holders[0], uuid_map, info) + list_dev_osd(get_dev_path(holders[0]), uuid_map, info) elif ptype in (JOURNAL_UUID, MPATH_JOURNAL_UUID): info['type'] = 'journal' if ptype == MPATH_JOURNAL_UUID: @@ -2902,7 +2903,7 @@ def list_devices(args): holders = is_held(dev) if len(holders) != 1: continue - dev_to_mount = '/dev/' + holders[0] + dev_to_mount = get_dev_path(holders[0]) else: dev_to_mount = dev -- 2.39.5