Skip to content

Commit e6b4a65

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. Included fix from I06e262cd48d33ccfc0634589c82dcac80dff51af Change-Id: I179c41032239f5f0ce6055c79295b32c33fe67a5 (cherry picked from commit a0d7580)
1 parent 1691f36 commit e6b4a65

File tree

1 file changed

+70
-0
lines changed

1 file changed

+70
-0
lines changed

tests/playbooks/pre.yml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,76 @@
2020
path: "{{ kolla_build_logs_dir }}"
2121
state: directory
2222

23+
# On RAX hosts, we have a small root partition and a large,
24+
# unallocated ephemeral device attached at /dev/xvde
25+
- name: Set ephemeral device if /dev/xvde exists
26+
when: ansible_devices["xvde"] is defined
27+
set_fact:
28+
ephemeral_device: "/dev/xvde"
29+
30+
# On other providers, we have a device called "ephemeral0".
31+
- name: Set ephemeral device by label
32+
when: ephemeral_device is undefined
33+
block:
34+
- name: Get ephemeral0 device node
35+
command: /sbin/blkid -L ephemeral0
36+
register: ephemeral0
37+
# rc !=0 is expected
38+
failed_when: False
39+
changed_when: False
40+
41+
- name: Set ephemeral device if LABEL exists
42+
when: "ephemeral0.rc == 0"
43+
set_fact:
44+
ephemeral_device: "{{ ephemeral0.stdout }}"
45+
46+
- name: Configure additional disk (if available)
47+
become: true
48+
when: ephemeral_device is defined
49+
block:
50+
- name: Ensure ephemeral device is unmounted
51+
ansible.posix.mount:
52+
name: "{{ ephemeral_device }}"
53+
state: "{{ item }}"
54+
loop:
55+
- unmounted
56+
- absent
57+
58+
- name: Get existing partitions
59+
community.general.parted:
60+
device: "{{ ephemeral_device }}"
61+
unit: MiB
62+
state: info
63+
register: ephemeral_partitions
64+
65+
- name: Remove any existing partitions
66+
community.general.parted:
67+
device: "{{ ephemeral_device }}"
68+
number: "{{ item.num }}"
69+
state: absent
70+
loop: "{{ ephemeral_partitions.partitions }}"
71+
72+
- name: Create filesystem on additional partition
73+
community.general.filesystem:
74+
fstype: ext4
75+
dev: "{{ ephemeral_device }}"
76+
opts: "-L kolla"
77+
78+
- name: Ensure /var/lib/docker mountpoint is created
79+
ansible.builtin.file:
80+
path: "/var/lib/docker"
81+
owner: root
82+
group: root
83+
state: directory
84+
mode: 0755
85+
86+
- name: Mount additional filesystem
87+
ansible.posix.mount:
88+
path: "/var/lib/docker"
89+
src: "LABEL=kolla"
90+
fstype: ext4
91+
state: mounted
92+
2393
- name: Install Python3 setuptools and family
2494
package:
2595
name:

0 commit comments

Comments
 (0)