aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZuul <zuul@review.opendev.org>2023-11-09 16:46:54 +0000
committerGerrit Code Review <review@openstack.org>2023-11-09 16:46:54 +0000
commit9da8fd53f9e5f5687cded1722c215bbb2cad808a (patch)
tree6c25d30eba9d1a792609a2c34863d6ed2413972c
parent7fe6696c203f7f4fd0f3ef5e50ba0d42f53569da (diff)
parent213e53e18a37fae0b5b71ba51ef6121a75dc5786 (diff)
downloadkolla-9da8fd53f9e5f5687cded1722c215bbb2cad808a.tar.gz
kolla-9da8fd53f9e5f5687cded1722c215bbb2cad808a.zip
Merge "CI: Move ephemeral disk config to a role"
-rw-r--r--.zuul.d/base.yaml7
-rw-r--r--.zuul.d/debian.yaml3
-rw-r--r--.zuul.d/rocky.yaml3
-rw-r--r--.zuul.d/ubuntu.yaml3
-rw-r--r--roles/configure-ephemeral/defaults/main.yml2
-rw-r--r--roles/configure-ephemeral/tasks/main.yml70
-rw-r--r--tests/playbooks/pre.yml72
7 files changed, 84 insertions, 76 deletions
diff --git a/.zuul.d/base.yaml b/.zuul.d/base.yaml
index 028d3e20d..c44a74b31 100644
--- a/.zuul.d/base.yaml
+++ b/.zuul.d/base.yaml
@@ -147,6 +147,13 @@
virtualenv_path: "/tmp/kolla-virtualenv"
- job:
+ name: kolla-base-podman
+ parent: kolla-base
+ vars:
+ container_engine: "podman"
+ configure_ephemeral_mountpoint: "/var/lib/containers"
+
+- job:
name: kolla-build-no-infra-wheels-base
parent: kolla-base
vars:
diff --git a/.zuul.d/debian.yaml b/.zuul.d/debian.yaml
index 5cc37d88b..ebf583b8a 100644
--- a/.zuul.d/debian.yaml
+++ b/.zuul.d/debian.yaml
@@ -51,12 +51,11 @@
- job:
name: kolla-build-debian-podman
- parent: kolla-base
+ parent: kolla-base-podman
nodeset: kolla-debian-bookworm
vars:
base_distro: debian
base_distro_version: bookworm
- container_engine: podman
- job:
name: kolla-build-debian-aarch64
diff --git a/.zuul.d/rocky.yaml b/.zuul.d/rocky.yaml
index 66c103778..b50e46c0e 100644
--- a/.zuul.d/rocky.yaml
+++ b/.zuul.d/rocky.yaml
@@ -58,12 +58,11 @@
- job:
name: kolla-build-rocky9-podman
- parent: kolla-base
+ parent: kolla-base-podman
nodeset: kolla-rockylinux-9
vars:
base_distro: rocky
base_distro_version: 9
- container_engine: podman
- job:
name: kolla-build-rocky9-aarch64
diff --git a/.zuul.d/ubuntu.yaml b/.zuul.d/ubuntu.yaml
index 9335a8e8c..b644c131a 100644
--- a/.zuul.d/ubuntu.yaml
+++ b/.zuul.d/ubuntu.yaml
@@ -58,12 +58,11 @@
- job:
name: kolla-build-ubuntu-podman
- parent: kolla-base
+ parent: kolla-base-podman
nodeset: kolla-ubuntu-jammy
vars:
base_distro: ubuntu
base_distro_version: jammy
- container_engine: podman
- job:
name: kolla-build-ubuntu-aarch64
diff --git a/roles/configure-ephemeral/defaults/main.yml b/roles/configure-ephemeral/defaults/main.yml
new file mode 100644
index 000000000..5879e49e1
--- /dev/null
+++ b/roles/configure-ephemeral/defaults/main.yml
@@ -0,0 +1,2 @@
+---
+configure_ephemeral_mountpoint: "/var/lib/docker"
diff --git a/roles/configure-ephemeral/tasks/main.yml b/roles/configure-ephemeral/tasks/main.yml
new file mode 100644
index 000000000..8fe7d6f63
--- /dev/null
+++ b/roles/configure-ephemeral/tasks/main.yml
@@ -0,0 +1,70 @@
+---
+# 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 disk
+ community.general.filesystem:
+ fstype: ext4
+ dev: "{{ ephemeral_device }}"
+ opts: "-L kolla"
+
+ - name: "Ensure {{ configure_ephemeral_mountpoint }} mountpoint is created"
+ ansible.builtin.file:
+ path: "{{ configure_ephemeral_mountpoint }}"
+ owner: root
+ group: root
+ state: directory
+ mode: 0755
+
+ - name: Mount additional filesystem
+ ansible.posix.mount:
+ path: "{{ configure_ephemeral_mountpoint }}"
+ src: "LABEL=kolla"
+ fstype: ext4
+ state: mounted
diff --git a/tests/playbooks/pre.yml b/tests/playbooks/pre.yml
index 7fbe412e3..01ded11b0 100644
--- a/tests/playbooks/pre.yml
+++ b/tests/playbooks/pre.yml
@@ -2,6 +2,8 @@
- hosts: all
vars_files:
- ../vars/zuul.yml
+ roles:
+ - configure-ephemeral
tasks:
- name: Create dir for kolla logs
file:
@@ -18,76 +20,6 @@
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: