summaryrefslogtreecommitdiffstats
path: root/roles/openshift_health_checker/openshift_checks
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2017-10-27 16:45:31 -0700
committerGitHub <noreply@github.com>2017-10-27 16:45:31 -0700
commitbc00510f20bc516a0fcc738981ac60fd9c01ad5d (patch)
tree80212eeaae266c35955d90ede3577e94c8c11798 /roles/openshift_health_checker/openshift_checks
parent2c81304511afcf03b35583f85040fb7d0b83cad5 (diff)
parent4fb35642a47550021fed3e455bedc9b6fdf2b9c9 (diff)
downloadopenshift-bc00510f20bc516a0fcc738981ac60fd9c01ad5d.tar.gz
openshift-bc00510f20bc516a0fcc738981ac60fd9c01ad5d.tar.bz2
openshift-bc00510f20bc516a0fcc738981ac60fd9c01ad5d.tar.xz
openshift-bc00510f20bc516a0fcc738981ac60fd9c01ad5d.zip
Merge pull request #5816 from sosiouxme/20171019-disk-check-sum-var
Automatic merge from submit-queue. disk_availability check: include submount storage Fixes bug [1491566](https://bugzilla.redhat.com/show_bug.cgi?id=1491566) In order to determine how much storage is under a path, include any mounts that are below it in addition to the path itself.
Diffstat (limited to 'roles/openshift_health_checker/openshift_checks')
-rw-r--r--roles/openshift_health_checker/openshift_checks/disk_availability.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/roles/openshift_health_checker/openshift_checks/disk_availability.py b/roles/openshift_health_checker/openshift_checks/disk_availability.py
index 7956559c6..87e6146d4 100644
--- a/roles/openshift_health_checker/openshift_checks/disk_availability.py
+++ b/roles/openshift_health_checker/openshift_checks/disk_availability.py
@@ -1,6 +1,7 @@
"""Check that there is enough disk space in predefined paths."""
import tempfile
+import os.path
from openshift_checks import OpenShiftCheck, OpenShiftCheckException
@@ -121,11 +122,21 @@ class DiskAvailability(OpenShiftCheck):
return {}
+ def find_ansible_submounts(self, path):
+ """Return a list of ansible_mounts that are below the given path."""
+ base = os.path.join(path, "")
+ return [
+ mount
+ for mount in self.get_var("ansible_mounts")
+ if mount["mount"].startswith(base)
+ ]
+
def free_bytes(self, path):
"""Return the size available in path based on ansible_mounts."""
+ submounts = sum(mnt.get('size_available', 0) for mnt in self.find_ansible_submounts(path))
mount = self.find_ansible_mount(path)
try:
- return mount['size_available']
+ return mount['size_available'] + submounts
except KeyError:
raise OpenShiftCheckException(
'Unable to retrieve disk availability for "{path}".\n'