]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-disk-activate: Refactor to extract detect_fstype call.
authorTommi Virtanen <tv@inktank.com>
Tue, 2 Oct 2012 23:43:08 +0000 (16:43 -0700)
committerTommi Virtanen <tv@inktank.com>
Fri, 5 Oct 2012 22:41:35 +0000 (15:41 -0700)
This allows us to use the fstype for a config lookup.

Signed-off-by: Tommi Virtanen <tv@inktank.com>
src/ceph-disk-activate

index e0bfb0f6c39d010ac471c4ed7d36d0be9367cd2f..3062d1c25780c6bc712302c1c7e168c487250122 100755 (executable)
@@ -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)