From e29437d21024d312222362cdb283ac60c8a9fc1d Mon Sep 17 00:00:00 2001 From: Michal Nasiadka Date: Mon, 20 Feb 2023 08:43:41 +0100 Subject: [PATCH] CI: Configure additional disk when available It seems that on some nodepool providers (rax for sure), we get 40G boot disk and 80G additional disk, while on others we get 80G boot disk only. Included fix from I06e262cd48d33ccfc0634589c82dcac80dff51af Change-Id: I179c41032239f5f0ce6055c79295b32c33fe67a5 (cherry picked from commit a0d758019a753596567128a44032165dc8214f05) --- tests/playbooks/pre.yml | 70 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) diff --git a/tests/playbooks/pre.yml b/tests/playbooks/pre.yml index 2936ca089c..5a173f0415 100644 --- a/tests/playbooks/pre.yml +++ b/tests/playbooks/pre.yml @@ -20,6 +20,76 @@ path: "{{ kolla_build_logs_dir }}" state: directory + # On RAX hosts, we have a small root partition and a large, + # unallocated ephemeral device attached at /dev/xvde + - name: Set ephemeral device if /dev/xvde exists + when: ansible_devices["xvde"] is defined + set_fact: + ephemeral_device: "/dev/xvde" + + # On other providers, we have a device called "ephemeral0". + - name: Set ephemeral device by label + when: ephemeral_device is undefined + block: + - name: Get ephemeral0 device node + command: /sbin/blkid -L ephemeral0 + register: ephemeral0 + # rc !=0 is expected + failed_when: False + changed_when: False + + - name: Set ephemeral device if LABEL exists + when: "ephemeral0.rc == 0" + set_fact: + ephemeral_device: "{{ ephemeral0.stdout }}" + + - name: Configure additional disk (if available) + become: true + when: ephemeral_device is defined + block: + - name: Ensure ephemeral device is unmounted + ansible.posix.mount: + name: "{{ ephemeral_device }}" + state: "{{ item }}" + loop: + - unmounted + - absent + + - name: Get existing partitions + community.general.parted: + device: "{{ ephemeral_device }}" + unit: MiB + state: info + register: ephemeral_partitions + + - name: Remove any existing partitions + community.general.parted: + device: "{{ ephemeral_device }}" + number: "{{ item.num }}" + state: absent + loop: "{{ ephemeral_partitions.partitions }}" + + - name: Create filesystem on additional partition + community.general.filesystem: + fstype: ext4 + dev: "{{ ephemeral_device }}" + opts: "-L kolla" + + - name: Ensure /var/lib/docker mountpoint is created + ansible.builtin.file: + path: "/var/lib/docker" + owner: root + group: root + state: directory + mode: 0755 + + - name: Mount additional filesystem + ansible.posix.mount: + path: "/var/lib/docker" + src: "LABEL=kolla" + fstype: ext4 + state: mounted + - name: Install Python3 pip and setuptools package: name: