]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
Add rbd modprobe method.
authorJosh Durgin <josh.durgin@dreamhost.com>
Thu, 9 Jun 2011 18:46:59 +0000 (11:46 -0700)
committerTommi Virtanen <tommi.virtanen@dreamhost.com>
Wed, 22 Jun 2011 23:03:57 +0000 (16:03 -0700)
teuthology/task/rbd.py

index 5c9289b71b9f2663bf62565dd6ec8d2b8f9c77e8..0bae7f9accd49b2737ddbf86cf4cb78a267a3e3e 100644 (file)
@@ -72,6 +72,42 @@ def create_image(ctx, config):
                     ],
                 )
 
+@contextlib.contextmanager
+def modprobe(ctx, config):
+    """
+    Load the rbd kernel module..
+
+    For example::
+
+        tasks:
+        - ceph:
+        - rbd.create_image: [client.0]
+        - rbd.modprobe: [client.0]
+    """
+    for role in config:
+        (remote,) = ctx.cluster.only(role).remotes.keys()
+        remote.run(
+            args=[
+                'sudo',
+                'modprobe',
+                'rbd',
+                ],
+            )
+    try:
+        yield
+    finally:
+        log.info('Unloading rbd kernel module...')
+        for role in config:
+            (remote,) = ctx.cluster.only(role).remotes.keys()
+            remote.run(
+                args=[
+                    'sudo',
+                    'modprobe',
+                    '-r',
+                    'rbd',
+                    ],
+                )
+
 @contextlib.contextmanager
 def task(ctx, config):
     create_image(ctx, config)