From: Ilya Dryomov Date: Sat, 29 Jan 2022 14:01:27 +0000 (+0100) Subject: mgr/rbd_support: level_spec is optional for schedule list/status X-Git-Tag: v18.0.0~1464^2~1 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=a5eef01e9248b09c187fcb8c6d122fd08dc54c88;p=ceph-ci.git mgr/rbd_support: level_spec is optional for schedule list/status Commit fea6fdff4c74 ("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 --- diff --git a/qa/workunits/rbd/cli_generic.sh b/qa/workunits/rbd/cli_generic.sh index e6a7cb75987..ee4658c1059 100755 --- a/qa/workunits/rbd/cli_generic.sh +++ b/qa/workunits/rbd/cli_generic.sh @@ -1129,6 +1129,9 @@ test_trash_purge_schedule() { rbd pool init rbd2 rbd namespace create rbd2/ns1 + test "$(ceph rbd trash purge schedule list)" = "{}" + ceph rbd trash purge schedule status | fgrep '"scheduled": []' + expect_fail rbd trash purge schedule ls test "$(rbd trash purge schedule ls -R --format json)" = "[]" @@ -1229,6 +1232,9 @@ test_mirror_snapshot_schedule() { rbd mirror pool enable rbd2/ns1 image rbd mirror pool peer add rbd2 cluster1 + test "$(ceph rbd mirror snapshot schedule list)" = "{}" + ceph rbd mirror snapshot schedule status | fgrep '"scheduled_images": []' + expect_fail rbd mirror snapshot schedule ls test "$(rbd mirror snapshot schedule ls -R --format json)" = "[]" diff --git a/src/pybind/mgr/rbd_support/module.py b/src/pybind/mgr/rbd_support/module.py index 7e908c8235e..7a3f4d62609 100644 --- a/src/pybind/mgr/rbd_support/module.py +++ b/src/pybind/mgr/rbd_support/module.py @@ -108,7 +108,7 @@ class Module(MgrModule): @CLIReadCommand('rbd mirror snapshot schedule list') @with_latest_osdmap def mirror_snapshot_schedule_list(self, - level_spec: str) -> Tuple[int, str, str]: + level_spec: str = '') -> Tuple[int, str, str]: """ List rbd mirror snapshot schedule """ @@ -118,7 +118,7 @@ class Module(MgrModule): @CLIReadCommand('rbd mirror snapshot schedule status') @with_latest_osdmap def mirror_snapshot_schedule_status(self, - level_spec: str) -> Tuple[int, str, str]: + level_spec: str = '') -> Tuple[int, str, str]: """ Show rbd mirror snapshot schedule status """ @@ -248,7 +248,7 @@ class Module(MgrModule): @CLIReadCommand('rbd trash purge schedule list') @with_latest_osdmap def trash_purge_schedule_list(self, - level_spec: str) -> Tuple[int, str, str]: + level_spec: str = '') -> Tuple[int, str, str]: """ List rbd trash purge schedule """ @@ -258,7 +258,7 @@ class Module(MgrModule): @CLIReadCommand('rbd trash purge schedule status') @with_latest_osdmap def trash_purge_schedule_status(self, - level_spec: str) -> Tuple[int, str, str]: + level_spec: str = '') -> Tuple[int, str, str]: """ Show rbd trash purge schedule status """