openstack-ansible-os_nova/templates/lxd-init.sh.j2
Jonathan Rosser 14572c3153 Fix nova-lxd tests for bionic.
This patch adjusts the nova-lxd deployment so that it works correctly
with LXD3 and bionic.

* Update the zuul job and project config to switch from xenial to bionic.

* Change the variable lxd_storage_pool to always have a defined value
  in the role defaults. This variable represents the name of the LXD
  storage pool which is distinct from any names associated with underlying
  storage. LXD storage pools created with 'lxd init' are always called 'default'.

* Switch the role test storage backend from dir to ZFS. nova-lxd is
  currently not working for the dir backend as it expects the storage
  subsystem to support quotas.

* Due to limitiations in nova-lxd it is necessary to ensure that the
  LXD storage pool name and ZFS pool names are both set to 'default'.

Closes-Bug: #1800837
Change-Id: If1e48bb2e789e13f20435da19907b5adb7c1ef1f
2018-11-20 20:55:52 +00:00

32 lines
876 B
Django/Jinja

#!/bin/bash
# {{ ansible_managed }}
{% if (lxd_storage_backend == "zfs" or lxd_storage_backend == "dir") %}
# This is a script to configure lxd system settings.
# "/usr/bin/lxd init"
/usr/bin/lxd init \
--auto \
--network-address={{ lxd_bind_address }} \
--network-port={{ lxd_bind_port }} \
--storage-backend={{ lxd_storage_backend }} \
{% if lxd_init_storage_pool is defined %}
--storage-pool={{ lxd_init_storage_pool }} \
{% endif %}
{% if lxd_storage_create_device is defined %}
--storage-create-device={{ lxd_storage_create_device }} \
{% endif %}
--trust-password={{ lxd_trust_password }}
{% elif (lxd_storage_backend == "btrfs") %}
# Check if filesystem if mounted as btrfs.
# If not nothing happens and storage will still be set to dir by default
if [ $(findmnt /var/lib/lxd -o FSTYPE -n) == "btrfs" ]; then
systemctl restart lxd
fi
{% endif %}