From 91d4cfa839bb2633cba2f70443168c22f895a969 Mon Sep 17 00:00:00 2001 From: Stepan Andrushko Date: Mon, 11 Feb 2019 21:10:54 +0200 Subject: Move VM image build to remote DUT VM image is built on localhost but should be on remote DUT server. VM image will be built on server added to group 'yardstick-standalone'. NSB dependencies will be installed on servers added to groups 'yardstick-baremetal' and 'yardstick-standalone'. Added extra package installation, copy VM image to libvirt folder. JIRA: YARDSTICK-1597 Change-Id: Iac4444c6f332c5ea80da033f2fe8371e208d7fbc Signed-off-by: Stepan Andrushko --- .../build_yardstick_image/tasks/post_build.yml | 21 +++++++++++++++++++++ .../roles/build_yardstick_image/tasks/pre_build.yml | 12 ++++++++++++ 2 files changed, 33 insertions(+) (limited to 'ansible/roles/build_yardstick_image/tasks') diff --git a/ansible/roles/build_yardstick_image/tasks/post_build.yml b/ansible/roles/build_yardstick_image/tasks/post_build.yml index c6888f8df..abbf57c03 100644 --- a/ansible/roles/build_yardstick_image/tasks/post_build.yml +++ b/ansible/roles/build_yardstick_image/tasks/post_build.yml @@ -34,6 +34,10 @@ name: "{{ mountdir }}/proc" state: unmounted +- mount: + name: "{{ mountdir }}/run" + state: unmounted + - mount: name: "{{ mountdir }}" state: unmounted @@ -44,3 +48,20 @@ - debug: msg: "yardstick image = {{ imgfile }}" + +- set_fact: + imgdest: "/var/lib/libvirt/images/{{ imgfile | basename}}" + name: "{{ (imgfile | basename | splitext)[0] }}" + ext: "{{ (imgfile | basename | splitext)[1] }}" + +- name: Verify if imgfile exists in libvirt images + stat: + path: "{{ imgdest }}" + register: imgdest_stat + +- set_fact: + imgdest: "/var/lib/libvirt/images/{{ name }}_autogen{{ ext }}" + when: imgdest_stat.stat.exists + +- name: Copy image to libvirt images + shell: "cp {{ imgfile }} {{ imgdest }}" diff --git a/ansible/roles/build_yardstick_image/tasks/pre_build.yml b/ansible/roles/build_yardstick_image/tasks/pre_build.yml index 2dae38060..3ac8e90e9 100644 --- a/ansible/roles/build_yardstick_image/tasks/pre_build.yml +++ b/ansible/roles/build_yardstick_image/tasks/pre_build.yml @@ -45,6 +45,7 @@ with_items: # order matters - "{{ mountdir }}/proc" + - "{{ mountdir }}/run" - "{{ mountdir }}" - "/mnt/{{ release }}" @@ -178,6 +179,17 @@ fstab: "{{ fake_fstab }}" state: mounted +- name: mount chroot /run + mount: + src: /run + name: "{{ mountdir }}/run" + fstype: tmpfs + opts: bind + # !!!!!!! this is required otherwise we add entries to /etc/fstab + # and prevent the system from booting + fstab: "{{ fake_fstab }}" + state: mounted + - name: if arm copy qemu-aarch64-static into chroot copy: src: /usr/bin/qemu-aarch64-static -- cgit 1.2.3-korg