From: Mykola Golub Date: Thu, 12 Mar 2020 13:40:25 +0000 (+0000) Subject: mgr/rbd_support: fix recursive non-global level schedule listing X-Git-Tag: v15.1.1~11^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F33840%2Fhead;p=ceph.git 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 --- diff --git a/qa/workunits/rbd/cli_generic.sh b/qa/workunits/rbd/cli_generic.sh index 485cf75437a0..e363109c28a8 100755 --- a/qa/workunits/rbd/cli_generic.sh +++ b/qa/workunits/rbd/cli_generic.sh @@ -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 | diff --git a/src/pybind/mgr/rbd_support/schedule.py b/src/pybind/mgr/rbd_support/schedule.py index d791522446b4..795f8f5fe2b0 100644 --- a/src/pybind/mgr/rbd_support/schedule.py +++ b/src/pybind/mgr/rbd_support/schedule.py @@ -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(),