Commit Graph

44 Commits

Author SHA1 Message Date
Ramana Raja
1eebb7ba79 rbd_nbd: fix resize of images mapped using netlink
Include device identifier or cookie in the message sent to the kernel
to resize images mapped to NBD devices using netlink. Otherwise,
netlink_resize() fails and the size of the device isn't updated.

Fixes: https://tracker.ceph.com/issues/64139
Signed-off-by: Ramana Raja <rraja@redhat.com>
2024-01-24 15:33:50 -05:00
Prasanna Kumar Kalever
dbb4daff40 rbd-nbd: fix stuck with disable request
Problem:
-------
Trying to disable any feature on an rbd image mapped with nbd leads to stuck
in rbd-nbd.

The rbd-nbd registers a watcher callback to detect image resize in
NBDWatchCtx::handle_notify(). The handle_notify calls image info method, which
calls refresh_if_required and it got stuck there.

It is getting stuck in ImageState::refresh_if_required() because
DisableFeaturesRequest issues update notifications while still holding onto
the exclusive lock with everything that has to do with it blocked.

Solution:
--------
Set only notify flag as part of NBDWatchCtx::handle_notify() and handle
the resize detection part as part of a different thread.

Fixes: https://tracker.ceph.com/issues/58740
Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
2023-09-21 11:18:03 +05:30
Ilya Dryomov
b21a379c5b librbd: call apply_changes() after setting librados_thread_count
Otherwise the setting doesn't take effect.  While at it, replace
home-grown stringify() with standard to_string().

Fixes: https://tracker.ceph.com/issues/58833
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
2023-02-23 12:50:45 +01:00
Ilya Dryomov
fcfef0a19e qa/workunits/rbd-nbd: work around "rbd feature disable" hang
"rbd feature disable" appears to reliably hang if the corresponding
remote request is proxied to rbd-nbd (because rbd-nbd happens to own
the exclusive lock after a series of blkdiscard calls) [1].  Work
around it here by enabling journaling before the image is mapped
and disabling it after the image is unmapped.

Also, don't assert on the output of "rbd journal inspect --verbose"
having a certain number of entries.  This is racy: if the script gets
delayed after the last blkdiscard call for some reason, there may be
fewer entries present in the journal or none at all.

[1] https://tracker.ceph.com/issues/58740

Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
2023-02-16 13:05:05 +01:00
Josef Johansson
21a26a7528 librbd: Fix local rbd mirror journals growing forever
This commit fixes commit 7ca1bab90f by pushing properly aligned
discards back to m_image_extents, if corrected.

If discards are misaligned (off 0, len 4608, gran=4096), they are
corrected properly, but only in object_extents and not in
m_image_extents.

When journal_append_event is triggered it will only append from
m_image_extents and does not now about the alignment fixes. In
commit_io_events_extent it will log a message and return without
completing the io since the larger misaligned area was sent to the journal.
This will in turn break rbd journal mirroring since the local client will wait
indefinately on the commit to be completed, which it never does.

This does not effect rbd-mirror in any way, which may be confusing and
dangerous since it's only rbd-mirror that updates ceph health, and not
the local client.

Setting `rbd_skip_partial_discard = false` under client will restore the
pre 7ca1bab behaviour and thus not trigger the bug with journals growing.
This will set `rbd_discard_granularity_bytes = 0` internally. This
setting is only changed during startup of a client.

Fixes: 7ca1bab90f
Fixes: https://tracker.ceph.com/issues/57396
Signed-off-by: Josef Johansson <josef@oderland.se>
2023-01-20 11:59:16 +01:00
Ilya Dryomov
4a7150cd36 qa/workunits/rbd-nbd: clear DEV after detach tests
Otherwise we attempt to unmap it in cleanup(), needlessly.

Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
2022-11-26 13:27:33 +01:00
Prasanna Kumar Kalever
92480e6561 qa/workunits/rbd: added tests for --snap-id
Fixes: https://tracker.ceph.com/issues/57902
Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
2022-11-10 19:28:30 +05:30
Ilya Dryomov
edfcf4bd6b qa/workunits/rbd-nbd: also test map/unmap with --namespace option
The entire script is using specs, let's cover non-spec syntax as well.

Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
2022-10-10 20:19:17 +02:00
Prasanna Kumar Kalever
2adfe55bcc qa/workunits/rbd: test map/attach with --show-cookie/--cookie options
Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
2021-10-26 19:24:13 +05:30
Prasanna Kumar Kalever
2fa7f90d42 qa/workunits/rbd-nbd: add notrim test
Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
2021-06-30 13:09:24 +05:30
Prasanna Kumar Kalever
e2aa4128f1 qa/workunits/rbd: use rbd cli for device attach/detach commands
Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
2021-05-26 10:27:09 +05:30
Sunny Kumar
b19905272a qa/workunits/rbd-nbd: add new test for map/unmap
This patch includes twe new test cases:
 a. map/unmap test with only image name and
 b. map/unmap test after changing default pool which expects the image
 to come from new default pool.

Signed-off-by: Sunny Kumar <sunkumar@redhat.com>
2021-05-18 16:23:10 +01:00
Sunny Kumar
4f6370b884 qa/workunits/rbd: use rbd device wrapper where appropriate
Use `rbd device` wrapper call instead of making a direct call to rbd-nbd.

Signed-off-by: Sunny Kumar <sunkumar@redhat.com>
2021-05-14 12:38:25 +01:00
Mykola Golub
9c9b14fab6 qa/workunits/rbd: improve regex for parsing ps output
On some platforms the pid may be indented with spaces.

Signed-off-by: Mykola Golub <mgolub@suse.com>
2020-11-10 17:16:00 +00:00
Mykola Golub
4cda97a822 rbd-nbd: when unmapping or detaching by device try to find process
For `detach` failing to find the process is fatal while unmap
will still try to send disconnect to the device.

Signed-off-by: Mykola Golub <mgolub@suse.com>
2020-11-10 17:15:59 +00:00
Mykola Golub
3043d80168 rbd-nbd: make unmap/detach wait for rbd-nbd process to terminate
Signed-off-by: Mykola Golub <mgolub@suse.com>
2020-10-13 18:32:50 +01:00
Mykola Golub
7d75c1d6b8 rbd-nbd: introduce new attach and detach commands
The commands allow to restart a daemon without destroying the nbd
device.

Now, if the netlink is used, a dead connection timeout is set on
the nbd device setup, so the device is not immediately released
if the rbd-nbd process terminates without disconnect (unmap).

The attach command just sends terminate signal to the rbd-nbd
process. The detach command starts a new process and connects to
the existing device.

Signed-off-by: Mykola Golub <mgolub@suse.com>
2020-10-07 13:26:07 +01:00
Mykola Golub
b360186eb6 rbd-nbd: don't ignore namespace when unmapping by image spec
Fixes: https://tracker.ceph.com/issues/47665
Signed-off-by: Mykola Golub <mgolub@suse.com>
2020-09-27 17:59:49 +01:00
Jason Dillaman
9929eff533
Merge pull request #37086 from trociny/wip-qa-rbd-nbd-unmap
qa/workunits/rbd: yet another attempt to improve rbd-nbd unmap

Reviewed-by: Jason Dillaman <dillaman@redhat.com>
2020-09-14 14:32:30 -04:00
Mykola Golub
dc9ee9ba0b rbd-nbd: return quiesce hook exit code
Signed-off-by: Mykola Golub <mgolub@suse.com>
2020-09-11 14:51:51 +01:00
Mykola Golub
f0c69761c8 qa/workunits/rbd: yet another attempt to improve rbd-nbd unmap
Previously it still could race when unmap_device returned success
because the device was not found in `rbd-nbd list-mapped` (the nbd
device was removed) but the test failed because the process was still
found in the ps table.

Fixes: https://tracker.ceph.com/issues/47394
Signed-off-by: Mykola Golub <mgolub@suse.com>
2020-09-10 17:13:26 +01:00
Mykola Golub
b0ab564eae qa/workunits/rbd: add rbd-nbd quiesce tests
Signed-off-by: Mykola Golub <mgolub@suse.com>
2020-05-09 16:36:49 +01:00
Mykola Golub
d667e385a1 qa/workunits/rbd: fix list-mapped filter in unmap_device
In recent versions `rbd list-mapped` does not print the white space
at the end of the line.

Fixes: https://tracker.ceph.com/issues/45305
Signed-off-by: Mykola Golub <mgolub@suse.com>
2020-04-28 11:45:33 +01:00
Jason Dillaman
80a3f18caf qa/workunits/rbd: wait for nbd map to close after unmap
The unmap action only sends a signal to the kernel to notify the
rbd-nbd daemon to disconnect. Therefore, it's possible that an
unmap followed by an immediate re-map to the same device might
fail since the unmap is still in-progress.

Fixes: https://tracker.ceph.com/issues/44567
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2020-03-11 15:12:58 -04:00
Kefu Chai
79584862f6 src,qa: install python bindings into lib/cython_modules/lib.3
instead of checking for the WITH_PYTHON* options, just hardwire to lib.3

Signed-off-by: Kefu Chai <kchai@redhat.com>
2019-12-19 11:52:54 +08:00
Jason Dillaman
87278548a5 qa/workunits/rbd: wait for rbd-nbd unmap to complete
The "unmap" request is asynchronous, so wait for a short amount
of time for the "rbd-nbd" daemon process to exit.

Fixes: http://tracker.ceph.com/issues/39598
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2019-05-06 15:16:03 -04:00
Jason Dillaman
0474727294 rbd: simplify pool namespace positional argument handling
The pool and namespace can now be specified as in a
<pool-name>[/<namespace-name>] format as positional
arguments.

Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2019-01-28 14:36:44 -05:00
Mykola Golub
efae1c7a79 rbd-nbd: support namespaces
Fixes: http://tracker.ceph.com/issues/24609
Signed-off-by: Mykola Golub <mgolub@suse.com>
2018-11-25 19:29:19 +02:00
Mykola Golub
e372e9492b rbd-nbd: output format support for list-mapped command
Signed-off-by: Mykola Golub <mgolub@suse.com>
2018-01-03 14:44:10 +02:00
Mykola Golub
02e211c282 rbd-nbd: allow to unmap by image or snap spec
(to match the behaviour of krbd unmap)

Signed-off-by: Mykola Golub <mgolub@suse.com>
2017-12-25 17:19:49 +02:00
Mykola Golub
47e38ca1b9 qa/workunits/rbd: bench-write is part of exclusive option test
Signed-off-by: Mykola Golub <mgolub@suse.com>
2017-12-25 17:19:49 +02:00
Kefu Chai
30b5b4627c Merge pull request #16494 from asomers/bin_bash
misc: Fix bash path in shebangs

Reviewed-by: Willem Jan Withagen <wjw@digiware.nl>
Reviewed-by: Kefu Chai <kchai@redhat.com>
2017-08-27 10:14:14 +08:00
Alan Somers
3aae5ca6fd scripts: fix bash path in shebangs
/bin/bash is a Linuxism.  Other operating systems install bash to
different paths.  Use /usr/bin/env in shebangs to find bash.

Signed-off-by: Alan Somers <asomers@gmail.com>
2017-07-27 13:24:26 -06:00
Sage Weil
841f3bdf92 qa/workunits: adjust path to ceph-helpers.sh
Signed-off-by: Sage Weil <sage@redhat.com>
2017-07-26 08:08:01 -04:00
Pan Liu
a899bee57e qa/workunits: update rbd-nbd.sh for the changes of rbd-nbd list-mapped.
Signed-off-by: Pan Liu <wanjun.lp@alibaba-inc.com>
2017-06-18 16:13:11 +08:00
Mykola Golub
596e5ea8a5 rbd-nbd: check /sys/block/nbdX/size to ensure kernel mapped correctly
Fixes: http://tracker.ceph.com/issues/18335
Signed-off-by: Mykola Golub <mgolub@mirantis.com>
2017-02-04 15:40:51 +01:00
Mykola Golub
a3df091595 qa/workunits/rbd: simplify running nbd test under build env
Previously running the script as unprivileged user was not very useful
due to difficulty to change path sudo was looking for a command to
execute.

Signed-off-by: Mykola Golub <mgolub@mirantis.com>
2016-11-04 16:22:51 +02:00
Mykola Golub
2012b4dfc6 rbd-nbd: disallow mapping images >2TB in size
Fixes: http://tracker.ceph.com/issues/17219
Signed-off-by: Mykola Golub <mgolub@mirantis.com>
2016-11-03 14:50:47 +02:00
Mykola Golub
300a2810ac rbd-nbd: support disabling auto-exclusive lock transition logic
Fixes: http://tracker.ceph.com/issues/17488
Signed-off-by: Mykola Golub <mgolub@mirantis.com>
2016-10-12 21:00:25 +03:00
Mykola Golub
fa58acbb6f qa/workunits/rbd: image resize test for rbd-nbd
Signed-off-by: Mykola Golub <mgolub@mirantis.com>
2016-07-13 15:40:03 +03:00
cy.l@inwinstack.com
f8f6c1dc86 Fix RBD-NBD aio_callback error handling
Tracker-Id: #15604

Signed-off-by: Chang-Yi Lee <cy.l@inwinstack.com>
2016-04-30 15:11:18 +08:00
Mykola Golub
cf5649047f tests: improve rbd-nbd tests
- cleanup on a test failure;
- minimize interference with other processes (tests) that are
  run concurrently;
- use xmlstarlet when parsing rbd output;
- add exit status test.

Signed-off-by: Mykola Golub <mgolub@mirantis.com>
2016-01-13 13:07:42 +02:00
Jason Dillaman
70a1392920 qa/workunits/rbd: rbd-nbd test should use sudo for map/unmap ops
Fixes: #14221
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2016-01-04 12:03:45 -05:00
Yunchuan Wen
fda3f7e098 add rbd-nbd test case
Signed-off-by: Yunchuan Wen <yunchuan.wen@kylin-cloud.com>
2015-11-21 23:26:44 +08:00