@@ -526,6 +526,54 @@ for i in ${image2} ${image4}; do
526526 remove_image_retry ${CLUSTER2} ${POOL} ${i}
527527done
528528
529+ if [ " ${RBD_MIRROR_MODE} " = " snapshot" ]; then
530+ testlog " TEST: request image resync when remote is not primary"
531+ test_resync_image=test_resync_image
532+ create_image_and_enable_mirror ${CLUSTER2} ${POOL} ${test_resync_image} ${RBD_MIRROR_MODE}
533+ write_image ${CLUSTER2} ${POOL} ${test_resync_image} 100
534+ wait_for_image_replay_stopped ${CLUSTER2} ${POOL} ${test_resync_image}
535+ wait_for_image_replay_started ${CLUSTER1} ${POOL} ${test_resync_image}
536+ wait_for_replay_complete ${CLUSTER1} ${CLUSTER2} ${POOL} ${POOL} ${test_resync_image}
537+ wait_for_replaying_status_in_pool_dir ${CLUSTER1} ${POOL} ${test_resync_image}
538+ wait_for_status_in_pool_dir ${CLUSTER2} ${POOL} ${test_resync_image} ' up+stopped'
539+ write_image ${CLUSTER2} ${POOL} ${test_resync_image} 100
540+ demote_image ${CLUSTER2} ${POOL} ${test_resync_image}
541+ request_resync_image ${CLUSTER1} ${POOL} ${test_resync_image} test_resync_image_id
542+ wait_for_status_in_pool_dir ${CLUSTER2} ${POOL} ${test_resync_image} ' up+unknown' ' remote image is not primary'
543+ wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${test_resync_image} ' up+unknown' ' remote image is not primary'
544+ promote_image ${CLUSTER1} ${POOL} ${test_resync_image}
545+ wait_for_image_replay_started ${CLUSTER2} ${POOL} ${test_resync_image}
546+ wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${test_resync_image} ' up+stopped'
547+ wait_for_status_in_pool_dir ${CLUSTER2} ${POOL} ${test_resync_image} ' up+replaying'
548+ compare_images ${CLUSTER1} ${CLUSTER2} ${POOL} ${POOL} ${test_resync_image}
549+ remove_image_retry ${CLUSTER1} ${POOL} ${test_resync_image}
550+
551+ if [ -z " ${RBD_MIRROR_USE_RBD_MIRROR} " ]; then
552+ testlog " TEST: request image resync when remote is not primary and daemon is offline"
553+ test_resync_image=test_resync_image
554+ create_image_and_enable_mirror ${CLUSTER2} ${POOL} ${test_resync_image} ${RBD_MIRROR_MODE}
555+ write_image ${CLUSTER2} ${POOL} ${test_resync_image} 100
556+ wait_for_image_replay_stopped ${CLUSTER2} ${POOL} ${test_resync_image}
557+ wait_for_image_replay_started ${CLUSTER1} ${POOL} ${test_resync_image}
558+ wait_for_replay_complete ${CLUSTER1} ${CLUSTER2} ${POOL} ${POOL} ${test_resync_image}
559+ wait_for_replaying_status_in_pool_dir ${CLUSTER1} ${POOL} ${test_resync_image}
560+ wait_for_status_in_pool_dir ${CLUSTER2} ${POOL} ${test_resync_image} ' up+stopped'
561+ stop_mirrors ${CLUSTER1}
562+ write_image ${CLUSTER2} ${POOL} ${test_resync_image} 100
563+ demote_image ${CLUSTER2} ${POOL} ${test_resync_image}
564+ request_resync_image ${CLUSTER1} ${POOL} ${test_resync_image} test_resync_image_id
565+ start_mirrors ${CLUSTER1}
566+ wait_for_status_in_pool_dir ${CLUSTER2} ${POOL} ${test_resync_image} ' up+unknown' ' remote image is not primary'
567+ wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${test_resync_image} ' up+unknown' ' remote image is not primary'
568+ promote_image ${CLUSTER1} ${POOL} ${test_resync_image}
569+ wait_for_image_replay_started ${CLUSTER2} ${POOL} ${test_resync_image}
570+ wait_for_status_in_pool_dir ${CLUSTER1} ${POOL} ${test_resync_image} ' up+stopped'
571+ wait_for_status_in_pool_dir ${CLUSTER2} ${POOL} ${test_resync_image} ' up+replaying'
572+ compare_images ${CLUSTER1} ${CLUSTER2} ${POOL} ${POOL} ${test_resync_image}
573+ remove_image_retry ${CLUSTER1} ${POOL} ${test_resync_image}
574+ fi
575+ fi
576+
529577testlog " TEST: disable mirror while daemon is stopped"
530578stop_mirrors ${CLUSTER1}
531579stop_mirrors ${CLUSTER2}
0 commit comments