]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-disk: get Nonetype when ceph-disk list with --format plain on single device.
authorVicente Cheng <freeze.bilsted@gmail.com>
Wed, 28 Oct 2015 10:29:53 +0000 (18:29 +0800)
committerVicente Cheng <freeze.bilsted@gmail.com>
Wed, 28 Oct 2015 10:29:53 +0000 (18:29 +0800)
    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>
src/ceph-disk

index 3f009513c9a7668cf02db270a478cb1433f7e3ed..0ca368879cd0d4cef78a0632c9947402a082ee87 100755 (executable)
@@ -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: