Skip to content
Snippets Groups Projects
Commit 9174de2e authored by Stéphane Diemer's avatar Stéphane Diemer
Browse files

Check for ACL mount param | refs #32387

parent b7802545
No related branches found
No related tags found
No related merge requests found
......@@ -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))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment