]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/rbd_support: fix recursive non-global level schedule listing 33840/head
authorMykola Golub <mgolub@suse.com>
Thu, 12 Mar 2020 13:40:25 +0000 (13:40 +0000)
committerMykola Golub <mgolub@suse.com>
Thu, 12 Mar 2020 13:40:25 +0000 (13:40 +0000)
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>
qa/workunits/rbd/cli_generic.sh
src/pybind/mgr/rbd_support/schedule.py

index 485cf75437a0fc82f5f09f49a53613d3a72d000a..e363109c28a8dba9a7ad234b543e96eea1865a4a 100755 (executable)
@@ -964,6 +964,12 @@ test_trash_purge_schedule() {
     expect_fail rbd trash purge schedule ls -p rbd2
     rbd trash purge schedule ls -p rbd2 -R | grep 'every 2d starting at 00:17'
     rbd trash purge schedule ls -p rbd2/ns1 -R | grep 'every 2d starting at 00:17'
+    test "$(rbd trash purge schedule ls -R -p rbd2/ns1 --format xml |
+        $XMLSTARLET sel -t -v '//schedules/schedule/pool')" = "-"
+    test "$(rbd trash purge schedule ls -R -p rbd2/ns1 --format xml |
+        $XMLSTARLET sel -t -v '//schedules/schedule/namespace')" = "-"
+    test "$(rbd trash purge schedule ls -R -p rbd2/ns1 --format xml |
+        $XMLSTARLET sel -t -v '//schedules/schedule/items/item/start_time')" = "00:17:00"
 
     for i in `seq 12`; do
         rbd trash purge schedule status --format xml |
index d791522446b4385ebd12ffac0effbd7b094b5e70..795f8f5fe2b0d6e7f5b184b00855713b08aa3f88 100644 (file)
@@ -497,7 +497,7 @@ class Schedules:
         result = {}
         for level_spec_id, schedule in self.schedules.items():
             ls = self.level_specs[level_spec_id]
-            if ls == parent or ls.is_child_of(parent):
+            if ls == parent or ls == level_spec or ls.is_child_of(level_spec):
                 result[level_spec_id] = {
                     'name' : schedule.name,
                     'schedule' : schedule.to_list(),