From d8035cd012c941c615862e75ed54ad5fc3620846 Mon Sep 17 00:00:00 2001
From: Fatih Degirmenci <fdegir@gmail.com>
Date: Wed, 8 Aug 2018 11:23:10 +0200
Subject: Resize OPNFV VM Disk

OPNFV VM creation is separated from the rest of the nodes, resulting
in its disk being left without resizing. It is important to resize
its disk to the value defined in its PDF opnfv_vm.yml so the installation
of the other tools does not fail due to lack of space.

Change-Id: I8300e6e355d11788cc983fcebca56076e89918e1
Signed-off-by: Fatih Degirmenci <fdegir@gmail.com>
---
 xci/playbooks/roles/create-vm-nodes/tasks/create_vm.yml | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/xci/playbooks/roles/create-vm-nodes/tasks/create_vm.yml b/xci/playbooks/roles/create-vm-nodes/tasks/create_vm.yml
index d8169c2f..ab427c69 100644
--- a/xci/playbooks/roles/create-vm-nodes/tasks/create_vm.yml
+++ b/xci/playbooks/roles/create-vm-nodes/tasks/create_vm.yml
@@ -40,6 +40,12 @@
         path: "{{ opnfv_image_path }}/{{ vm_name }}.qcow2"
       register: _vm_volume_prepared
 
+    - name: Resize opnfv VM image to {{ item.disks[0].disk_capacity }}
+      command: "qemu-img resize {{ opnfv_image_path }}/opnfv.qcow2 {{ item.disks[0].disk_capacity }}"
+      when:
+        - vm_name == 'opnfv'
+        - _vm_volume_prepared.stat.exists
+
     # NOTE(pas-ha) Ansible still lacks modules to operate on libvirt volumes
     # mbuil: Assuming there is only one disk [0]
     - name: create volume for vm
-- 
cgit