Whamcloud - gitweb
LU-9100 lnet: lctl net down success when lnet not loaded 59/25359/4
authorGiuseppe Di Natale <dinatale2@llnl.gov>
Thu, 9 Feb 2017 18:59:00 +0000 (10:59 -0800)
committerOleg Drokin <oleg.drokin@intel.com>
Thu, 23 Feb 2017 02:06:49 +0000 (02:06 +0000)
lctl network down|unconfigure will no longer issue an
error when the lnet module is not loaded. There is no
network to unconfigure. Therefore, we can let the user
know and exit without error.

Signed-off-by: Giuseppe Di Natale <dinatale2@llnl.gov>
Change-Id: I1eda08bd5bb0198e9d374b3b7f00306286da25cc
Reviewed-on: https://review.whamcloud.com/25359
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Sonia Sharma <sonia.sharma@intel.com>
Reviewed-by: Olaf Faaland-LLNL <faaland1@llnl.gov>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lnet/utils/portals.c
lustre/scripts/lnet

index 808f90f..b486569 100644 (file)
@@ -312,6 +312,11 @@ int jt_ptl_network(int argc, char **argv)
                        return 0;
                }
 
+               if (errno == ENODEV) {
+                       printf("LNET is currently not loaded.");
+                       return 0;
+               }
+
                if (errno == EBUSY)
                        fprintf(stderr, "LNET busy\n");
                else
index e66ad37..10e91c9 100644 (file)
@@ -52,23 +52,6 @@ run_postexec_check ()
        fi
 }
 
-stop_lnet ()
-{
-       local errmsg=$(/usr/sbin/lctl network down 2>&1)
-       if [ $? -gt 0 ]; then
-               # The following error message means that lnet is already
-               # unconfigured, and the modules are not loaded.
-               echo $errmsg | grep "LNET unconfigure error 19" > /dev/null
-               if [ $? -gt 0 ]; then
-                       return 0
-               else
-                       echo "$errmsg"
-                       return 1
-               fi
-       fi
-       return 0
-}
-
 status ()
 {
        old_nullglob="`shopt -p nullglob`"
@@ -148,7 +131,7 @@ case "$1" in
        ;;
   stop)
        run_preexec_check "stop"
-       stop_lnet || exit 1
+       lctl network down || exit 1
        lustre_rmmod || exit 1
        rm -f /var/lock/subsys/lnet
        run_postexec_check "stop"