The ENOENT error was ignored by the librbd API that retrieves mirror
group information. This manifests as a bug in the mirror group
snapshot scheduler, where the scheduler utilized this API to prevent
scheduler commands on groups that are not enabled for snapshot-based
mirroring. Since the librbd API masked the ENOENT error, the
scheduler's check for mirror group mode was compromised, resulting
in scheduler commands unexpectedly succeeding on groups that were not
enabled for snapshot-based mirroring. Therefore, allow the ENOENT error
from the API that retrieves mirror group information to surface. This
fixes the spurious mirror group mode check in the mirror snapshot
scheduler. Additionally, add a test to ensure that group snapshot
schedule commands fail on a group not enabled for mirroring.
Signed-off-by: Ramana Raja <rraja@redhat.com>
rbd group image add rbd2/ns1/gp1 rbd2/ns1/img1
rbd group image add rbd2/ns1/gp1 rbd2/ns1/img2
+ # group snapshot schedule commands should fail when mirroring is not
+ # enabled on the group
+ expect_fail rbd mirror group snapshot schedule add -p rbd2/ns1 --group gp1 1m
+ expect_fail rbd mirror group snapshot schedule rm -p rbd2/ns1 --group gp1
+ expect_fail rbd mirror group snapshot schedule ls -p rbd2/ns1 --group gp1
+
test "$(rbd group snap ls rbd2/ns1/gp1 | grep -c mirror.primary)" = '0'
rbd mirror group enable rbd2/ns1/gp1 snapshot
}
void finish(int r) override {
- if (r < 0 && r != -ENOENT) {
+ if (r < 0) {
on_finish->complete(r);
return;
}