From 9174de2ec2d4a6ea3b3fa3fd0e3460901e925e87 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Diemer?= <stephane.diemer@ubicast.eu>
Date: Wed, 15 Jul 2020 10:10:32 +0200
Subject: [PATCH] Check for ACL mount param | refs #32387

---
 tests/test_partitions.py | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/tests/test_partitions.py b/tests/test_partitions.py
index 4c4caa11..1d1d8cda 100755
--- a/tests/test_partitions.py
+++ b/tests/test_partitions.py
@@ -81,6 +81,7 @@ def get_memory_gbytes():
 
 
 def get_path_fs(path):
+    # Example of "df" output:
     # Filesystem     Type   1B-blocks        Used   Available
     # /dev/loop2     ext4 52710469632 38253940736 11755397120
     status, output = subprocess.getstatusoutput('df --output="source,fstype,size,avail" -B 1 %s | tail -n 1' % path)
@@ -88,7 +89,14 @@ def get_path_fs(path):
         dev, fstype, size, available = output.split()
     else:
         dev = fstype = size = available = None
-    return dev, fstype, to_gbytes(int(size)), to_gbytes(int(available))
+    # Example of "mount" output:
+    # /dev/sdb2 on / type ext4 (rw,relatime,errors=remount-ro)
+    status, output = subprocess.getstatusoutput("mount | grep '%s '" % dev)
+    if status == 0:
+        params = output.split()[-1].strip('()').split(',')
+    else:
+        params = list()
+    return dev, fstype, params, to_gbytes(int(size)), to_gbytes(int(available))
 
 
 def check_allocation(dev):
@@ -130,7 +138,7 @@ if __name__ == '__main__':
             if os.path.exists(mount_point):
                 mount_point = os.path.realpath(mount_point)
                 name = 'Partition of %s' % mount_point
-                dev, fstype, psize, available = get_path_fs(mount_point)
+                dev, fstype, params, psize, available = get_path_fs(mount_point)
                 condition = part_info.get('condition')
                 if condition:
                     subdev = get_path_fs(condition.strip('!'))[0]
@@ -145,6 +153,9 @@ if __name__ == '__main__':
                     warning = True
                 if 'nfs' not in fstype:
                     warning = not check_allocation(dev)
+                if 'acl' in params:
+                    print('%sThe device %s is mounted using ACL.%s Please set "noacl" mount parameter in fstab and reboot.' % (RED, dev, DEF))
+                    error = True
                 min_available_gbytes = part_info.get('min_available_gbytes')
                 if min_available_gbytes and available < min_available_gbytes:
                     print('%s has less than %s GB available %s(%s GB available)%s.' % (name, min_available_gbytes, RED, available, DEF))
-- 
GitLab