From 8783b1b183598fbf95b4214a229f25d4ab914304 Mon Sep 17 00:00:00 2001 From: Bruno Faccini Date: Sun, 30 Mar 2014 17:44:43 +0200 Subject: [PATCH] LU-4438 utils: handle ct_setup() errors Problem has been encountered causing sanity-hsm/test_402 errors because copytool threads were found still alive after MDCs deactivation. This appears to be due to no ct_setup() error handling with continuing+unnecessary startup actions to occur. Also, now that copytool will exit earlier, HSMTOOL_NOERROR variable has been added to allow errors in copytool_setup(). Signed-off-by: Bruno Faccini Change-Id: I108ea679faf2731f2a64fb08d2f8fba9db01c71f Reviewed-on: http://review.whamcloud.com/9853 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Nathaniel Clark Reviewed-by: James Nunez Reviewed-by: Oleg Drokin --- lustre/tests/sanity-hsm.sh | 14 +++++++++++--- lustre/utils/lhsmtool_posix.c | 7 +++++-- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/lustre/tests/sanity-hsm.sh b/lustre/tests/sanity-hsm.sh index 4a3009b..1d2ab49 100755 --- a/lustre/tests/sanity-hsm.sh +++ b/lustre/tests/sanity-hsm.sh @@ -103,6 +103,9 @@ init_agt_vars() { # archive is purged at copytool setup HSM_ARCHIVE_PURGE=true + + # Don't allow copytool error upon start/setup + HSMTOOL_NOERROR=false } # Get the backend root path for the given agent facet. @@ -237,8 +240,13 @@ copytool_setup() { [[ -z "$TESTNAME" ]] || prefix=$prefix.$TESTNAME local copytool_log=$prefix.copytool${arc_id}_log.$agent.log - do_facet $facet "$cmd < /dev/null > $copytool_log 2>&1" || - error "start copytool $facet on $agent failed" + do_facet $facet "$cmd < /dev/null > $copytool_log 2>&1" + if [[ $? != 0 ]]; then + [[ $HSMTOOL_NOERROR == true ]] || + error "start copytool $facet on $agent failed" + echo "start copytool $facet on $agent failed" + fi + trap cleanup EXIT } @@ -3945,7 +3953,7 @@ test_402() { # deactivate all mdc on agent1 mdc_change_state $SINGLEAGT "$FSNAME-MDT000." "deactivate" - copytool_setup $SINGLEAGT + HSMTOOL_NOERROR=true copytool_setup $SINGLEAGT check_agent_unregistered "uuid" # match any agent diff --git a/lustre/utils/lhsmtool_posix.c b/lustre/utils/lhsmtool_posix.c index 13af205..d5bf9fc 100644 --- a/lustre/utils/lhsmtool_posix.c +++ b/lustre/utils/lhsmtool_posix.c @@ -1838,7 +1838,7 @@ static int ct_setup(void) if (rc < 0) { CT_ERROR(rc, "cannot find a Lustre filesystem mounted at '%s'", opt.o_mnt); - return -rc; + return rc; } return rc; @@ -1871,7 +1871,9 @@ int main(int argc, char **argv) return -rc; } - ct_setup(); + rc = ct_setup(); + if (rc < 0) + goto error_cleanup; switch (opt.o_action) { case CA_IMPORT: @@ -1893,6 +1895,7 @@ int main(int argc, char **argv) " rc=%d (%s)", err_major, err_minor, rc, strerror(-rc)); +error_cleanup: ct_cleanup(); return -rc; -- 1.8.3.1