From: Tommi Virtanen Date: Tue, 2 Oct 2012 23:43:08 +0000 (-0700) Subject: ceph-disk-activate: Refactor to extract detect_fstype call. X-Git-Tag: v0.54~97 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=8eeebe865c3856308f5df2d8e53ccc99df354522;p=ceph.git ceph-disk-activate: Refactor to extract detect_fstype call. This allows us to use the fstype for a config lookup. Signed-off-by: Tommi Virtanen --- diff --git a/src/ceph-disk-activate b/src/ceph-disk-activate index e0bfb0f6c39d..3062d1c25780 100755 --- a/src/ceph-disk-activate +++ b/src/ceph-disk-activate @@ -322,17 +322,9 @@ MOUNT_OPTIONS = dict( def mount( dev, + fstype, ): # pick best-of-breed mount options based on fs type - try: - fstype = detect_fstype(dev) - except (subprocess.CalledProcessError, - TruncatedLineError, - TooManyLinesError) as e: - raise FilesystemTypeError( - 'device {dev}'.format(dev=dev), - e, - ) options = MOUNT_OPTIONS.get(fstype, '') # mount @@ -382,7 +374,17 @@ def activate( ): if do_mount: - path = mount(dev=path) + try: + fstype = detect_fstype(dev=path) + except (subprocess.CalledProcessError, + TruncatedLineError, + TooManyLinesError) as e: + raise FilesystemTypeError( + 'device {dev}'.format(dev=path), + e, + ) + + path = mount(dev=path, fstype=fstype) try: check_osd_magic(path)