From 1d8b4e2500955ce4385227098ee38c9efbfed038 Mon Sep 17 00:00:00 2001 From: Mark Goddard Date: Mon, 13 May 2019 14:02:52 +0100 Subject: [PATCH] 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 --- ansible/group_vars/all/compute | 10 +++++-- ansible/group_vars/all/controllers | 10 +++++-- ansible/group_vars/all/docker | 3 +++ ansible/group_vars/all/seed | 10 +++++-- ansible/group_vars/all/storage | 10 +++++-- doc/source/configuration/hosts.rst | 27 +++++++++++++++---- .../default-lvm-data-vg-f2848066975beeda.yaml | 15 +++++++++++ 7 files changed, 72 insertions(+), 13 deletions(-) create mode 100644 releasenotes/notes/default-lvm-data-vg-f2848066975beeda.yaml diff --git a/ansible/group_vars/all/compute b/ansible/group_vars/all/compute index 244eac119..9f61ad851 100644 --- a/ansible/group_vars/all/compute +++ b/ansible/group_vars/all/compute @@ -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: diff --git a/ansible/group_vars/all/controllers b/ansible/group_vars/all/controllers index d8d5e4d88..6d691ba56 100644 --- a/ansible/group_vars/all/controllers +++ b/ansible/group_vars/all/controllers @@ -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: diff --git a/ansible/group_vars/all/docker b/ansible/group_vars/all/docker index 567d4f2e0..d9ab508b3 100644 --- a/ansible/group_vars/all/docker +++ b/ansible/group_vars/all/docker @@ -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 diff --git a/ansible/group_vars/all/seed b/ansible/group_vars/all/seed index b53b1dbaf..686d70109 100644 --- a/ansible/group_vars/all/seed +++ b/ansible/group_vars/all/seed @@ -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 diff --git a/ansible/group_vars/all/storage b/ansible/group_vars/all/storage index 74b3339d0..a83dbead6 100644 --- a/ansible/group_vars/all/storage +++ b/ansible/group_vars/all/storage @@ -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: diff --git a/doc/source/configuration/hosts.rst b/doc/source/configuration/hosts.rst index c7781c831..fbc95911b 100644 --- a/doc/source/configuration/hosts.rst +++ b/doc/source/configuration/hosts.rst @@ -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: diff --git a/releasenotes/notes/default-lvm-data-vg-f2848066975beeda.yaml b/releasenotes/notes/default-lvm-data-vg-f2848066975beeda.yaml new file mode 100644 index 000000000..506fbaeeb --- /dev/null +++ b/releasenotes/notes/default-lvm-data-vg-f2848066975beeda.yaml @@ -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``.