From: Stuart Longland Date: Tue, 6 May 2014 21:06:36 +0000 (-0700) Subject: ceph-disk: fix list for encrypted or corrupt volume X-Git-Tag: v0.80.6~65 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=40649902891244242d5861ccd9538aec026cae3a;p=ceph.git ceph-disk: fix list for encrypted or corrupt volume Continue gracefully if an fs type is not detected, either because it is encrypted or because it is corrupted. Signed-off-by: Sage Weil (cherry picked from commit 09beebe3f1fd1b179547743648049b891cb8bc56) --- diff --git a/src/ceph-disk b/src/ceph-disk index 7c5e968da7cf8..7a9ef5f535328 100755 --- a/src/ceph-disk +++ b/src/ceph-disk @@ -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: