File disktest_freespace.patch of Package autotest
--- tests/disktest/disktest.py
+++ tests/disktest/disktest.py
@@ -1,8 +1,12 @@
import test
from autotest_utils import *
-import os, sys
+import os, sys, statvfs
from subprocess import *
+def freespace(path):
+ s = os.statvfs(path)
+ return s[statvfs.F_BAVAIL] * long(s[statvfs.F_BSIZE])
+
class disktest(test.test):
version = 1
@@ -27,6 +31,9 @@
def execute(self, disks, gigabytes = 10, chunk_mb = memtotal()/1024):
os.chdir(self.srcdir)
+ gigabytes=freespace("/") / 1024 / 1024 / 1024
+ print "resizing to %s GB" % gigabytes
+
self.chunk_mb = chunk_mb
self.memory_mb = memtotal()/1024
if self.memory_mb > chunk_mb: