Index: client/common_lib/hosts/base_classes.py |
diff --git a/client/common_lib/hosts/base_classes.py b/client/common_lib/hosts/base_classes.py |
index 0b6ce0cb993b13d26af86a2f54f1f68d7c844208..e0c240f24b6bd1fdec6274c09dae26bcc8831a99 100644 |
--- a/client/common_lib/hosts/base_classes.py |
+++ b/client/common_lib/hosts/base_classes.py |
@@ -228,10 +228,11 @@ class Host(object): |
def check_diskspace(self, path, gb): |
+ # Note: 1 GB = 10**9 bytes (SI unit). |
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 |
+ df = self.run('df -PB %d %s | tail -1' % (10**9, path)).stdout.split() |
+ free_space_gb = int(df[3]) |
if free_space_gb < gb: |
raise error.AutoservDiskFullHostError(path, gb, free_space_gb) |
else: |