From 875fa96fb871fc0061215cafa093f35cab01c4f3 Mon Sep 17 00:00:00 2001
From: Antony Messerli <amesserl@rackspace.com>
Date: Wed, 11 Jul 2018 15:09:58 -0500
Subject: [PATCH] Make space for Cinder/Swift nodes if using nspawn

Currently if CONTAINER_TECH=nspawn is uses, Cinder and Swift
are unable to create volumes as space is fully allocated for
machines volume.

This shrinks machine00 mount to 8192 to make space for Cinder
and Swift volumes when using nspawn for the container tech.

Change-Id: Ief0040f638f0d3570557ac76fd5e0a8aee80df8d
---
 multi-node-aio/playbooks/deploy-vms.yml | 28 ++++++++++++++++++++-----
 1 file changed, 23 insertions(+), 5 deletions(-)

diff --git a/multi-node-aio/playbooks/deploy-vms.yml b/multi-node-aio/playbooks/deploy-vms.yml
index c40c63a7..533ae0c7 100644
--- a/multi-node-aio/playbooks/deploy-vms.yml
+++ b/multi-node-aio/playbooks/deploy-vms.yml
@@ -245,30 +245,48 @@
         state: restarted
 
 
-- name: Setup cinder host volume
+- name: Make space for swift and cinder volumes
   hosts: cinder_hosts:swift_hosts
   gather_facts: false
   environment: "{{ deployment_environment_variables | default({}) }}"
   tags:
     - deploy-vms
   tasks:
-    - name: un-mount deleteme mount
+    - name: Unmount lxc and machines mounts
       mount:
-        name: "/var/lib/lxc"
+        name: "{{ item }}"
         state: unmounted
+      with_items:
+        - "/var/lib/lxc"
+        - "/var/lib/machines"
 
-    - name: remote deleteme mount
+    - name: Remove lxc mount directory
       mount:
         name: "/var/lib/lxc"
         state: absent
 
-    - name: Remove deleteme lv
+    - name: Shrink machines00 mount
+      lvol:
+        vg: vmvg00
+        lv: machines00
+        size: 8192
+        shrink: yes
+        force: yes
+
+    - name: Remove lxc00 volume group
       lvol:
         vg: vmvg00
         lv: lxc00
         force: true
         state: absent
 
+    - name: Re-mount machines00 mount
+      mount:
+        path: /var/lib/machines
+        src: /dev/mapper/vmvg00-machines00
+        state: mounted
+        fstype: btrfs
+
 
 - name: Setup cinder host volume
   hosts: cinder_hosts