tasks: Ensure machinectl quota value is reasonable

It appears that when setting a limit which is greater than the size
of the underlying filesystem, machinectl does not change the quota at
all. As such, lets calculate the limit based on the /var/lib/machines
mountpoint or any of its parents.

Change-Id: I8ddc9931cbca5db8c1a411fd2581b34763179d01
This commit is contained in:
Markos Chandras 2018-03-14 08:45:49 +00:00
parent f7bdcbfb5d
commit 345b501464
1 changed files with 13 additions and 2 deletions

View File

@ -28,9 +28,20 @@ lxc_architecture_mapping:
s390x: s390x
armv7l: armhf
# Set the volume size for the machine image caches.
# Set the volume size for the machine image caches. We only use the
# most specific mountpoint from the hierarchy.
# NOTE: Size is set in Gigabytes.
lxc_host_machine_volume_size: "64"
lxc_host_machine_volume_size: |-
{%- set mounts = [] -%}
{%- set mount_points = ['/var/lib/machines', '/var/lib/', '/var', '/'] -%}
{%- for mount in mount_points -%}
{%- for dev in ansible_mounts -%}
{%- if mount == dev.mount -%}
{%- set _ = mounts.append(dev.size_total // (1024 ** 3)) -%}
{%- endif -%}
{%- endfor -%}
{%- endfor -%}
{{ mounts[0] }}
# Disable the machinctl quota system.
lxc_host_machine_quota_disabled: true