From: Vicente Cheng Date: Wed, 28 Oct 2015 10:29:53 +0000 (+0800) Subject: ceph-disk: get Nonetype when ceph-disk list with --format plain on single device. X-Git-Tag: v10.0.0~24^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=570285bd086643db8c1cacac9ebbafcd3a157cd2;p=ceph.git ceph-disk: get Nonetype when ceph-disk list with --format plain on single device. with dmcrypt device, ceph-disk list will get Nonetype with the real device i.e. /dev/sdb1 for /dev/dm-1, `ceph-disk --list /dev/sdb1` will get Nonetype that because the holder we query is `dm-x`, the devices includ the path is `sdX`, it cannot match. if we list format plain and meet dmcrypt device, query again with the holder (dm-x). Also change the list_devices() parameter to let other function to use it easily. Signed-off-by: Vicente Cheng --- diff --git a/src/ceph-disk b/src/ceph-disk index 3f009513c9a7..0ca368879cd0 100755 --- a/src/ceph-disk +++ b/src/ceph-disk @@ -2738,6 +2738,8 @@ def list_format_dev_plain(dev, devices=[], prefix=''): desc = ['ceph data (dmcrypt %s)' % dmcrypt['type'], 'not currently mapped'] elif len(dmcrypt['holders']) == 1: holder = '/dev/' + dmcrypt['holders'][0] + # re-list with the dm-x path + devices = list_devices([holder]) def lookup_dev(devices, path): for device in devices: if device['path'] == path: @@ -2851,8 +2853,8 @@ def list_dev(dev, uuid_map, journal_map): return info -def list_devices(args): - partmap = list_all_partitions(args.path) +def list_devices(path): + partmap = list_all_partitions(path) uuid_map = {} journal_map = {} @@ -2912,7 +2914,7 @@ def list_devices(args): return devices def main_list(args): - devices = list_devices(args) + devices = list_devices(args.path) if args.format == 'json': print json.dumps(devices) else: