Merge "Add option to change fs type on bootstrap device"

This commit is contained in:
Zuul 2018-07-03 12:04:05 +00:00 committed by Gerrit Code Review
commit bb749eac3d
3 changed files with 16 additions and 6 deletions

View File

@ -132,6 +132,13 @@ on the device, then execute:
# export BOOTSTRAP_OPTS="bootstrap_host_data_disk_device=sdb" # export BOOTSTRAP_OPTS="bootstrap_host_data_disk_device=sdb"
By default the filesystem type will be set to ext4, if you want another type
of filesystem to be used, just use something similar to the following:
.. code-block:: shell-session
# export BOOTSTRAP_OPTS="bootstrap_host_data_disk_device=sdb bootstrap_host_data_disk_fs_type=xfs"
Additional options may be implemented by simply concatenating them with Additional options may be implemented by simply concatenating them with
a space between each set of options, for example: a space between each set of options, for example:

View File

@ -223,6 +223,9 @@ bridge_iptables_rules: |
# set the full path to the device. IE: "/dev/xvde" should be "xvde". # set the full path to the device. IE: "/dev/xvde" should be "xvde".
bootstrap_host_data_disk_device: null bootstrap_host_data_disk_device: null
# #
# Specify the default filesystem type
bootstrap_host_data_disk_fs_type: ext4
#
# Boolean value to force the repartitioning of the secondary device. # Boolean value to force the repartitioning of the secondary device.
bootstrap_host_data_disk_device_force: no bootstrap_host_data_disk_device_force: no
# #

View File

@ -20,7 +20,7 @@
# in case these tasks are executed multiple times. # in case these tasks are executed multiple times.
- name: Determine whether partitions labeled openstack-data{1,2} are present - name: Determine whether partitions labeled openstack-data{1,2} are present
shell: | shell: |
parted --script -l -m | egrep -q ':ext4:openstack-data[12]:;$' parted --script -l -m | egrep -q ':{{ bootstrap_host_data_disk_fs_type }}:openstack-data[12]:;$'
register: data_disk_partitions register: data_disk_partitions
changed_when: false changed_when: false
failed_when: false failed_when: false
@ -38,7 +38,7 @@
mount: mount:
name: "{{ item.mount }}" name: "{{ item.mount }}"
src: "{{ item.device }}" src: "{{ item.device }}"
fstype: ext4 fstype: "{{ bootstrap_host_data_disk_fs_type }}"
state: absent state: absent
when: when:
- bootstrap_host_data_disk_device_force | bool - bootstrap_host_data_disk_device_force | bool
@ -52,14 +52,14 @@
- bootstrap_host_data_disk_device_force | bool - bootstrap_host_data_disk_device_force | bool
with_items: with_items:
- "parted --script /dev/{{ _bootstrap_host_data_disk_device }} mklabel gpt" - "parted --script /dev/{{ _bootstrap_host_data_disk_device }} mklabel gpt"
- "parted --align optimal --script /dev/{{ _bootstrap_host_data_disk_device }} mkpart openstack-data1 ext4 0% 40%" - "parted --align optimal --script /dev/{{ _bootstrap_host_data_disk_device }} mkpart openstack-data1 {{ bootstrap_host_data_disk_fs_type }} 0% 40%"
- "parted --align optimal --script /dev/{{ _bootstrap_host_data_disk_device }} mkpart openstack-data2 {{ bootstrap_host_data_disk2_fs }} 40% 100%" - "parted --align optimal --script /dev/{{ _bootstrap_host_data_disk_device }} mkpart openstack-data2 {{ bootstrap_host_data_disk2_fs }} 40% 100%"
tags: tags:
- create-data-disk-partitions - create-data-disk-partitions
- name: Format the partition 1 - name: Format the partition 1
filesystem: filesystem:
fstype: ext4 fstype: "{{ bootstrap_host_data_disk_fs_type }}"
dev: "/dev/{{ _bootstrap_host_data_disk_device }}1" dev: "/dev/{{ _bootstrap_host_data_disk_device }}1"
opts: "{{ bootstrap_host_format_options['ext4'] | default(omit) }}" opts: "{{ bootstrap_host_format_options['ext4'] | default(omit) }}"
when: when:
@ -87,8 +87,8 @@
systemd_mounts: systemd_mounts:
- what: "/dev/{{ _bootstrap_host_data_disk_device }}1" - what: "/dev/{{ _bootstrap_host_data_disk_device }}1"
where: "/openstack" where: "/openstack"
type: "ext4" type: "{{ bootstrap_host_data_disk_fs_type }}"
options: "{{ bootstrap_host_data_mount_options['ext4'] }}" options: "{{ bootstrap_host_data_mount_options[bootstrap_host_data_disk_fs_type] }}"
state: 'started' state: 'started'
enabled: true enabled: true
tags: tags: