mirror of
https://github.com/ceph/ceph
synced 2024-12-18 01:16:55 +00:00
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 <freeze.bilsted@gmail.com>
This commit is contained in:
parent
451e3d568a
commit
570285bd08
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user