Allow lxc container backing store to be defined as part of the scenario
This will allow aio_lxc_zfs, and a migration path away from openstack-ansible-tests repo for the lxc_hosts and lxc_container_create roles. Depends-On: https://review.opendev.org/c/openstack/openstack-ansible-plugins/+/842999 Change-Id: Ifb62f8b7e6d835d6aab84e85e35f55b89d01d115
This commit is contained in:
parent
cb76d3051b
commit
ff746bfefe
|
@ -168,6 +168,7 @@ bootstrap_host_data_disk2_formats:
|
|||
xfs: xfs
|
||||
dir: ext4
|
||||
lvm: ext2
|
||||
overlayfs: ext4
|
||||
|
||||
bootstrap_host_format_options:
|
||||
btrfs: '--metadata single --data single --mixed'
|
||||
|
@ -178,15 +179,15 @@ bootstrap_host_format_options:
|
|||
# Set the data disk mount options.
|
||||
bootstrap_host_data_mount_options:
|
||||
zfs: "defaults"
|
||||
btrfs: "noatime,nodiratime,compress=lzo,commit=120,space_cache=v2 }}"
|
||||
btrfs: "noatime,nodiratime,compress=lzo,commit=120,space_cache=v2"
|
||||
xfs: "noatime,nodiratime,logbufs=8,logbsize=256k"
|
||||
ext4: "noatime,nobh,barrier=0,data=writeback"
|
||||
dir: "defaults"
|
||||
lvm: "defaults"
|
||||
swap: "%%"
|
||||
|
||||
bootstrap_host_data_disk2_fs: "{{ bootstrap_host_data_disk2_formats[lxc_container_backing_store] }}"
|
||||
bootstrap_host_data_disk2_fs_mount_options: "{{ bootstrap_host_data_mount_options[lxc_container_backing_store] }}"
|
||||
bootstrap_host_data_disk2_fs: "{{ bootstrap_host_data_disk2_formats[_lxc_container_backing_store] }}"
|
||||
bootstrap_host_data_disk2_fs_mount_options: "{{ bootstrap_host_data_mount_options[bootstrap_host_data_disk2_fs] }}"
|
||||
bootstrap_host_data_disk2_path: '/var/lib/lxc'
|
||||
|
||||
### Optional Settings ###
|
||||
|
@ -198,6 +199,3 @@ bootstrap_host_data_disk2_path: '/var/lib/lxc'
|
|||
|
||||
# Set the install method for the deployment. Options are ['source', 'distro']
|
||||
bootstrap_host_install_method: "{{ lookup('env', 'INSTALL_METHOD') | default('source', true) }}"
|
||||
|
||||
# Set the lxc backing store for the job
|
||||
lxc_container_backing_store: dir
|
||||
|
|
|
@ -95,7 +95,7 @@
|
|||
when:
|
||||
- bootstrap_host_loopback_zfs | bool
|
||||
- bootstrap_host_data_disk_device == None
|
||||
- lxc_container_backing_store == 'zfs'
|
||||
- _lxc_container_backing_store == 'zfs'
|
||||
args:
|
||||
apply:
|
||||
tags:
|
||||
|
@ -108,7 +108,7 @@
|
|||
when:
|
||||
- bootstrap_host_loopback_btrfs | bool
|
||||
- bootstrap_host_data_disk_device == None
|
||||
- lxc_container_backing_store == 'btrfs'
|
||||
- _lxc_container_backing_store == 'btrfs'
|
||||
args:
|
||||
apply:
|
||||
tags:
|
||||
|
|
|
@ -77,8 +77,8 @@
|
|||
opts: "{{ bootstrap_host_format_options[bootstrap_host_data_disk2_fs] | default(omit) }}"
|
||||
when:
|
||||
- bootstrap_host_data_disk_device_force | bool
|
||||
- lxc_container_backing_store != 'lvm'
|
||||
- lxc_container_backing_store != 'zfs'
|
||||
- _lxc_container_backing_store != 'lvm'
|
||||
- _lxc_container_backing_store != 'zfs'
|
||||
tags:
|
||||
- format-data-partitions
|
||||
|
||||
|
@ -108,8 +108,8 @@
|
|||
state: 'started'
|
||||
enabled: true
|
||||
when:
|
||||
- lxc_container_backing_store != 'lvm'
|
||||
- lxc_container_backing_store != 'zfs'
|
||||
- _lxc_container_backing_store != 'lvm'
|
||||
- _lxc_container_backing_store != 'zfs'
|
||||
tags:
|
||||
- data-config
|
||||
|
||||
|
@ -119,13 +119,13 @@
|
|||
creates: /pool
|
||||
when:
|
||||
- bootstrap_host_data_disk_device_force | bool
|
||||
- lxc_container_backing_store == 'zfs'
|
||||
- _lxc_container_backing_store == 'zfs'
|
||||
|
||||
- name: Create the ZFS pool/lxc volume
|
||||
shell: "(zfs list | grep lxc) || zfs create -o mountpoint=/var/lib/lxc pool/lxc"
|
||||
when:
|
||||
- bootstrap_host_data_disk_device_force | bool
|
||||
- lxc_container_backing_store == 'zfs'
|
||||
- _lxc_container_backing_store == 'zfs'
|
||||
tags:
|
||||
- skip_ansible_lint
|
||||
|
||||
|
@ -134,7 +134,7 @@
|
|||
args:
|
||||
creates: "/openstack/lxc.pvcreate"
|
||||
when:
|
||||
- lxc_container_backing_store == 'lvm'
|
||||
- _lxc_container_backing_store == 'lvm'
|
||||
tags:
|
||||
- skip_ansible_lint
|
||||
- data-config
|
||||
|
@ -143,7 +143,7 @@
|
|||
command: "pvscan"
|
||||
changed_when: false
|
||||
when:
|
||||
- lxc_container_backing_store == 'lvm'
|
||||
- _lxc_container_backing_store == 'lvm'
|
||||
tags:
|
||||
- cinder-lvm-pv
|
||||
|
||||
|
@ -152,6 +152,6 @@
|
|||
vg: lxc
|
||||
pvs: "/dev/{{ _bootstrap_host_data_disk_device }}2"
|
||||
when:
|
||||
- lxc_container_backing_store == 'lvm'
|
||||
- _lxc_container_backing_store == 'lvm'
|
||||
tags:
|
||||
- data-config
|
||||
|
|
|
@ -229,9 +229,10 @@ lxc_image_cache_server_mirrors:
|
|||
cache_timeout: {{ cache_timeout }}
|
||||
{% endif %}
|
||||
|
||||
# The container backing store is set to 'machinectl' to speed up the
|
||||
# AIO build time. Options are: [machinectl, overlayfs, btrfs, zfs, dir, lvm]
|
||||
lxc_container_backing_store: "{{ lxc_container_backing_store }}"
|
||||
lxc_container_backing_store: {{ _lxc_container_backing_store }}
|
||||
{% if _lxc_container_backing_store == 'zfs' %}
|
||||
lxc_container_zfs_root_name: "osa-test-pool/lxc"
|
||||
{% endif %}
|
||||
|
||||
# bind mount the zuul repos into the containers
|
||||
lxc_container_bind_mounts:
|
||||
|
|
|
@ -15,6 +15,22 @@
|
|||
|
||||
bootstrap_host_scenarios: "{{ (bootstrap_host_scenario.split('_') | reject('equalto', '')) | list }}"
|
||||
|
||||
_lxc_container_backing_store: |-
|
||||
{% if 'zfs' in bootstrap_host_scenarios %}
|
||||
{% set store = 'zfs' %}
|
||||
{% elif 'btrfs' in bootstrap_host_scenarios %}
|
||||
{% set store = 'btrfs' %}
|
||||
{% elif 'dir' in bootstrap_host_scenarios %}
|
||||
{% set store = 'dir' %}
|
||||
{% elif 'lvm' in bootstrap_host_scenarios %}
|
||||
{% set store = 'lvm' %}
|
||||
{% elif 'overlayfs' in bootstrap_host_scenarios %}
|
||||
{% set store = 'overlayfs' %}
|
||||
{% else %}
|
||||
{% set store = 'dir' %}
|
||||
{% endif %}
|
||||
{{ store }}
|
||||
|
||||
# Expand the scenario list to include specific services that are being deployed
|
||||
# as part of the scenario
|
||||
bootstrap_host_scenarios_expanded: |-
|
||||
|
|
Loading…
Reference in New Issue