Skip to content

Commit 1c4c557

Browse files
committed
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. Change-Id: I179c41032239f5f0ce6055c79295b32c33fe67a5 (cherry picked from commit a0d7580)
1 parent e28695f commit 1c4c557

File tree

2 files changed

+80
-1
lines changed

2 files changed

+80
-1
lines changed

tests/playbooks/pre.yml

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,3 +119,81 @@
119119
path: /run/docker.sock
120120
mode: 0666
121121
become: true
122+
123+
# On RAX hosts, we have a small root partition and a large,
124+
# unallocated ephemeral device attached at /dev/xvde
125+
- name: Set ephemeral device if /dev/xvde exists
126+
when: ansible_devices["xvde"] is defined
127+
set_fact:
128+
ephemeral_device: "/dev/xvde"
129+
130+
# On other providers, we have a device called "ephemeral0".
131+
- name: Set ephemeral device by label
132+
when: ephemeral_device is undefined
133+
block:
134+
- name: Get ephemeral0 device node
135+
command: /sbin/blkid -L ephemeral0
136+
register: ephemeral0
137+
# rc !=0 is expected
138+
failed_when: False
139+
changed_when: False
140+
141+
- name: Set ephemeral device if LABEL exists
142+
when: "ephemeral0.rc == 0"
143+
set_fact:
144+
ephemeral_device: "{{ ephemeral0.stdout }}"
145+
146+
- name: Configure additional disk (if available)
147+
become: true
148+
when: ephemeral_device is defined
149+
block:
150+
- name: Ensure ephemeral device is unmounted
151+
ansible.posix.mount:
152+
name: "{{ ephemeral_device }}"
153+
state: "{{ item }}"
154+
loop:
155+
- unmounted
156+
- absent
157+
158+
- name: Get existing partitions
159+
community.general.parted:
160+
device: "{{ ephemeral_device }}"
161+
unit: MiB
162+
state: info
163+
register: ephemeral_partitions
164+
165+
- name: Remove any existing partitions
166+
community.general.parted:
167+
device: "{{ ephemeral_device }}"
168+
number: "{{ item.num }}"
169+
state: absent
170+
loop: "{{ ephemeral_partitions.partitions }}"
171+
172+
- name: Create filesystem on additional partition
173+
community.general.filesystem:
174+
fstype: ext4
175+
dev: "{{ ephemeral_device }}"
176+
opts: "-L kolla"
177+
178+
- name: Ensure /mnt/kolla mountpoint is created
179+
ansible.builtin.file:
180+
path: "/mnt/kolla"
181+
owner: root
182+
group: root
183+
state: directory
184+
mode: 0755
185+
186+
- name: Mount additional filesystem
187+
ansible.posix.mount:
188+
path: "/mnt/kolla"
189+
src: "LABEL=kolla"
190+
fstype: ext4
191+
state: present
192+
193+
- name: Ensure /mnt/kolla/work_dir directory is created
194+
ansible.builtin.file:
195+
path: "/mnt/kolla/work_dir"
196+
owner: root
197+
group: root
198+
state: directory
199+
mode: 0777

tests/playbooks/run.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
- ../vars/zuul.yml
55
vars:
66
tag_suffix: "{{ '-aarch64' if ansible_architecture == 'aarch64' else '' }}"
7+
kolla_disk: "{{ true if ephemeral_device is defined else false }}"
78
kolla_build_config:
89
DEFAULT:
910
debug: true
@@ -46,4 +47,4 @@
4647
command: "{{ virtualenv_path }}/bin/kolla-build --template-only --work-dir {{ kolla_build_logs_dir }}/work_dir"
4748

4849
- name: Run kolla-build
49-
command: "{{ virtualenv_path }}/bin/kolla-build"
50+
command: "{{ virtualenv_path }}/bin/kolla-build {% if kolla_disk %}--work-dir /mnt/kolla/work_dir{% endif %}"

0 commit comments

Comments
 (0)