quotas for xfs

This commit is contained in:
usmannasir
2024-09-18 15:13:11 +05:00
parent ec97692469
commit 0e45217f57
2 changed files with 11 additions and 33 deletions

View File

@@ -277,13 +277,6 @@ class preFlightsChecks:
try:
if parts[1] == '/' and parts[3].find('usrquota,grpquota') == -1 and len(parts[3]) > 4:
### if xfx dont move forward for now
if line.find('xfs') > -1:
retValue = 0
WriteToFile.write(line)
continue
###
parts[3] = f'{parts[3]},usrquota,grpquota'
finalString = '\t'.join(parts)
print(finalString)
@@ -291,13 +284,6 @@ class preFlightsChecks:
elif parts[1] == '/':
### if xfx dont move forward for now
if line.find('xfs') > -1:
retValue = 0
WriteToFile.write(line)
continue
###
for ii, p in enumerate(parts):
if p.find('defaults') > -1 or p.find('discard') > -1:
parts[ii] = f'{parts[ii]},usrquota,grpquota'

View File

@@ -3629,13 +3629,19 @@ pm.max_spare_servers = 3
@staticmethod
def edit_fstab(mount_point, options_to_add):
try:
retValue = 1
# Backup the original fstab file
fstab_path = '/etc/fstab'
backup_path = fstab_path + '.bak'
rData = open(fstab_path, 'r').read()
if rData.find('xfs') > -1:
options_to_add = 'uquota'
else:
options_to_add = 'usrquota,grpquota'
if not os.path.exists(backup_path):
shutil.copy(fstab_path, backup_path)
@@ -3654,32 +3660,18 @@ pm.max_spare_servers = 3
print(parts)
try:
if parts[1] == '/' and parts[3].find('usrquota,grpquota') == -1 and len(parts[3]) > 4:
if parts[1] == '/' and parts[3].find(options_to_add) == -1 and len(parts[3]) > 4:
### if xfx dont move forward for now
if line.find('xfs') > -1:
retValue = 0
WriteToFile.write(line)
continue
###
parts[3] = f'{parts[3]},usrquota,grpquota'
parts[3] = f'{parts[3]},{options_to_add}'
finalString = '\t'.join(parts)
print(finalString)
WriteToFile.write(finalString)
elif parts[1] == '/':
### if xfx dont move forward for now
if line.find('xfs') > -1:
retValue = 0
WriteToFile.write(line)
continue
###
for ii, p in enumerate(parts):
if p.find('defaults') > -1 or p.find('discard') > -1:
parts[ii] = f'{parts[ii]},usrquota,grpquota'
parts[ii] = f'{parts[ii]},{options_to_add}'
finalString = '\t'.join(parts)
print(finalString)
WriteToFile.write(finalString)
@@ -3701,7 +3693,7 @@ pm.max_spare_servers = 3
data = open(fstab_path, 'r').read()
if data.find("usrquota,grpquota") > -1:
if data.find("usrquota,grpquota") > -1 or data.find("uquota") > -1:
print("Quotas already enabled.")