]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-disk: fix regression in cciss devices names
authorLoic Dachary <ldachary@redhat.com>
Tue, 5 Jan 2016 16:42:11 +0000 (17:42 +0100)
committerLoic Dachary <ldachary@redhat.com>
Thu, 7 Jan 2016 14:21:24 +0000 (15:21 +0100)
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 <loic@dachary.org>
(cherry picked from commit a2fd3a535e66b3a2b694cda9c6add33383ccfa4a)

Conflicts:
src/ceph-disk : trivial resolution

src/ceph-disk

index a26c1083957e2523d9a8d669b4115e16f1f79dd3..3b34a35986d2224d9dcdca31af42e85de929f031 100755 (executable)
@@ -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