Enable 'data' LVM group only for Docker devicemapper

This change is a precursor to switching the default Docker storage
driver to overlay2.

Previously, Kayobe's default configuration included a 'data' LVM volume
group, with a 'docker-volumes' logical volume mounted at
/var/lib/docker/volumes. Additionally, if the Docker devicemapper
storage driver was used, the data volume group would contain the
docker-thinpool and docker-thinpoolmeta volumes.

This LVM setup was really included for devicemapper, and while in some
cases it may be useful to have docker volumes as a separate logical
volume, this doesn't really make sense as a default. Often in
environments using other Docker storage drivers, the data volume group
would be removed from configuration.

This change modifies the default LVM configuration to only create a
'data' volume group if the Docker storage driver is devicemapper.
Additionally, new flags are added to make this choice independent from
the storage driver, to support cases where the data volume group is
required without devicemapper.

Change-Id: Ia3c1f6423c32fa2580b57db32512a34ce35d7acc
Story: 2005667
Task: 30973
This commit is contained in:
Mark Goddard 2019-05-13 14:02:52 +01:00
parent 7932314e54
commit 1d8b4e2500
7 changed files with 72 additions and 13 deletions

View File

@ -70,13 +70,19 @@ compute_lvm_groups: "{{ compute_lvm_groups_default + compute_lvm_groups_extra }}
# Default list of compute volume groups. See mrlesmithjr.manage-lvm role for
# format.
compute_lvm_groups_default:
- "{{ compute_lvm_group_data }}"
compute_lvm_groups_default: "{{ [compute_lvm_group_data] if compute_lvm_group_data_enabled | bool else [] }}"
# Additional list of compute volume groups. See mrlesmithjr.manage-lvm role
# for format.
compute_lvm_groups_extra: []
# Whether a 'data' LVM volume group should exist on compute hosts. By default
# this contains a 'docker-volumes' logical volume for Docker volume storage. It
# will also be used for Docker container and image storage if
# 'docker_storage_driver' is set to 'devicemapper'. Default is true if
# 'docker_storage_driver' is set to 'devicemapper', or false otherwise.
compute_lvm_group_data_enabled: "{{ docker_storage_driver == 'devicemapper' }}"
# Compute LVM volume group for data. See mrlesmithjr.manage-lvm role for
# format.
compute_lvm_group_data:

View File

@ -81,13 +81,19 @@ controller_lvm_groups: "{{ controller_lvm_groups_default + controller_lvm_groups
# Default list of controller volume groups. See mrlesmithjr.manage-lvm role for
# format.
controller_lvm_groups_default:
- "{{ controller_lvm_group_data }}"
controller_lvm_groups_default: "{{ [controller_lvm_group_data] if controller_lvm_group_data_enabled | bool else [] }}"
# Additional list of controller volume groups. See mrlesmithjr.manage-lvm role
# for format.
controller_lvm_groups_extra: []
# Whether a 'data' LVM volume group should exist on controller hosts. By
# default this contains a 'docker-volumes' logical volume for Docker volume
# storage. It will also be used for Docker container and image storage if
# 'docker_storage_driver' is set to 'devicemapper'. Default is true if
# 'docker_storage_driver' is set to 'devicemapper', or false otherwise.
controller_lvm_group_data_enabled: "{{ docker_storage_driver == 'devicemapper' }}"
# Controller LVM volume group for data. See mrlesmithjr.manage-lvm role for
# format.
controller_lvm_group_data:

View File

@ -2,6 +2,9 @@
###############################################################################
# Docker configuration.
# Name of the docker storage driver. Default is 'devicemapper'.
docker_storage_driver: devicemapper
# Name of the docker storage LVM volume group.
docker_storage_volume_group: data

View File

@ -37,13 +37,19 @@ seed_lvm_groups: "{{ seed_lvm_groups_default + seed_lvm_groups_extra }}"
# Default list of seed volume groups. See mrlesmithjr.manage-lvm role for
# format.
seed_lvm_groups_default:
- "{{ seed_lvm_group_data }}"
seed_lvm_groups_default: "{{ [seed_lvm_group_data] if seed_lvm_group_data_enabled | bool else [] }}"
# Additional list of seed volume groups. See mrlesmithjr.manage-lvm role for
# format.
seed_lvm_groups_extra: []
# Whether a 'data' LVM volume group should exist on the seed. By default this
# contains a 'docker-volumes' logical volume for Docker volume storage. It will
# also be used for Docker container and image storage if
# 'docker_storage_driver' is set to 'devicemapper'. Default is true if
# 'docker_storage_driver' is set to 'devicemapper', or false otherwise.
seed_lvm_group_data_enabled: "{{ docker_storage_driver == 'devicemapper' }}"
# Seed LVM volume group for data. See mrlesmithjr.manage-lvm role for format.
seed_lvm_group_data:
vgname: data

View File

@ -82,13 +82,19 @@ storage_lvm_groups: "{{ storage_lvm_groups_default + storage_lvm_groups_extra }}
# Default list of storage volume groups. See mrlesmithjr.manage-lvm role for
# format.
storage_lvm_groups_default:
- "{{ storage_lvm_group_data }}"
storage_lvm_groups_default: "{{ [storage_lvm_group_data] if storage_lvm_group_data_enabled | bool else [] }}"
# Additional list of storage volume groups. See mrlesmithjr.manage-lvm role
# for format.
storage_lvm_groups_extra: []
# Whether a 'data' LVM volume group should exist on storage hosts. By default
# this contains a 'docker-volumes' logical volume for Docker volume storage. It
# will also be used for Docker container and image storage if
# 'docker_storage_driver' is set to 'devicemapper'. Default is true if
# 'docker_storage_driver' is set to 'devicemapper', or false otherwise.
storage_lvm_group_data_enabled: "{{ docker_storage_driver == 'devicemapper' }}"
# Storage LVM volume group for data. See mrlesmithjr.manage-lvm role for
# format.
storage_lvm_group_data:

View File

@ -597,11 +597,28 @@ via the ``seed_hypervisor_lvm_group_data_disks`` variable.
LVM for Docker
--------------
The default LVM configuration is optimised for the ``devicemapper`` Docker
storage driver, which requires a thin provisioned LVM volume. A second logical
volume is used for storing Docker volume data, mounted at
``/var/lib/docker/volumes``. Both logical volumes are created from a single
``data`` volume group.
.. note::
In Train and earlier releases of Kayobe, the ``data`` volume group was
always enabled by default.
If the ``devicemapper`` Docker storage driver is in use, the default LVM
configuration is optimised for it. The ``devicemapper`` driver requires a thin
provisioned LVM volume. A second logical volume is used for storing Docker
volume data, mounted at ``/var/lib/docker/volumes``. Both logical volumes are
created from a single ``data`` volume group.
This configuration is enabled by the following variables, which default to
``true`` if the ``devicemapper`` driver is in use or ``false`` otherwise:
* ``compute_lvm_group_data_enabled``
* ``controller_lvm_group_data_enabled``
* ``seed_lvm_group_data_enabled``
* ``storage_lvm_group_data_enabled``
These variables can be set to ``true`` to enable the data volume group if the
``devicemapper`` driver is not in use. This may be useful where the
``docker-volumes`` logical volume is required.
To use this configuration, a list of disks must be configured via the following
variables:

View File

@ -0,0 +1,15 @@
---
upgrade:
- |
The default LVM configuration is now empty for all hosts, unless they are
configured to use the ``devicemapper`` Docker storage driver (which is the
default, but is expected to change in a future release).
Note that while the default LVM configuration existed primarily for the
``devicemapper`` driver, it also included a ``docker-volumes`` logical
volume mounted at ``/var/lib/docker/volumes`` for Docker volumes. If the
``docker-volumes`` volume is required on a host which is not configured to
use the Docker ``devicemapper`` storage driver, the following variables may
be used to enable it: ``compute_lvm_group_data_enabled``,
``controller_lvm_group_data_enabled``, ``seed_lvm_group_data_enabled``,
``storage_lvm_group_data_enabled``.