Whamcloud - gitweb
LU-4438 utils: handle ct_setup() errors 53/9853/10
authorBruno Faccini <bruno.faccini@intel.com>
Sun, 30 Mar 2014 15:44:43 +0000 (17:44 +0200)
committerOleg Drokin <oleg.drokin@intel.com>
Wed, 11 Jun 2014 02:38:06 +0000 (02:38 +0000)
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 <bruno.faccini@intel.com>
Change-Id: I108ea679faf2731f2a64fb08d2f8fba9db01c71f
Reviewed-on: http://review.whamcloud.com/9853
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Nathaniel Clark <nathaniel.l.clark@intel.com>
Reviewed-by: James Nunez <james.a.nunez@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/tests/sanity-hsm.sh
lustre/utils/lhsmtool_posix.c

index 587aeaf..954f195 100755 (executable)
@@ -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
 
index 2e82fbc..7650a8d 100644 (file)
@@ -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;