Merge "Support configuring LVM on the seed hypervisor"

This commit is contained in:
Zuul 2019-01-30 20:17:24 +00:00 committed by Gerrit Code Review
commit 72b388009d
8 changed files with 109 additions and 4 deletions

View File

@ -20,6 +20,49 @@ 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 LVM configuration.
# List of seed hypervisor volume groups. See mrlesmithjr.manage-lvm role for
# format. Set to "{{ seed_hypervisor_lvm_groups_with_data }}" to create a
# volume group for libvirt storage.
seed_hypervisor_lvm_groups: []
# Suggested list of seed hypervisor volume groups for libvirt. Not used by default.
seed_hypervisor_lvm_groups_with_data:
- "{{ seed_hypervisor_lvm_group_data }}"
# Seed LVM volume group for data. See mrlesmithjr.manage-lvm role for format.
seed_hypervisor_lvm_group_data:
vgname: data
disks: "{{ seed_hypervisor_lvm_group_data_disks }}"
create: True
lvnames: "{{ seed_hypervisor_lvm_group_data_lvs }}"
# List of disks for use by seed hypervisor LVM data volume group. Default to an
# invalid value to require configuration.
seed_hypervisor_lvm_group_data_disks:
- changeme
# List of LVM logical volumes for the data volume group.
seed_hypervisor_lvm_group_data_lvs:
- "{{ seed_hypervisor_lvm_group_data_lv_libvirt_storage }}"
# Libvirt storage LVM backing volume.
seed_hypervisor_lvm_group_data_lv_libvirt_storage:
lvname: libvirt-storage
size: "{{ seed_hypervisor_lvm_group_data_lv_libvirt_storage_size }}"
create: True
filesystem: "{{ seed_hypervisor_lvm_group_data_lv_libvirt_storage_fs }}"
mount: True
mntp: "{{ seed_hypervisor_libvirt_pool_path }}"
# Size of libvirt storage LVM backing volume.
seed_hypervisor_lvm_group_data_lv_libvirt_storage_size: 100%VG
# Filesystem for libvirt storage LVM backing volume. ext4 allows for shrinking.
seed_hypervisor_lvm_group_data_lv_libvirt_storage_fs: ext4
###############################################################################
# Seed hypervisor libvirt storage pool configuration.

View File

@ -0,0 +1,6 @@
---
###############################################################################
# Seed hypervisor node LVM configuration.
# List of LVM volume groups.
lvm_groups: "{{ seed_hypervisor_lvm_groups }}"

View File

@ -1,6 +1,6 @@
---
- name: Ensure LVM configuration is applied
hosts: seed:overcloud
hosts: seed-hypervisor:seed:overcloud
tags:
- lvm
- upgrade-check

View File

@ -7,7 +7,7 @@
# any LVM or file system state from them.
- name: Ensure that all unmounted block devices are wiped
hosts: seed:overcloud
hosts: seed-hypervisor:seed:overcloud
tags:
- wipe-disks
roles:

View File

@ -18,6 +18,36 @@
# List of extra networks to which seed hypervisor nodes are attached.
#seed_hypervisor_extra_network_interfaces:
###############################################################################
# Seed hypervisor node LVM configuration.
# List of seed hypervisor volume groups. See mrlesmithjr.manage-lvm role for
# format. Set to "{{ seed_hypervisor_lvm_groups_with_data }}" to create a
# volume group for libvirt storage.
#seed_hypervisor_lvm_groups:
# Suggested list of seed hypervisor volume groups for libvirt. Not used by default.
#seed_hypervisor_lvm_groups_with_data:
# Seed LVM volume group for data. See mrlesmithjr.manage-lvm role for format.
#seed_hypervisor_lvm_group_data:
# List of disks for use by seed hypervisor LVM data volume group. Default to an
# invalid value to require configuration.
#seed_hypervisor_lvm_group_data_disks:
# List of LVM logical volumes for the data volume group.
#seed_hypervisor_lvm_group_data_lvs:
# Libvirt storage LVM backing volume.
#seed_hypervisor_lvm_group_data_lv_libvirt_storage:
# Size of libvirt storage LVM backing volume.
#seed_hypervisor_lvm_group_data_lv_libvirt_storage_size:
# Filesystem for libvirt storage LVM backing volume. ext4 allows for shrinking.
#seed_hypervisor_lvm_group_data_lv_libvirt_storage_fs:
###############################################################################
# Seed hypervisor libvirt storage pool configuration.

View File

@ -270,15 +270,26 @@ class SeedHypervisorHostConfigure(KollaAnsibleMixin, KayobeAnsibleMixin,
* Add the host to SSH known hosts.
* Configure a user account for use by kayobe for SSH access.
* Optionally, create a virtualenv for remote target hosts.
* Optionally, wipe unmounted disk partitions (--wipe-disks).
* Configure user accounts, group associations, and authorised SSH keys.
* Configure a PyPI mirror.
* Configure Yum repos.
* Configure the host's network interfaces.
* Set sysctl parameters.
* Configure NTP.
* Configure LVM volumes.
* Configure the host as a libvirt hypervisor.
"""
def get_parser(self, prog_name):
parser = super(SeedHypervisorHostConfigure, self).get_parser(prog_name)
group = parser.add_argument_group("Host Configuration")
group.add_argument("--wipe-disks", action='store_true',
help="wipe partition and LVM data from all disks "
"that are not mounted. Warning: this can "
"result in the loss of data")
return parser
def take_action(self, parsed_args):
self.app.LOG.debug("Configuring seed hypervisor host OS")
# Explicitly request the dump-config tag to ensure this play runs even
@ -292,8 +303,12 @@ class SeedHypervisorHostConfigure(KollaAnsibleMixin, KayobeAnsibleMixin,
sys.exit(1)
playbooks = _build_playbook_list(
"ip-allocation", "ssh-known-host", "kayobe-ansible-user",
"pip", "kayobe-target-venv", "users", "yum", "dev-tools",
"network", "sysctl", "ntp", "seed-hypervisor-libvirt-host")
"pip", "kayobe-target-venv")
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")
self.run_kayobe_playbooks(parsed_args, playbooks,
limit="seed-hypervisor")

View File

@ -254,6 +254,7 @@ class TestCase(unittest.TestCase):
"ansible/network.yml",
"ansible/sysctl.yml",
"ansible/ntp.yml",
"ansible/lvm.yml",
"ansible/seed-hypervisor-libvirt-host.yml",
],
limit="seed-hypervisor",

View File

@ -0,0 +1,10 @@
---
features:
- |
Adds support for configuring LVM volume groups on the seed hypervisor.
Setting the ``seed_hypervisor_lvm_groups`` variable in
``$KAYOBE_CONFIG_PATH/seed-hypervisor.yml`` to
``"{{ seed_hypervisor_lvm_groups_with_data }}"`` and providing a list of
storage devices via the ``seed_hypervisor_lvm_group_data_disks`` variable
will configure a logical volume mounted to ``/var/lib/libvirt/images``. No
LVM volume groups are configured by default.