]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/rbd_support: level_spec is optional for schedule list/status
authorIlya Dryomov <idryomov@gmail.com>
Sat, 29 Jan 2022 14:01:27 +0000 (15:01 +0100)
committerIlya Dryomov <idryomov@gmail.com>
Sun, 6 Feb 2022 20:31:08 +0000 (21:31 +0100)
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 <idryomov@gmail.com>
(cherry picked from commit a5eef01e9248b09c187fcb8c6d122fd08dc54c88)

qa/workunits/rbd/cli_generic.sh
src/pybind/mgr/rbd_support/module.py

index e6a7cb759879cdbbc95e9bc8fbcef66d0bfbb465..ee4658c10594caf238af45b8d4c6dd506777e53a 100755 (executable)
@@ -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)" = "[]"
 
index 7e908c8235e1790d28dcb94afe8fa5c271f94eef..7a3f4d6260922f5ae5712c179d3ee6f58fecd192 100644 (file)
@@ -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
         """