From f46383e0af85797372bb4da25e8be5a8bd155dff Mon Sep 17 00:00:00 2001 From: Frank Liepold Date: Mon, 3 Feb 2014 07:38:34 +0100 Subject: [PATCH] test_suite: fix: use primary --force if network is cut yet --- test_suite/scripts/modules/65_switch2primary.sh | 10 ++++++---- test_suite/scripts/modules/95_marsadm.sh | 8 ++++++++ 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/test_suite/scripts/modules/65_switch2primary.sh b/test_suite/scripts/modules/65_switch2primary.sh index b2e75c5d..4c5d0756 100644 --- a/test_suite/scripts/modules/65_switch2primary.sh +++ b/test_suite/scripts/modules/65_switch2primary.sh @@ -373,13 +373,15 @@ function switch2primary_correct_split_brain marsadm_do_cmd $new_secondary "leave-resource --force" "$res" || \ lib_exit 1 marsadm_do_cmd $new_primary "log-purge-all" "$res" || lib_exit 1 - marsadm_do_cmd $new_primary "primary" "$res" || lib_exit 1 + if [ $network_cut -eq 0 ]; then + marsadm_do_cmd $new_primary "primary" "$res" || lib_exit 1 + else + marsadm_primary_force $new_primary $res + fi else # we need primary --force, because the deleted resource on the # new_secondary does not switch from primary to secondary - marsadm_do_cmd $new_primary "disconnect" "$res" || lib_exit 1 - marsadm_do_cmd $new_primary "primary --force" "$res" || lib_exit 1 - marsadm_do_cmd $new_primary "connect" "$res" || lib_exit 1 + marsadm_primary_force $new_primary $res fi lib_vmsg " $switch2primary_flow_msg_prefix: check whether new primary $new_primary works standalone" switch2primary_check_standalone_primary $new_primary $res diff --git a/test_suite/scripts/modules/95_marsadm.sh b/test_suite/scripts/modules/95_marsadm.sh index dd452c99..ee4b8879 100644 --- a/test_suite/scripts/modules/95_marsadm.sh +++ b/test_suite/scripts/modules/95_marsadm.sh @@ -300,3 +300,11 @@ function marsadm_host_is_designated_primary fi return 1 } + +function marsadm_primary_force +{ + local host=$1 res=$2 + marsadm_do_cmd $host "disconnect" "$res" || lib_exit 1 + marsadm_do_cmd $host "primary --force" "$res" || lib_exit 1 + marsadm_do_cmd $host "connect" "$res" || lib_exit 1 +}