Enabling mirroring for a pool wiht clones may fail
When enabling RBD mirroring within a pool (rbd.mirror_mode_set(ioctx, RBD_MIRROR_MODE_POOL)), it tries to enable mirroring for every existent image in the pool in the order the images are returned by list dir. So it is possible that it tries to enable mirroring for a child image before its parent and fails with an error like below:
2017-03-02 10:47:59.908586 7ff8726bf580 -1 librbd: mirroring is not enabled for the parent
2017-03-02 10:47:59.908591 7ff8726bf580 -1 librbd: error enabling mirroring for image child: (22) Invalid argument
On teuthology it is observed as failure of jobs 'config/copy-on-read.yaml ... workloads/c_api_tests_with_journaling.yaml' in TestLibRBD.Mirror when it tries to enable mirroring for a pool that is reused from TestLibRBD.TestCoR and contains a clone.
CEPH_ARGS='--rbd_clone_copy_on_read=true' RBD_FEATURES=125 \ ./bin/ceph_test_librbd --gtest_filter=TestLibRBD.TestCoR:TestLibRBD.Mirror ... [ OK ] TestLibRBD.TestCoR (6705 ms) [ RUN ] TestLibRBD.Mirror /home/mgolub/ceph.ci/src/test/librbd/test_librbd.cc:5458: Failure Expected: 0 To be equal to: rbd.mirror_mode_set(ioctx, RBD_MIRROR_MODE_POOL) Which is: -22 [ FAILED ] TestLibRBD.Mirror (14 ms)