]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-disk: fix list for encrypted or corrupt volume
authorStuart Longland <stuartl@vrt.com.au>
Tue, 6 May 2014 21:06:36 +0000 (14:06 -0700)
committerSage Weil <sage@redhat.com>
Sat, 16 Aug 2014 00:15:36 +0000 (17:15 -0700)
Continue gracefully if an fs type is not detected, either because it is
encrypted or because it is corrupted.

Signed-off-by: Sage Weil <sage@inktank.com>
(cherry picked from commit 09beebe3f1fd1b179547743648049b891cb8bc56)

src/ceph-disk

index 7c5e968da7cf81a368f08d100c44bbd91d174fba..7a9ef5f535328779e9fefe44eab154aa0ba7ba8d 100755 (executable)
@@ -792,6 +792,12 @@ def mount(
     Mounts a device with given filessystem type and
     mount options to a tempfile path under /var/lib/ceph/tmp.
     """
+    # sanity check: none of the arguments are None
+    if dev is None:
+        raise ValueError('dev may not be None')
+    if fstype is None:
+        raise ValueError('fstype may not be None')
+
     # pick best-of-breed mount options based on fs type
     if options is None:
         options = MOUNT_OPTIONS.get(fstype, '')
@@ -2213,16 +2219,17 @@ def main_list(args):
             ptype = get_partition_type(dev)
             if ptype == 'ceph data':
                 fs_type = get_dev_fs(dev)
-                try:
-                    tpath = mount(dev=dev, fstype=fs_type, options='')
+                if fs_type is not None:
                     try:
-                        journal_uuid = get_oneliner(tpath, 'journal_uuid')
-                        if journal_uuid:
-                            journal_map[journal_uuid.lower()] = dev
-                    finally:
-                        unmount(tpath)
-                except MountError:
-                    pass
+                        tpath = mount(dev=dev, fstype=fs_type, options='')
+                        try:
+                            journal_uuid = get_oneliner(tpath, 'journal_uuid')
+                            if journal_uuid:
+                                journal_map[journal_uuid.lower()] = dev
+                        finally:
+                            unmount(tpath)
+                    except MountError:
+                        pass
 
     for base, parts in sorted(partmap.iteritems()):
         if parts: