Commit Graph

69 Commits

Author SHA1 Message Date
Ramana Raja
a2f15d4b2f qa/workunits/rbd: Add tests for rbd_support module recovery
... after the module's RADOS client is blocklisted.

Signed-off-by: Ramana Raja <rraja@redhat.com>
2023-05-08 16:45:41 -04:00
Ilya Dryomov
5a425927ed mgr/rbd_support: avoid wedging the task queue if pool is removed
rados.ObjectNotFound exception handler was referencing ioctx variable
which is assigned only if the pool exists and rados.open_ioctx() call
succeeds.  This lead to a fatal error

  mgr[rbd_support] Failed to locate pool mypool
  mgr[rbd_support] execute_task: [errno 2] error opening pool 'b'mypool''
  mgr[rbd_support] Fatal runtime error: local variable 'ioctx' referenced before assignment

and wedged the task queue.  No other commands were processed until
ceph-mgr daemon restart.

Fixes: https://tracker.ceph.com/issues/52932
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
2022-11-23 23:11:42 +01:00
Ilya Dryomov
de0ba80b37 librbd: use actual monitor addresses when creating a peer bootstrap token
Relying on mon_host config option is fragile, as the user may confuse
v1 and v2 addresses, group them incorrectly, etc.  Get mon_host value
only as a fallback.

Fixes: https://tracker.ceph.com/issues/57317
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
2022-08-27 17:58:37 +02:00
Ilya Dryomov
b2137e2058 rbd: don't default empty pool name unless namespace is specified
Commit 96f05a7956 ("rbd: delay determination of default pool name")
broke "rbd perf image iostat" and "rbd perf image iotop" GLOBAL_POOL_KEY
support (the ability to blend all rbd pools together into a single
view).

Fixes: https://tracker.ceph.com/issues/56561
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
2022-07-16 10:04:02 +02:00
Ilya Dryomov
7fb4fdbed0 mgr/rbd_support: always rescan image mirror snapshots on refresh
Establishing a watch on rbd_mirroring object and skipping rescanning
image mirror snapshots on periodic refresh unless rbd_mirroring object
gets notified in the interim is flawed.  rbd_mirroring object is
notified when mirroring is enabled or disabled on some image (including
when the image is removed), but it is not notified when images are
promoted or demoted.  However, load_pool_images() discards images that
are not primary at the time of the scan.  If the image is promoted
later, no snapshots are created even if the schedule is in place.  This
happens regardless of whether the schedule is added before or after the
promotion.

This effectively reverts commit 69259c8d37 ("mgr/rbd_support: make
mirror_snapshot_schedule rescan only updated pools").  An alternative
fix could be to stop discarding non-primary images (i.e. drop

    if not info['primary']:
        continue

check added in commit d39eb283c5 ("mgr/rbd_support: mirror snapshot
schedule should skip non-primary images")), but that would clutter the
queue and therefore "rbd mirror snapshot schedule status" output with
bogus entries.  Performing a rescan roughly every 60 seconds should be
manageable: currently it amounts to a single mirror_image_status_list
request, followed by mirror_image_get, get_snapcontext and snapshot_get
requests for each snapshot-based mirroring enabled image and concluded
by a single dir_list request.  Among these, per-image get_snapcontext
and snapshot_get requests are necessary for determining primaryness.

Fixes: https://tracker.ceph.com/issues/53914
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
2022-06-21 12:46:49 +02:00
Ilya Dryomov
90a90ad47d qa/workunits/rbd/cli_generic.sh: relax trash purge schedule status assert
Commit 08df6e0fd0 ("qa/workunits/rbd: expand LevelSpec parsing
coverage") didn't account for images with a separate data pool.  This
was missed because of small-cache-pool.yaml breakage.

Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
2022-03-19 14:54:00 +01:00
Ilya Dryomov
08df6e0fd0 qa/workunits/rbd: expand LevelSpec parsing coverage
Invoke "rbd mirror snapshot schedule ls -R" and "rbd mirror snapshot
schedule status" commands on all levels, consistently.  In particular,
make sure that an image level schedule is listed for a recursive query
at the pool level both before and after the schedule kicks in:

  $ rbd create --size 1G --mirror-image-mode snapshot -p foo bar
  $ rbd mirror snapshot schedule add -p foo --image bar 1m
  $ rbd mirror snapshot schedule ls -p foo -R
  POOL  NAMESPACE  IMAGE  SCHEDULE
  foo              bar    every 1m
  <wait for schedule to become visible in status>
  $ rbd mirror snapshot schedule ls -p foo -R
  POOL  NAMESPACE  IMAGE  SCHEDULE
  foo              bar    every 1m

Also, make sure that pool and image level status queries work:

  $ rbd mirror snapshot schedule status -p foo
  SCHEDULE TIME        IMAGE
  2022-03-04 07:14:00  foo/bar
  $ rbd mirror snapshot schedule status -p foo --image bar
  SCHEDULE TIME        IMAGE
  2022-03-04 07:14:00  foo/bar

Both of these issues are fixed by the previous commit.

Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
2022-03-05 11:20:33 +01:00
Ilya Dryomov
512f8da720
Merge pull request #43910 from sunnyku/wip-rbd-snap-sched
mgr/rbd_support: fix schedule remove

Reviewed-by: Ilya Dryomov <idryomov@gmail.com>
2022-02-06 20:32:09 +01:00
Sunny Kumar
a9312d4777 qa/workunits/rbd: improve schedule add/remove cli test
This patch adds few tests to cover schedule add/remove with invalid
inputs.

Signed-off-by: Sunny Kumar <sunkumar@redhat.com>
2022-02-04 16:16:03 +00:00
Ilya Dryomov
a5eef01e92 mgr/rbd_support: level_spec is optional for schedule list/status
Commit fea6fdff4c ("mgr/rbd_support: level_spec passed to some
commands is not optional") is wrong.  While it is true that a valid
level_spec is needed to create a LevelSpec instance, an empty string
is very much a valid level spec -- it signifies "all levels".

This wasn't caught because within Ceph these commands are wrapped by
rbd CLI which injects an empty string in get_level_spec_args().

Fixes: https://tracker.ceph.com/issues/54058
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
2022-01-30 14:22:35 +01:00
Ilya Dryomov
16d9a68a3e librbd: don't stop at the first unremovable image when purging
As there is no inherent ordering, there may be multiple removable
images past the unremovable image.  On top of that, removing a clone
may make its parent removable so perform an additional pass if any
image gets removed.

Fixes: https://tracker.ceph.com/issues/51021
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
2021-05-31 11:44:47 +02:00
Mykola Golub
ef4c3ec399 mgr/rbd_support: fix recursive non-global level schedule listing
For the case when the non-global level does not have a schedule
and a higher level is used as the parent, it wrongly listed
schedules from all branches under the parent, instead of only the
interested one.

Signed-off-by: Mykola Golub <mgolub@suse.com>
2020-03-12 13:40:25 +00:00
Mykola Golub
5c80c497d5 qa/workunits/rbd: wait for schedule status updated
Signed-off-by: Mykola Golub <mgolub@suse.com>
2020-03-12 11:47:53 +00:00
Mykola Golub
d68d41c366 qa/workunits/rbd: add `mirror snapshot schedule' cli test
Signed-off-by: Mykola Golub <mgolub@suse.com>
2020-02-25 09:52:22 +00:00
Mykola Golub
253733ab89 qa/workunits/rbd: add `trash purge schedule' cli test
Signed-off-by: Mykola Golub <mgolub@suse.com>
2020-02-25 09:52:22 +00:00
Jason Dillaman
547ebccaf9 librbd: v1 clones are restricted to the same namespace
Therefore the v1 parent spec should not attempt to populate the
namespace.

Fixes: https://tracker.ceph.com/issues/41938
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2019-10-04 13:27:50 -04:00
Mykola Golub
6e1434eefc librbd: optionally move parent image to trash on remove
and auto-delete when the last clone is detached

Signed-off-by: Mykola Golub <mgolub@suse.com>
2019-04-19 08:53:38 +01:00
Mykola Golub
5e951cd3ae qa/workunits/rbd: add parent migration case
Signed-off-by: Mykola Golub <mgolub@suse.com>
2019-02-19 08:58:08 +00:00
Mykola Golub
d10d40fd49 rbd: add option to list all descendant images
Signed-off-by: Mykola Golub <mgolub@suse.com>
2019-02-19 08:58:08 +00:00
Mykola Golub
be2cdc0bcf rbd: online re-sparsify of images
Signed-off-by: Mykola Golub <mgolub@suse.com>
2019-02-15 11:12:00 +00: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
songweibin
1f2eef7f1f librbd: disallow trash restoring when image being migrated
Signed-off-by: songweibin <song.weibin@zte.com.cn>
2019-01-08 10:26:06 +08:00
Mykola Golub
472abc2ed9 test/librbd: migration supporting namespace tests
Signed-off-by: Mykola Golub <mgolub@suse.com>
2018-11-03 19:36:44 +02:00
Jason Dillaman
c60ffac61e
Merge pull request #24428 from trociny/wip-rbd-config-global
rbd: add 'config global' command to get/store overrides in mon config db

Reviewed-by: Jason Dillaman <dillaman@redhat.com>
2018-10-11 10:50:33 -04:00
Mykola Golub
c552f166c3
Merge pull request #24476 from dillaman/wip-35944
librbd: add new configuration option to always move deleted items to the trash

Reviewed-by: Mykola Golub <mgolub@suse.com>
2018-10-10 18:40:14 +03:00
Mykola Golub
b3e4d43c15 rbd: add 'config global' command to get/store overrides in mon config db
Signed-off-by: Mykola Golub <mgolub@suse.com>
2018-10-10 17:31:32 +03:00
Jason Dillaman
97950fec27 qa/workunits/rbd: test new move-to-trash on image remove config override
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2018-10-10 09:08:03 -04:00
Mykola Golub
24e1a6bd47 qa/workunits/rbd: force v2 image format for namespace test
While here, fix test_locking too.

Signed-off-by: Mykola Golub <mgolub@suse.com>
2018-10-10 10:50:30 +03:00
Mykola Golub
f2d72d46d4 qa/workunits/rbd: fix cli generic namespace test
expect_fail incorrectly unset '-e' option and if a consequent test
failed it did not abort the execution. And two typos in the namespace
tests were not detected due to this.

Signed-off-by: Mykola Golub <mgolub@suse.com>
2018-10-07 15:09:25 +03:00
Mykola Golub
ecdf8cd6b2 rbd: add config commands
Signed-off-by: Mykola Golub <mgolub@suse.com>
2018-09-20 10:35:18 +03:00
Jason Dillaman
d4c7ce3c0a qa/workunits/rbd: test clone v2 across namespaces
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2018-09-19 08:05:29 -04:00
Mykola Golub
cec53e9bd2 qa/workunits/rbd: replace usage of 'rados rmpool'
This command was dropped.

Signed-off-by: Mykola Golub <mgolub@suse.com>
2018-09-05 22:52:20 +03:00
Jason Dillaman
0f0176ed4a qa/workunits/rbd: replace usage of 'rados mkpool'
This command was dropped under commit 2c26fb0fe1, so use
'ceph osd pool create' instead.

Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2018-09-05 08:17:39 -04:00
Sage Weil
2c26fb0fe1 rados: drop mkpool, rmpool commands
- mkpool and rmpool users should use the normal cli/mon commands

Signed-off-by: Sage Weil <sage@redhat.com>
2018-08-31 09:27:36 -05:00
Mykola Golub
7f27f19753 rbd: CLI to migrate images
Signed-off-by: Mykola Golub <mgolub@suse.com>
2018-08-14 18:29:45 -04:00
Jason Dillaman
1e45d405da qa/workunits/rbd: updates to the clone v2 CLI tests
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2018-07-24 08:52:33 -04:00
Jason Dillaman
3e8624f157 rbd: add support for namespaces
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2018-06-22 10:43:51 -04:00
Jason Dillaman
4437c136b4 rbd: add namespace create/remove/ls actions
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2018-06-18 18:43:40 -04:00
Jason Dillaman
d5b7d672b9 qa/workunits/rbd: fix unit formatting tests
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2018-05-24 15:54:31 -04:00
Sage Weil
ddd3095bc0 qa/workunits/rbd/cli_generic: update unit formatting
Signed-off-by: Sage Weil <sage@redhat.com>
2018-05-17 11:14:39 -05:00
Mykola Golub
e387f91955 rbd: deep copy option to copy clone parent data
Signed-off-by: Mykola Golub <mgolub@suse.com>
2018-05-16 16:07:48 +03:00
Jason Dillaman
3e8b74fb3d qa/workunits/rbd/cli_generic: update unit formatting
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2018-04-20 11:26:48 -04:00
Jason Dillaman
3b08c0609c Merge pull request #20460 from colletj/v1_image_creation_disallow
librbd: disallow creation of v1 image format

Reviewed-by: Jason Dillaman <dillaman@redhat.com>
2018-04-03 09:18:39 -04:00
Jason Dillaman
6885380c24
Merge pull request #18317 from hitoshikamei/master-rbd
rbd: eager-thick provisioning support

Reviewed-by: Jason Dillaman <dillaman@redhat.com>
2018-03-30 08:45:15 -04:00
Mykola Golub
4784d6202b rbd: return image id in info command output
And as a side effect, previously when rbd info was called
with --image-id, the image id was shown instead of the image name,
so the user was not able to see the image name from info output.
Now it will show the image name.

Signed-off-by: Mykola Golub <mgolub@suse.com>
2018-03-18 06:37:19 +02:00
Hitoshi Kamei
b517532d53 rbd: qa code for thick provision support
Add the qa code for thick provision option, if applied.

The qa code creates and checks 64 MB thick-provision image
for small image test, and it also creates and checks 4 GB
thick-provision image for large image test.

Signed-off-by: Hitoshi Kamei <hitoshi.kamei.xm@hitachi.com>
Cc: Mitsuo Hayasaka <mitsuo.hayasaka.hu@hitachi.com>
2018-03-13 17:25:24 +09:00
Julien COLLET
18d9a74b69 test/librbd: use v1 images in the rbd unit tests
Update the test/qa scripts to support the v1 creation disallow fix (using
the RBD_FORCE_ALLOW_V1 environment variable).

Signed-off-by: Julien Collet <julien.collet@cern.ch>
2018-03-06 09:07:32 +01:00
Jason Dillaman
82ef376e80 librbd: auto-remove trash snapshots when image is deleted
Fixes: http://tracker.ceph.com/issues/22873
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2018-02-09 13:34:55 -05:00
Mykola Golub
57baca0166 qa/workunits/rbd/cli_generic: fix test_purge for rbd default format 1
Signed-off-by: Mykola Golub <mgolub@suse.com>
2018-02-09 16:04:43 +02:00
songweibin
21c3bc3e69 test/rbd: cli_generic fails if v1 image format or deep-flatten disabled
Fixes: http://tracker.ceph.com/issues/22950

Signed-off-by: songweibin <song.weibin@zte.com.cn>
2018-02-09 16:17:27 +08:00