Add support for configuring software RAID arrays using mdadm

Change-Id: I647d93bf40d42a1b86b06170c8b4cc96972051c4
Story: 2005017
Task: 29495
This commit is contained in:
Pierre Riteau 2019-03-26 15:16:20 +00:00
parent 81e3c8a282
commit 7f43edf68d
24 changed files with 181 additions and 4 deletions

View File

@ -55,6 +55,12 @@ compute_raid_config_default: []
# stackhpc.drac role.
compute_raid_config_extra: []
###############################################################################
# Compute node software RAID configuration.
# List of software RAID arrays. See mrlesmithjr.mdadm role for format.
compute_mdadm_arrays: []
###############################################################################
# Compute node LVM configuration.

View File

@ -66,6 +66,12 @@ controller_raid_config_default: []
# stackhpc.drac role.
controller_raid_config_extra: []
###############################################################################
# Controller node software RAID configuration.
# List of software RAID arrays. See mrlesmithjr.mdadm role for format.
controller_mdadm_arrays: []
###############################################################################
# Controller node LVM configuration.

View File

@ -55,6 +55,12 @@ monitoring_raid_config_default: "{{ controller_raid_config_default }}"
# by stackhpc.drac role.
monitoring_raid_config_extra: "{{ controller_raid_config_extra }}"
###############################################################################
# Monitoring node software RAID configuration.
# List of software RAID arrays. See mrlesmithjr.mdadm role for format.
monitoring_mdadm_arrays: []
###############################################################################
# Monitoring node LVM configuration.

View File

@ -23,6 +23,12 @@ seed_default_network_interfaces: >
# List of extra networks to which seed nodes are attached.
seed_extra_network_interfaces: []
###############################################################################
# Seed node software RAID configuration.
# List of software RAID arrays. See mrlesmithjr.mdadm role for format.
seed_mdadm_arrays: []
###############################################################################
# Seed node LVM configuration.

View File

@ -20,6 +20,12 @@ seed_hypervisor_default_network_interfaces: "{{ seed_default_network_interfaces
# List of extra networks to which seed hypervisor nodes are attached.
seed_hypervisor_extra_network_interfaces: "{{ seed_extra_network_interfaces }}"
###############################################################################
# Seed hypervisor node software RAID configuration.
# List of software RAID arrays. See mrlesmithjr.mdadm role for format.
seed_hypervisor_mdadm_arrays: []
###############################################################################
# Seed hypervisor node LVM configuration.

View File

@ -54,6 +54,12 @@ storage_raid_config_default: []
# stackhpc.drac role.
storage_raid_config_extra: []
###############################################################################
# Storage node software RAID configuration.
# List of software RAID arrays. See mrlesmithjr.mdadm role for format.
storage_mdadm_arrays: []
###############################################################################
# Storage node LVM configuration.

View File

@ -0,0 +1,6 @@
---
###############################################################################
# Compute node software RAID configuration.
# List of software RAID arrays. See mrlesmithjr.mdadm role for format.
mdadm_arrays: "{{ compute_mdadm_arrays }}"

View File

@ -0,0 +1,6 @@
---
###############################################################################
# Controller node software RAID configuration.
# List of software RAID arrays. See mrlesmithjr.mdadm role for format.
mdadm_arrays: "{{ controller_mdadm_arrays }}"

View File

@ -0,0 +1,9 @@
---
###############################################################################
# Monitoring node software RAID configuration.
# List of software RAID arrays. See mrlesmithjr.mdadm role for format.
mdadm_arrays: >
{{ controller_mdadm_arrays
if inventory_hostname in groups['controllers'] else
monitoring_mdadm_arrays }}

View File

@ -0,0 +1,6 @@
---
###############################################################################
# Seed hypervisor node software RAID configuration.
# List of software RAID arrays. See mrlesmithjr.mdadm role for format.
mdadm_arrays: "{{ seed_hypervisor_mdadm_arrays }}"

View File

@ -0,0 +1,6 @@
---
###############################################################################
# Seed node software RAID configuration.
# List of software RAID arrays. See mrlesmithjr.mdadm role for format.
mdadm_arrays: "{{ seed_mdadm_arrays }}"

View File

@ -0,0 +1,6 @@
---
###############################################################################
# Storage node software RAID configuration.
# List of software RAID arrays. See mrlesmithjr.mdadm role for format.
mdadm_arrays: "{{ storage_mdadm_arrays }}"

11
ansible/mdadm.yml Normal file
View File

@ -0,0 +1,11 @@
---
- name: Ensure software RAID configuration is applied
hosts: seed-hypervisor:seed:overcloud
tags:
- mdadm
roles:
- name: mrlesmithjr.mdadm
become: True
when:
- mdadm_arrays is defined
- mdadm_arrays | length > 0

View File

@ -359,6 +359,43 @@ The NTP service may be disabled as follows:
ntp_service_state: stopped
ntp_service_enabled: false
.. _configuration-hosts-mdadm:
Software RAID
=============
While it is possible to use RAID directly with LVM, some operators may prefer
the userspace tools provided by ``mdadm`` or may have existing software RAID
arrays they want to manage with Kayobe.
Software RAID arrays may be configured via the ``mdadm_arrays`` variable. For
convenience, this is mapped to the following variables:
* ``seed_hypervisor_mdadm_arrays``
* ``seed_mdadm_arrays``
* ``compute_mdadm_arrays``
* ``controller_mdadm_arrays``
* ``monitoring_mdadm_arrays``
* ``storage_mdadm_arrays``
The format of these variables is as defined by the ``mdadm_arrays`` variable of
the `mrlesmithjr.mdadm <https://galaxy.ansible.com/mrlesmithjr/mdadm>`__
Ansible role.
For example, to configure two of the seed's disks as a RAID1 ``mdadm`` array
available as ``/dev/md0``:
.. code-block:: yaml
:caption: ``seed.yml``
seed_mdadm_arrays:
- name: md0
devices:
- /dev/sdb
- /dev/sdc
level: '1'
state: present
.. _configuration-hosts-lvm:
LVM

View File

@ -48,6 +48,12 @@
# stackhpc.drac role.
#compute_raid_config_extra:
###############################################################################
# Compute node software RAID configuration.
# List of software RAID arrays. See mrlesmithjr.mdadm role for format.
#compute_mdadm_arrays:
###############################################################################
# Compute node LVM configuration.

View File

@ -51,6 +51,12 @@
# stackhpc.drac role.
#controller_raid_config_extra:
###############################################################################
# Controller node software RAID configuration.
# List of software RAID arrays. See mrlesmithjr.mdadm role for format.
#controller_mdadm_arrays:
###############################################################################
# Controller node LVM configuration.

View File

@ -48,6 +48,12 @@
# by stackhpc.drac role.
#monitoring_raid_config_extra:
###############################################################################
# Monitoring node software RAID configuration.
# List of software RAID arrays. See mrlesmithjr.mdadm role for format.
#monitoring_mdadm_arrays:
###############################################################################
# Monitoring node LVM configuration.

View File

@ -18,6 +18,12 @@
# List of extra networks to which seed hypervisor nodes are attached.
#seed_hypervisor_extra_network_interfaces:
###############################################################################
# Seed hypervisor node software RAID configuration.
# List of software RAID arrays. See mrlesmithjr.mdadm role for format.
#seed_hypervisor_mdadm_arrays:
###############################################################################
# Seed hypervisor node LVM configuration.

View File

@ -18,6 +18,12 @@
# List of extra networks to which seed nodes are attached.
#seed_extra_network_interfaces:
###############################################################################
# Seed node software RAID configuration.
# List of software RAID arrays. See mrlesmithjr.mdadm role for format.
#seed_mdadm_arrays:
###############################################################################
# LVM configuration.

View File

@ -48,6 +48,12 @@
# stackhpc.drac role.
#storage_raid_config_extra:
###############################################################################
# Storage node software RAID configuration.
# List of software RAID arrays. See mrlesmithjr.mdadm role for format.
#storage_mdadm_arrays:
###############################################################################
# Storage node LVM configuration.

View File

@ -290,6 +290,7 @@ class SeedHypervisorHostConfigure(KollaAnsibleMixin, KayobeAnsibleMixin,
* Configure the host's network interfaces.
* Set sysctl parameters.
* Configure NTP.
* Optionally, configure software RAID arrays.
* Configure LVM volumes.
* Configure the host as a libvirt hypervisor.
"""
@ -326,8 +327,8 @@ class SeedHypervisorHostConfigure(KollaAnsibleMixin, KayobeAnsibleMixin,
if parsed_args.wipe_disks:
playbooks += _build_playbook_list("wipe-disks")
playbooks += _build_playbook_list(
"users", "yum", "dev-tools", "network", "sysctl", "ntp", "lvm",
"seed-hypervisor-libvirt-host")
"users", "yum", "dev-tools", "network", "sysctl", "ntp", "mdadm",
"lvm", "seed-hypervisor-libvirt-host")
self.run_kayobe_playbooks(parsed_args, playbooks,
limit="seed-hypervisor")
@ -421,6 +422,7 @@ class SeedHostConfigure(KollaAnsibleMixin, KayobeAnsibleMixin, VaultMixin,
* Configure IP routing and source NAT.
* Disable bootstrap interface configuration.
* Configure NTP.
* Optionally, configure software RAID arrays.
* Configure LVM volumes.
* Optionally, create a virtualenv for kolla-ansible.
* Configure a user account for kolla-ansible.
@ -469,7 +471,8 @@ class SeedHostConfigure(KollaAnsibleMixin, KayobeAnsibleMixin, VaultMixin,
playbooks += _build_playbook_list("wipe-disks")
playbooks += _build_playbook_list(
"users", "yum", "dev-tools", "disable-selinux", "network",
"sysctl", "ip-routing", "snat", "disable-glean", "ntp", "lvm")
"sysctl", "ip-routing", "snat", "disable-glean", "ntp", "mdadm",
"lvm")
self.run_kayobe_playbooks(parsed_args, playbooks, limit="seed")
playbooks = _build_playbook_list("kolla-ansible")
self.run_kayobe_playbooks(parsed_args, playbooks, tags="config")
@ -823,6 +826,7 @@ class OvercloudHostConfigure(KollaAnsibleMixin, KayobeAnsibleMixin, VaultMixin,
* Set sysctl parameters.
* Disable bootstrap interface configuration.
* Configure NTP.
* Optionally, configure software RAID arrays.
* Configure LVM volumes.
* Optionally, create a virtualenv for kolla-ansible.
* Configure a user account for kolla-ansible.
@ -870,7 +874,8 @@ class OvercloudHostConfigure(KollaAnsibleMixin, KayobeAnsibleMixin, VaultMixin,
playbooks += _build_playbook_list("wipe-disks")
playbooks += _build_playbook_list(
"users", "yum", "dev-tools", "disable-selinux", "network",
"sysctl", "disable-glean", "disable-cloud-init", "ntp", "lvm")
"sysctl", "disable-glean", "disable-cloud-init", "ntp", "mdadm",
"lvm")
self.run_kayobe_playbooks(parsed_args, playbooks, limit="overcloud")
playbooks = _build_playbook_list("kolla-ansible")
self.run_kayobe_playbooks(parsed_args, playbooks, tags="config")

View File

@ -268,6 +268,7 @@ class TestCase(unittest.TestCase):
utils.get_data_files_path("ansible", "network.yml"),
utils.get_data_files_path("ansible", "sysctl.yml"),
utils.get_data_files_path("ansible", "ntp.yml"),
utils.get_data_files_path("ansible", "mdadm.yml"),
utils.get_data_files_path("ansible", "lvm.yml"),
utils.get_data_files_path(
"ansible", "seed-hypervisor-libvirt-host.yml"),
@ -373,6 +374,7 @@ class TestCase(unittest.TestCase):
utils.get_data_files_path("ansible", "snat.yml"),
utils.get_data_files_path("ansible", "disable-glean.yml"),
utils.get_data_files_path("ansible", "ntp.yml"),
utils.get_data_files_path("ansible", "mdadm.yml"),
utils.get_data_files_path("ansible", "lvm.yml"),
],
limit="seed",
@ -982,6 +984,7 @@ class TestCase(unittest.TestCase):
utils.get_data_files_path(
"ansible", "disable-cloud-init.yml"),
utils.get_data_files_path("ansible", "ntp.yml"),
utils.get_data_files_path("ansible", "mdadm.yml"),
utils.get_data_files_path("ansible", "lvm.yml"),
],
limit="overcloud",

View File

@ -0,0 +1,7 @@
---
features:
- |
Adds support for configuring software RAID arrays using ``mdadm``. Software
RAID configuration is applied before LVM configuration, which allows
creating LVM volumes on top of software RAID arrays. See `story 2005017
<https://storyboard.openstack.org/#!/story/2005017>`__ for details.

View File

@ -8,6 +8,9 @@
version: v1.2.0
- src: mrlesmithjr.manage-lvm
version: v0.1.4
- src: mrlesmithjr.mdadm
# There are no versioned releases of this role.
version: 5be3ee7d330aa17317897bd104dc87ff0df11915
- src: resmo.ntp
version: 0.4.0
- src: singleplatform-eng.users