Whamcloud - gitweb
EX-5360 lipe: lpcc handles unmounted lustre fs
authorLei Feng <flei@whamcloud.com>
Thu, 9 Jun 2022 09:46:54 +0000 (17:46 +0800)
committerJohn L. Hammond <jhammond@whamcloud.com>
Fri, 10 Jun 2022 15:41:19 +0000 (15:41 +0000)
If lustre fs is unmounted, lpcc daemon crashes while serving
'lpcc status' command. Fix it.

Signed-off-by: Lei Feng <flei@whamcloud.com>
Test-Parameters: trivial testlist=sanity-lipe
Change-Id: I5304745aed001fbe26b77ed3cebfaabfddfce11f
Reviewed-on: https://review.whamcloud.com/47572
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: John L. Hammond <jhammond@whamcloud.com>
lipe/lpcc

index 3fd3c62..05a8a7a 100755 (executable)
--- a/lipe/lpcc
+++ b/lipe/lpcc
@@ -387,7 +387,12 @@ class LpccMonitor:
         """
         result = {}
 
-        fsname = subprocess.check_output(['lfs', 'getname', mount]).split()[0]
+        try:
+            fsname = subprocess.check_output(['lfs', 'getname', mount]).split()[0]
+        except subprocess.CalledProcessError as err:
+            result['error_msg'] = os.strerror(err.returncode)
+            return result
+
         cmdline = ['lctl', 'get_param', '-n', 'llite.%s.stats' % fsname]
         output = subprocess.check_output(cmdline)
         for line in output.splitlines():