mirror of
https://github.com/ceph/ceph
synced 2025-02-23 02:57:21 +00:00
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:
commit
340d6f61b3
10
qa/rbd/krbd_modprobe.t
Normal file
10
qa/rbd/krbd_modprobe.t
Normal 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
|
5
qa/suites/krbd/basic/tasks/krbd_modprobe.yaml
Normal file
5
qa/suites/krbd/basic/tasks/krbd_modprobe.yaml
Normal file
@ -0,0 +1,5 @@
|
||||
tasks:
|
||||
- cram:
|
||||
clients:
|
||||
client.0:
|
||||
- qa/rbd/krbd_modprobe.t
|
11
src/krbd.cc
11
src/krbd.cc
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user