diff options
author | Jeremy Katz <katzj@redhat.com> | 2003-10-22 01:51:10 +0000 |
---|---|---|
committer | Jeremy Katz <katzj@redhat.com> | 2003-10-22 01:51:10 +0000 |
commit | c19694ac715ad6136f5635ca2a444caf516fc32a (patch) | |
tree | 72425605ff01376612f79086dd35d3ef096c1be0 /iutil.py | |
parent | cd5a51d1690b6cfb3e8125d4ccf4ecb531887a6b (diff) | |
download | anaconda-c19694ac715ad6136f5635ca2a444caf516fc32a.tar.gz anaconda-c19694ac715ad6136f5635ca2a444caf516fc32a.tar.xz anaconda-c19694ac715ad6136f5635ca2a444caf516fc32a.zip |
don't cross mounts with getDirSize to avoid counting the nfs tree in
the amount of ram used (#105643). then count both /tmp and /tmp/ramfs
Diffstat (limited to 'iutil.py')
-rw-r--r-- | iutil.py | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -192,12 +192,15 @@ def copyFile(source, to, pw = None): def getDirSize(dir): def getSubdirSize(dir): # returns size in bytes + mydev = os.lstat(dir)[stat.ST_DEV] + dsize = 0 for f in os.listdir(dir): curpath = '%s/%s' % (dir, f) sinfo = os.lstat(curpath) if stat.S_ISDIR(sinfo[stat.ST_MODE]): - dsize += getSubdirSize(curpath) + if mydev == sinfo[stat.ST_DEV]: + dsize += getSubdirSize(curpath) elif stat.S_ISREG(sinfo[stat.ST_MODE]): dsize += sinfo[stat.ST_SIZE] else: @@ -211,6 +214,8 @@ def memAvailable(): tram = memInstalled() ramused = getDirSize("/tmp") + if os.path.isdir("/tmp/ramfs"): + ramused += getDirSize("/tmp/ramfs") return tram - ramused |