Merge pull request #30978 from idryomov/wip-krbd-modprobe

krbd: modprobe before calling build_map_buf()

Reviewed-by: Jason Dillaman <dillaman@redhat.com>
This commit is contained in:
Ilya Dryomov 2019-10-18 11:11:07 +02:00 committed by GitHub
commit 340d6f61b3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 22 additions and 4 deletions

10
qa/rbd/krbd_modprobe.t Normal file
View File

@ -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

View File

@ -0,0 +1,5 @@
tasks:
- cram:
clients:
client.0:
- qa/rbd/krbd_modprobe.t

View 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);
}