From 18df191a381ced63613dea302c5bf2e172d3c803 Mon Sep 17 00:00:00 2001
From: Devan Goodwin <dgoodwin@redhat.com>
Date: Thu, 29 Oct 2015 15:07:42 -0300
Subject: Functional disk space checking for etcd backup.

---
 playbooks/adhoc/upgrades/upgrade.yml | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

(limited to 'playbooks/adhoc')

diff --git a/playbooks/adhoc/upgrades/upgrade.yml b/playbooks/adhoc/upgrades/upgrade.yml
index c2c1d57e8..ec0eca66c 100644
--- a/playbooks/adhoc/upgrades/upgrade.yml
+++ b/playbooks/adhoc/upgrades/upgrade.yml
@@ -26,10 +26,13 @@
   - debug: var=avail_disk.stdout
   - name: Check current etcd disk usage
     shell: >
-      df --output=avail -k /var/lib/openshift/openshift.local.etcd/ | tail -n 1
+      du -k {{ openshift.common.data_dir }}/openshift.local.etcd | tail -n 1 | cut -f1
     register: etc_disk_usage
     when: embedded_etcd | bool
   - debug: var=etc_disk_usage.stdout
+  - name: Abort if insufficient disk space for etcd backup
+    fail: msg="{{ etc_disk_usage.stdout }} Kb disk space required for etcd backup, {{ avail_disk.stdout }} Kb available."
+    when: (embedded_etcd | bool) and (etc_disk_usage.stdout|int > avail_disk.stdout|int)
   - fail: msg="All done for now."
 
 - name: Re-Run cluster configuration to apply latest configuration changes
-- 
cgit v1.2.3