]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
krbd: modprobe before calling build_map_buf() 30978/head
authorIlya Dryomov <idryomov@gmail.com>
Thu, 17 Oct 2019 14:23:41 +0000 (16:23 +0200)
committerIlya Dryomov <idryomov@gmail.com>
Thu, 17 Oct 2019 14:52:43 +0000 (16:52 +0200)
Otherwise add_key() in set_kernel_secret() fails as if running against
an ancient kernel and we fall back to secret= in options for the first
image being mapped on the machine.

Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
qa/rbd/krbd_modprobe.t [new file with mode: 0644]
qa/suites/krbd/basic/tasks/krbd_modprobe.yaml [new file with mode: 0644]
src/krbd.cc

diff --git a/qa/rbd/krbd_modprobe.t b/qa/rbd/krbd_modprobe.t
new file mode 100644 (file)
index 0000000..a0e04d3
--- /dev/null
@@ -0,0 +1,10 @@
+
+  $ sudo modprobe -r rbd
+  $ sudo modprobe -r libceph
+  $ lsmod | grep libceph
+  [1]
+  $ rbd create --size 1 img
+  $ DEV=$(sudo rbd map img)
+  $ sudo grep -q ',key=' /sys/bus/rbd/devices/${DEV#/dev/rbd}/config_info
+  $ sudo rbd unmap $DEV
+  $ rbd rm --no-progress img
diff --git a/qa/suites/krbd/basic/tasks/krbd_modprobe.yaml b/qa/suites/krbd/basic/tasks/krbd_modprobe.yaml
new file mode 100644 (file)
index 0000000..22f02cd
--- /dev/null
@@ -0,0 +1,5 @@
+tasks:
+- cram:
+    clients:
+      client.0:
+      - qa/rbd/krbd_modprobe.t
index f766a4e8c90fb96e903886d010f8d289084f1259..7f9faa68936361a3a484c56ef949faea534a3e43 100644 (file)
@@ -357,13 +357,12 @@ static int map_image(struct krbd_ctx *ctx, const krbd_spec& spec,
   string buf;
   int r;
 
-  r = build_map_buf(ctx->cct, spec, options, &buf);
-  if (r < 0)
-    return r;
-
   /*
    * Modprobe rbd kernel module.  If it supports single-major device
    * number allocation scheme, make sure it's turned on.
+   *
+   * Do this before calling build_map_buf() - it wants "ceph" key type
+   * registered.
    */
   if (access("/sys/bus/rbd", F_OK) != 0) {
     const char *module_options = NULL;
@@ -381,6 +380,10 @@ static int map_image(struct krbd_ctx *ctx, const krbd_spec& spec,
     }
   }
 
+  r = build_map_buf(ctx->cct, spec, options, &buf);
+  if (r < 0)
+    return r;
+
   return do_map(ctx->udev, spec, buf, pname);
 }