summaryrefslogtreecommitdiffstats
path: root/iutil.py
diff options
context:
space:
mode:
authorJeremy Katz <katzj@redhat.com>2003-10-22 01:51:10 +0000
committerJeremy Katz <katzj@redhat.com>2003-10-22 01:51:10 +0000
commitc19694ac715ad6136f5635ca2a444caf516fc32a (patch)
tree72425605ff01376612f79086dd35d3ef096c1be0 /iutil.py
parentcd5a51d1690b6cfb3e8125d4ccf4ecb531887a6b (diff)
downloadanaconda-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.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/iutil.py b/iutil.py
index 76fb330d0..86725f0d8 100644
--- a/iutil.py
+++ b/iutil.py
@@ -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