From 39f5f271f6f8297c3478390d94466ffb071e313e 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 587aeaf..954f195 100755 --- a/lustre/tests/sanity-hsm.sh +++ b/lustre/tests/sanity-hsm.sh @@ -105,6 +105,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. @@ -239,8 +242,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 } @@ -4007,7 +4015,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 2e82fbc..7650a8d 100644 --- a/lustre/utils/lhsmtool_posix.c +++ b/lustre/utils/lhsmtool_posix.c @@ -1844,7 +1844,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; @@ -1877,7 +1877,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: @@ -1899,6 +1901,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