Mark Goddard 7bcc5579e2 Fix seed VM interface ordering
Currently the ordering of network interfaces in the seed VM is
non-deterministic. This happens because we apply the 'unique' filter to
the network_interfaces list, which does not guarantee a deterministic
ordering. This list is then transformed and passed to the
stackhpc.libvirt-vm role.

There are two consequences of this:

* it is not possible to determine which interface names should be used
  prior to creating a seed VM
* if a seed VM is recreated, the interface ordering may change

This change fixes the issue by sorting the network_interfaces list
alphabetically before it is transformed and passed to the
stackhpc.libvirt-vm.

A new 'seed_vm_interfaces' variable is also added, which allows for
customisation of the VM's interfaces - potentially allowing for more
complex setups such as trunked VLANs.

Story: 2007259
Task: 38621

There is a second issue, which is that if the seed VM has a
network interface not configured with a gateway, cloud-init will fail to
configure the network interfaces on the host. This has been observed on
CentOS 8, but is probably more tied to the version of cloud-init, and
may affect CentOS 7. The following error is seen in the cloud-init logs:

    KeyError: 'gateway'

This change has been addressed in the jriguera.configdrive role, and
this change updates the version used in requirements.yml.

Story: 2007769
Task: 39993

Change-Id: Ib6ab41a3ba320a1fe15d0d23561fad2fab7861e6
2020-06-12 17:32:48 +01:00

54 lines
1.4 KiB
Plaintext

---
###############################################################################
# Seed node VM configuration.
# Name of the seed VM.
seed_vm_name: "{{ inventory_hostname }}"
# Memory in MB.
seed_vm_memory_mb: "{{ 16 * 1024 }}"
# Number of vCPUs.
seed_vm_vcpus: 4
# List of volumes.
seed_vm_volumes:
- "{{ seed_vm_root_volume }}"
- "{{ seed_vm_data_volume }}"
# Root volume.
seed_vm_root_volume:
name: "{{ seed_vm_name }}-root"
pool: "{{ seed_vm_pool }}"
capacity: "{{ seed_vm_root_capacity }}"
format: "{{ seed_vm_root_format }}"
image: "{{ seed_vm_root_image }}"
# Data volume.
seed_vm_data_volume:
name: "{{ seed_vm_name }}-data"
pool: "{{ seed_vm_pool }}"
capacity: "{{ seed_vm_data_capacity }}"
format: "{{ seed_vm_data_format }}"
# Name of the storage pool for the seed VM volumes.
seed_vm_pool: default
# Capacity of the seed VM root volume.
seed_vm_root_capacity: 50G
# Format of the seed VM root volume.
seed_vm_root_format: qcow2
# Base image for the seed VM root volume.
seed_vm_root_image: "https://cloud.centos.org/centos/8/x86_64/images/CentOS-8-GenericCloud-8.1.1911-20200113.3.x86_64.qcow2"
# Capacity of the seed VM data volume.
seed_vm_data_capacity: 100G
# Format of the seed VM data volume.
seed_vm_data_format: qcow2
# List of network interfaces to attach to the seed VM.
seed_vm_interfaces: "{{ network_interfaces | sort | map('net_libvirt_vm_network') | list }}"