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
This commit is contained in:
Jonathan Rosser 2018-11-07 20:36:50 +00:00
parent 284341bf24
commit 14572c3153
9 changed files with 80 additions and 11 deletions

View File

@ -632,9 +632,13 @@ lxd_storage_backend: dir
# This needs to be set in the user_secrets.yml file.
#lxd_trust_password:
# This variable should be used with lxd when using a
# storage backend that utilizes storage pools (zfs)
#lxd_storage_pool:
# The name of the underlying storage pool created by, or consumed by
# lxd init. As an example this would be the name of a ZFS pool.
#lxd_init_storage_pool: pool
# Nova requires the LXD storage pool name to be specified
lxd_storage_pool: default
# This variable should be used with lxd when using a
# storage backend that utilizes storage pool if you
# want to use a specific bloc device instead of loop

View File

@ -0,0 +1,11 @@
---
features:
- |
The nova configuration is updated to always specify an LXD storage pool
name when 'nova_virt_type' is 'lxd'. The variable 'lxd_storage_pool' is
defaulted to 'default', the LXD default storage pool name. A new variable
'lxd_init_storage_pool' is introduced which specifies the underlying
storage pool name. 'lxd_init_storage_pool' is used by lxd init when setting
up the storage pool. If not provided, lxd init will not use this parameter
at all. Please see the lxd man page for further information about the
storage pool parameter.

View File

@ -11,8 +11,8 @@
--network-address={{ lxd_bind_address }} \
--network-port={{ lxd_bind_port }} \
--storage-backend={{ lxd_storage_backend }} \
{% if lxd_storage_pool is defined %}
--storage-pool={{ lxd_storage_pool }} \
{% 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 }} \
@ -29,4 +29,3 @@ if [ $(findmnt /var/lib/lxd -o FSTYPE -n) == "btrfs" ]; then
fi
{% endif %}

View File

@ -280,7 +280,7 @@ hw_disk_discard = {{ nova_libvirt_hw_disk_discard }}
disk_cachemodes = {{ nova_libvirt_disk_cachemodes }}
{% endif %}
{% if nova_virt_type == 'lxd' and lxd_storage_pool is defined %}
{% if nova_virt_type == 'lxd' %}
[lxd]
pool= {{ lxd_storage_pool }}
{% endif %}

View File

@ -14,6 +14,8 @@
# limitations under the License.
nova_virt_type: lxd
lxd_storage_backend: zfs
lxd_init_storage_pool: default
tempest_test_whitelist:
- tempest.scenario.test_server_basic_ops.TestServerBasicOps.test_server_basic_ops

View File

@ -0,0 +1,48 @@
---
# Copyright 2018, BBC R&D
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
- name: Configure ZFS backing storage
hosts: localhost
user: root
become: true
connection: local
tasks:
- block:
- name: Install ZFS packages
package:
name: "{{ zfs_package[ansible_distribution | lower] }}"
state: present
- name: Create base directories
file:
path: "{{ item }}"
state: "directory"
with_items:
- /openstack
- name: Create sparse ZFS backing file
command: "truncate -s 1024G /openstack/nova-lxd-zfs.img"
args:
creates: /openstack/nova-lxd-zfs.img
register: lxc_zfs_create
- name: Create the ZFS pool
command: zpool create default /openstack/nova-lxd-zfs.img
args:
creates: /default
vars:
zfs_package:
ubuntu: "zfsutils-linux"

View File

@ -13,6 +13,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# Setup ZFS pool for nova-lxd tests
- import_playbook: test-create-zfs-dev.yml
when:
- nova_virt_type is defined and nova_virt_type == "lxd"
# Setup the host
- import_playbook: common/test-setup-host.yml

View File

@ -14,7 +14,7 @@
# limitations under the License.
- job:
name: openstack-ansible-lxd-ubuntu-xenial
parent: openstack-ansible-functional-ubuntu-xenial
name: openstack-ansible-lxd-ubuntu-bionic
parent: openstack-ansible-functional-ubuntu-bionic
vars:
tox_env: lxd

View File

@ -21,7 +21,7 @@
- release-notes-jobs-python3
check:
jobs:
- openstack-ansible-lxd-ubuntu-xenial
- openstack-ansible-lxd-ubuntu-bionic
gate:
jobs:
- openstack-ansible-lxd-ubuntu-xenial
- openstack-ansible-lxd-ubuntu-bionic