From a14dcc84891249e2b0065cefc50035ef8e5c2dcf Mon Sep 17 00:00:00 2001 From: Jesse Pretorius Date: Mon, 7 Jan 2019 14:24:44 +0000 Subject: [PATCH] Resolve btrfs backing store variable inconsistency In Ica79472568799098ebf83c6cefc585f117975f37 some incorrect variable names were used. This patch changes the variable names to suit their purpose and ensures that they are used consistently throughout the role. Change-Id: If9e912641b5b6cb7791221b40dd4d56e215c2b98 --- defaults/main.yml | 16 +++++++++------- .../lxc-host-machine-vars-5d11b1f269167fd3.yaml | 15 +++++++++++++++ tasks/lxc_container_create_cow.yml | 10 +++++----- tasks/lxc_container_create_machinectl.yml | 8 ++++---- 4 files changed, 33 insertions(+), 16 deletions(-) create mode 100644 releasenotes/notes/lxc-host-machine-vars-5d11b1f269167fd3.yaml diff --git a/defaults/main.yml b/defaults/main.yml index 84f47bd..26d4023 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -185,13 +185,15 @@ properties: {} # host. lxc_container_journal_link: true -# Enable or Disable the BTRFS quota system for the "/var/lib/machines" mount -# point. More information on the BTRFS quota system can be found here: +# Enable or Disable the BTRFS quota system, which is used for the +# "/var/lib/machines" mount point (for the machinectl backing store), or for +# any containers with a btrfs backing store. More information on the BTRFS +# quota system can be found here: # * https://btrfs.wiki.kernel.org/index.php/Quota_support -lxc_host_machine_quota_disabled: false +lxc_host_btrfs_quota_disabled: false -# Set the default qgroup limits used for file system quotas. The default is -# "none". See the following documentation for more information: +# Set the default qgroup limits used for btrfs file system quotas. The default +# is "none". See the following documentation for more information: # * https://btrfs.wiki.kernel.org/index.php/Manpage/btrfs-qgroup -lxc_host_machine_qgroup_space_limit: none -lxc_host_machine_qgroup_compression_limit: none +lxc_host_btrfs_qgroup_space_limit: none +lxc_host_btrfs_qgroup_compression_limit: none diff --git a/releasenotes/notes/lxc-host-machine-vars-5d11b1f269167fd3.yaml b/releasenotes/notes/lxc-host-machine-vars-5d11b1f269167fd3.yaml new file mode 100644 index 0000000..5328612 --- /dev/null +++ b/releasenotes/notes/lxc-host-machine-vars-5d11b1f269167fd3.yaml @@ -0,0 +1,15 @@ +--- +fixes: + - | + When using LXC containers with a copy-on-write back-end, the ``lxc_hosts`` + role execution would fail due to undefined variables with the + ``nspawn_host_`` prefix. This issue has now been fixed. +deprecations: + - | + The following variable name changes have been implemented in order to + better reflect their purpose. + + * ``lxc_host_machine_quota_disabled`` -> ``lxc_host_btrfs_quota_disabled`` + * ``lxc_host_machine_qgroup_space_limit`` -> ``lxc_host_btrfs_qgroup_space_limit`` + * ``lxc_host_machine_qgroup_compression_limit`` -> ``lxc_host_btrfs_qgroup_compression_limit`` + diff --git a/tasks/lxc_container_create_cow.yml b/tasks/lxc_container_create_cow.yml index 8be646f..d091d73 100644 --- a/tasks/lxc_container_create_cow.yml +++ b/tasks/lxc_container_create_cow.yml @@ -38,23 +38,23 @@ when: - lxc_container_info.rc != 0 -- name: Set the qgroup limits +- name: Set the qgroup limits for btrfs backing stores block: - name: Set the qgroup size|compression limits on machines command: "btrfs qgroup limit {{ item }} /var/lib/lxc/{{ inventory_hostname }}" changed_when: false delegate_to: "{{ physical_host }}" with_items: - - "-e {{ nspawn_host_qgroup_space_limit }}" - - "-c {{ nspawn_host_qgroup_compression_limit }}" + - "-e {{ lxc_host_btrfs_qgroup_space_limit }}" + - "-c {{ lxc_host_btrfs_qgroup_compression_limit }}" when: - - not nspawn_host_machine_quota_disabled + - not (lxc_host_btrfs_quota_disabled | bool) rescue: - name: Notice regarding quota system debug: msg: >- There was an error processing the setup of qgroups. Check the system to ensure they're available otherwise disable the quota system by - setting `nspawn_host_machine_quota_disabled` to true. + setting `lxc_host_btrfs_quota_disabled` to true. when: - lxc_container_backing_store == 'btrfs' diff --git a/tasks/lxc_container_create_machinectl.yml b/tasks/lxc_container_create_machinectl.yml index 1d0a585..711e33f 100644 --- a/tasks/lxc_container_create_machinectl.yml +++ b/tasks/lxc_container_create_machinectl.yml @@ -35,14 +35,14 @@ changed_when: false delegate_to: "{{ physical_host }}" with_items: - - "-e {{ lxc_host_machine_qgroup_space_limit }}" - - "-c {{ lxc_host_machine_qgroup_compression_limit }}" + - "-e {{ lxc_host_btrfs_qgroup_space_limit }}" + - "-c {{ lxc_host_btrfs_qgroup_compression_limit }}" when: - - not lxc_host_machine_quota_disabled + - not (lxc_host_btrfs_quota_disabled | bool) rescue: - name: Notice regarding quota system debug: msg: >- There was an error processing the setup of qgroups. Check the system to ensure they're available otherwise disable the quota system by - setting `lxc_host_machine_quota_disabled` to true. + setting `lxc_host_btrfs_quota_disabled` to true.