diff options
Diffstat (limited to 'abs/core/LinHES-system/balance_storage.py')
-rwxr-xr-x | abs/core/LinHES-system/balance_storage.py | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/abs/core/LinHES-system/balance_storage.py b/abs/core/LinHES-system/balance_storage.py index a6995ca..5556fd0 100755 --- a/abs/core/LinHES-system/balance_storage.py +++ b/abs/core/LinHES-system/balance_storage.py @@ -73,19 +73,29 @@ if __name__ == '__main__': continue freePcent = getFreePercentForDir(directory) freeSize = getFreeSpaceForDir(directory) - # Check if SG has any mpg or nuv files and if so add to SGDIRSdata - if len(glob.glob1(directory,"*.mpg")) or len(glob.glob1(directory,"*.nuv")): - SGDIRSdata.append([directory, freePcent, freeSize]) - print " " + directory + " - " + str(freePcent * 100) + "%" + SGDIRSdata.append([directory, freePcent, freeSize]) + print " " + directory + " - " + str(freePcent * 100) + "%" # Sort data on percent free SGDIRSdata = sorted(SGDIRSdata, reverse=True, key=operator.itemgetter(1)) #print SGDIRSdata - mostFull = SGDIRSdata[0] + + # Check if SG has any mpg or nuv files + i=0 + for dir in SGDIRSdata: + mostFull = SGDIRSdata[i] + i=i+1 + if len(glob.glob1(mostFull[0],"*.mpg")) or len(glob.glob1(mostFull[0],"*.nuv")): + break + else: + if i == 1: + print "------------------------------------------------" + print " " + mostFull[0] + " - NO files to move" + leastFull = SGDIRSdata[-1] print "------------------------------------------------" - print "Most Used Storage Group Directory: " + print "Most Used Storage Group Directory with files to move: " print " " + str(mostFull[0]) + " - " + str(mostFull[1] * 100) + "%" print "Least Used Storage Group Directory: " print " " + str(leastFull[0]) + " - " + str(leastFull[1] * 100) + "%" |