Instead of running a 'df' external command, simply use python's builtin os.statvfs() for fetching the very same information.
Signed-off-by: Cleber Rosa <[email protected]> --- client/common_lib/hosts/base_classes.py | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/client/common_lib/hosts/base_classes.py b/client/common_lib/hosts/base_classes.py index 0b6ce0c..86c1ea5 100644 --- a/client/common_lib/hosts/base_classes.py +++ b/client/common_lib/hosts/base_classes.py @@ -230,8 +230,8 @@ class Host(object): def check_diskspace(self, path, gb): logging.info('Checking for >= %s GB of space under %s on machine %s', gb, path, self.hostname) - df = self.run('df -mP %s | tail -1' % path).stdout.split() - free_space_gb = int(df[3])/1000.0 + statvfs = os.statvfs(path) + free_spage_gb = int((statvfs.f_bavail * statvfs.f_bsize) / 1000000000) if free_space_gb < gb: raise error.AutoservDiskFullHostError(path, gb, free_space_gb) else: -- 1.7.1 _______________________________________________ Autotest mailing list [email protected] http://test.kernel.org/cgi-bin/mailman/listinfo/autotest
