diff options
author | Britney Fransen <brfransen@gmail.com> | 2015-10-02 13:19:33 (GMT) |
---|---|---|
committer | Britney Fransen <brfransen@gmail.com> | 2015-10-02 13:19:33 (GMT) |
commit | 9e3af8b0450a452bc91c67a22f215d325b85def1 (patch) | |
tree | f873e518996af88df50a2b163b7cad82085ab94d /abs/core/LinHES-system/balance_storage.py | |
parent | ad32538bf7e22a19b6dd29121548ee5bfa06da8c (diff) | |
download | linhes_pkgbuild-9e3af8b0450a452bc91c67a22f215d325b85def1.zip linhes_pkgbuild-9e3af8b0450a452bc91c67a22f215d325b85def1.tar.gz linhes_pkgbuild-9e3af8b0450a452bc91c67a22f215d325b85def1.tar.bz2 |
LinHES-system: balance_storage.py: move check for files to find most full group
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) + "%" |