From 5cfaf5566d4d00c9ccbe14ffeaa461a246295f47 Mon Sep 17 00:00:00 2001 From: Dmitry Tantsur Date: Thu, 21 Jun 2018 13:38:13 +0200 Subject: [PATCH] CI: try SSH into the deployed instances Raise the VM specs and fix the partition image building. Change-Id: I9e687d50b369402d36376e08496281d77afce215 --- .zuul.yaml | 3 ++- playbooks/integration/centos-image.yaml | 31 +++++++++++++++++++++++++ playbooks/integration/exercise.yaml | 14 +++++++++++ 3 files changed, 47 insertions(+), 1 deletion(-) diff --git a/.zuul.yaml b/.zuul.yaml index 66bc5a3..fc168d5 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -90,8 +90,9 @@ IRONIC_RAMDISK_TYPE: tinyipa IRONIC_VM_COUNT: 1 IRONIC_VM_LOG_DIR: /opt/stack/logs/ironic-bm-logs + IRONIC_VM_SPECS_CPU: 2 IRONIC_VM_SPECS_DISK: 10 - IRONIC_VM_SPECS_RAM: 512 + IRONIC_VM_SPECS_RAM: 1024 - job: name: metalsmith-integration-glance diff --git a/playbooks/integration/centos-image.yaml b/playbooks/integration/centos-image.yaml index eff7456..9820987 100644 --- a/playbooks/integration/centos-image.yaml +++ b/playbooks/integration/centos-image.yaml @@ -64,6 +64,37 @@ environment: LIBGUESTFS_DEBUG: 1 +- name: Extract /etc/fstab and /etc/selinux/config + command: > + tar -f {{ temp_dir.path }}/root.tar + -C {{ temp_dir.path }} --extract {{ item }} + with_items: + - ./etc/fstab + - ./etc/selinux/config + +- name: Remove /etc/fstab and /etc/selinux/config from the archive + command: tar -f {{ temp_dir.path }}/root.tar --delete {{ item }} + with_items: + - ./etc/fstab + - ./etc/selinux/config + +- name: Edit /etc/fstab to replace UUID with LABEL + command: sed -i 's/UUID=[^ ]* /\/dev\/vda2 /' {{ temp_dir.path}}/etc/fstab + +- name: Rewrite /etc/selinux/config to disable selinux + copy: + dest: "{{ temp_dir.path }}/etc/selinux/config" + content: "SELINUX=disabled" + +- name: Add edited /etc/fstab and /etc/selinux/config back + command: > + tar -f {{ temp_dir.path }}/root.tar + -C {{ temp_dir.path }} + --append {{ item }} --owner root --group root + with_items: + - ./etc/fstab + - ./etc/selinux/config + - name: Pack the root file system into a partition image command: virt-make-fs {{ temp_dir.path }}/root.tar {{ centos_partition_file }} environment: diff --git a/playbooks/integration/exercise.yaml b/playbooks/integration/exercise.yaml index abfbd79..3cc1f2c 100644 --- a/playbooks/integration/exercise.yaml +++ b/playbooks/integration/exercise.yaml @@ -42,6 +42,20 @@ - name: Show active node information command: openstack baremetal node show {{ instance.node.uuid }} +- name: Get IP address + set_fact: + instance_ip: "{{ instance.ip_addresses.values() | list | first | first }}" + failed_when: not instance_ip + +- name: SSH into the instance + command: > + ssh -v -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o ConnectTimeout=10 + metalsmith@{{ instance_ip }} "cat /etc/hostname" + register: ssh_result + until: ssh_result | succeeded + retries: 30 + delay: 20 + - name: Undeploy a node command: metalsmith --debug undeploy --wait 900 test