23 Commits

Author SHA1 Message Date
Mark Goddard
e47ff6bd82 Use jinja2.pass_context instead of contextfilter
Jinja2 3.0.0 deprecated contextfilter in favour of pass_context. 3.1.0
dropped contextfilter.

Fall back to contextfilter for Jinja2 2.x.

This change also fixes some issues caused by Ansible lint 6.0. Issues
found by the yaml plugin are fixed, while the FQCN for builtin actions
plugin is skipped.

Change-Id: I97b25551eb26da2c9100120bcd646c88fdb33ba6
2022-03-29 12:36:52 +01:00
Mark Goddard
fc1b42c60d Support UEFI boot mode
Adds support for using UEFI boot mode for nodes. This is done via node
capabilities, as it is in Ironic.

The default boot mode is now configurable via the default_boot_mode
variable. The default boot mode remains legacy BIOS for now, although
this may change.

Updates the existing CI jobs, with the OVS jobs using BIOS boot mode,
and the linuxbridge jobs using UEFI boot mode.

Depends-On: https://github.com/stackhpc/ansible-role-libvirt-vm/pull/83
Depends-On: https://github.com/stackhpc/ansible-role-libvirt-host/pull/50
Depends-On: https://review.opendev.org/c/openstack/kayobe/+/827486

Change-Id: Ifaf95ecfd4f6e925d3c69d4b324fdf2cd6b0ca52
2022-02-08 10:52:28 +00:00
Mark Goddard
c9515e0ca8 CI: Fix ansible-lint failure
Currently ansible-lint is failing with:

    KeyError: 'hostvars'

This change fixes the issue by making the hostvars key optional. This
should not affect real usage, since an error is raised in this case.

Change-Id: I6dd482e95fa4f5508452d83bb64613d55eb1985f
2020-11-24 15:37:20 +00:00
Iury Gregory Melo Ferreira
5abd97149c Py2 - Remove six, mock and future
Since we've dropped support for Python 2.7, it's time to look at
the bright future that Python 3.x will bring and stop forcing
compatibility with older versions.

This patch removes the six library , switches the mock library
to unittest.mock and removes future.

Change-Id: I71b11f13691d13df162b203f7ea5979b30c272df
2020-05-04 15:22:23 +02:00
Zuul
d8f380a975 Merge "Ensure veth pairs are uniquely named" 2020-04-02 22:17:48 +00:00
Mark Goddard
eb34860069 Ensure veth pairs are uniquely named
We name veth pairs using up to the first 6 characters from the nodes names. If
the node name prefixes are longer than this then the node index will not be
included, and the interface names will not be unique.

e.g. prefix compute, 2 nodes: compute0 & compute1

Link names are all p-comput-0-tap

Note that the 0 here is the index of the physnet, node the node.

This patch includes any trailing digits to keep link names unique, e.g.
p-compu0-0-tap.

Change-Id: I35c3da1d00030d8a270ac1a09e88e22098594f20
Story: 2007431
Task: 39058
2020-04-02 18:01:50 +00:00
Mark Goddard
ced8a4a528 Support linux bridge in addition to OVS
While OVS was used initially due to availability of a
networking-generic-switch driver for it, Linux bridge can be useful for
environments where OVS is not available.

This is configured via bridge_type variable. It defaults to
'openvswitch', but may be set to 'linuxbridge'.

Change-Id: I750a73cebc743edcbcd8c23c67e4920d0058bead
2020-03-13 11:12:37 +00:00
Mark Goddard
dcc25d8524 Configure VM interfaces in macvtap passthrough mode
Tenks currently uses macvtap interfaces in 'VEPA' mode for the VMs. If the VMs
run any virtual networking internally, typically this will use a different MAC
address, which will not be reachable from outside due to the macvtap MAC
filtering.

This change uses macvtap 'passthrough' mode, such that all traffic is passed.

Change-Id: I0077c7001b2b419a94ea420833fa6dd3e8a3a967
Story: 2004906
Task: 29256
2019-01-31 14:57:34 +00:00
Mark Goddard
8802ff3e0e Use only the first 6 characters of the node name in link names
Linux interface names can be a maximum of 15 characters. Long node names can
exceed this limit, when combined with the patch port prefix, node index and
patch port suffix. By default, these are:

p-<node name prefix>-<node index>-(phy|ovs)

This is 7 characters, plus the node name prefix, plus the node index. A 6
character limit on the node name prefix gives a bit of wiggle room if the patch
prefix or suffix are changed from the defaults.

Change-Id: I672709a2fbf4eec2f7b7ba64404282d7f1e62935
TrivialFix
2018-11-26 10:53:25 +00:00
Will Miller
da15c6f6e6 Add inventory_hostname parameter to filter plugins
It is necessary in some places to use the network name filter plugins in
the context of any given hypervisor, even when the task is executing on
localhost. For this, allow an inventory_hostname to be specified.
2018-09-14 10:25:04 +00:00
Will Miller
fd2f8679aa Disable automatic power-on of Libvirt nodes
Ironic will be controlling the power state of the nodes, and we may want to be
able to control when inspection happens, so don't start Libvirt domains
automatically.
2018-09-11 08:51:49 +00:00
Will Miller
84ef8cd8ee Fix PEP8 and ansible-lint warnings 2018-09-06 08:31:24 +00:00
Will Miller
b888c3cb3e Allow binary and decimal capacities in size string 2018-09-05 15:44:06 +00:00
Will Miller
06bfdb0953 Fix PEP8 issues 2018-09-05 13:43:53 +00:00
Will Miller
81f1696263 Add Ironic enrolment Ansible role 2018-08-31 16:57:34 +00:00
Will Miller
7a78f86f40 Add additional network naming filter plugins
These will be useful for determining details needed for Ironic ports.
2018-08-31 13:49:19 +00:00
Will Miller
c9ea94b4fc Consolidate interface/link naming
Create filter plugins to perform physnet/node to veth link and bridge
naming. This reduces the logic duplication present.
2018-08-30 13:51:48 +00:00
Will Miller
34ebd92cad Refer to nodes, rather than VMs
The fact that the Libvirt provider is using VMs is an implementation
detail, so we should word Tenks such that it deploys clusters of nodes.
2018-08-28 16:50:02 +00:00
Will Miller
a79a894ca5 Fix PEP8 import errors 2018-08-28 11:05:54 +00:00
Will Miller
a9224302be Add header to Python files 2018-08-28 08:17:21 +00:00
Will Miller
7e35255f11 Update Libvirt interfaces plugin for veth naming 2018-08-23 12:34:44 +00:00
Will Miller
30d1047488 Use contextfilter decorator to simplify plugin 2018-08-23 08:56:27 +00:00
Will Miller
47827208f9 Add libvirt_vm_config.py filter plugins
These filter plugins allow mapping from declarative Tenks VM definitions
to config that can be accepted by the stackhpc.libvirt-vm role.
2018-08-22 16:57:21 +00:00