Skip to content

[WIP] Add MAAS multinode testing#567

Draft
freyes wants to merge 50 commits into
canonical:mainfrom
freyes:feature/multi-node-maas-testing
Draft

[WIP] Add MAAS multinode testing#567
freyes wants to merge 50 commits into
canonical:mainfrom
freyes:feature/multi-node-maas-testing

Conversation

@freyes
Copy link
Copy Markdown
Collaborator

@freyes freyes commented Sep 2, 2025

This PR implements testing of the openstack snap using the MAAS provider in a virtual environment.

@freyes freyes changed the title Add MAAS multinode testing [WIP] Add MAAS multinode testing Sep 2, 2025
@freyes freyes force-pushed the feature/multi-node-maas-testing branch 2 times, most recently from c2f2f2f to 30bf410 Compare September 2, 2025 02:24
@freyes freyes force-pushed the feature/multi-node-maas-testing branch 4 times, most recently from 8553e50 to 9ff7687 Compare September 11, 2025 19:54
Comment thread .github/workflows/build-snap.yml Outdated
@freyes freyes force-pushed the feature/multi-node-maas-testing branch 5 times, most recently from f47493e to 3767e19 Compare October 3, 2025 16:33
@freyes freyes force-pushed the feature/multi-node-maas-testing branch from d0ae872 to 0cdd6e4 Compare October 17, 2025 19:52
ip_ranges = [maas_subnet_ip_range.generic_subnet_dhcp_range.id]
}

resource "maas_machine" "node" {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
resource "maas_machine" "node" {
resource "maas_machine" "node" {
depends_on = [ null_resource.maas_controller_null ]

This fixes the race condition preventing maas to connect via ssh on the libvirt host

Comment on lines +6 to +12
terraform {
source = "."
extra_arguments "parallelism" {
commands = ["apply", "plan", "destroy"]
arguments = ["-parallelism=1"]
}
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
terraform {
source = "."
extra_arguments "parallelism" {
commands = ["apply", "plan", "destroy"]
arguments = ["-parallelism=1"]
}
}

Parallelism can be dropped

Signed-off-by: Felipe Reyes <felipe.reyes@canonical.com>
This directory is meant to be used to store sensitive information that
shouldn't be committed to the git repository, but it's worth to not be
written to /tmp since it's helpful when debugging, for example API keys,
ssh keys, etc.

Signed-off-by: Felipe Reyes <felipe.reyes@canonical.com>
Signed-off-by: Felipe Reyes <felipe.reyes@canonical.com>
The maas provider needs information that comes out of the virtualnodes
unit, this change introduces autogeneration of the maas provider block
based on it.

To allow `plan` and `validate` subcommands keep working, the necessary
data is mocked.

Signed-off-by: Felipe Reyes <felipe.reyes@canonical.com>
Signed-off-by: Felipe Reyes <felipe.reyes@canonical.com>
Signed-off-by: Felipe Reyes <felipe.reyes@canonical.com>
This allows to reuse the value in cloud-init configuration and any other
place where the hostname needs to be referenced, e.g. when reading data
from MAAS API

Signed-off-by: Felipe Reyes <felipe.reyes@canonical.com>
Signed-off-by: Felipe Reyes <felipe.reyes@canonical.com>
Signed-off-by: Felipe Reyes <felipe.reyes@canonical.com>
the maas setup needs to happen in the maas unit, not in a cloud-init
driven config script.

Signed-off-by: Felipe Reyes <felipe.reyes@canonical.com>
- Set kernel global options
- Disable dnssec
- Configure password-less ssh access to the kvm host
- Register virtual nodes
- Configure networking

Signed-off-by: Felipe Reyes <felipe.reyes@canonical.com>
Signed-off-by: Felipe Reyes <felipe.reyes@canonical.com>
Signed-off-by: Felipe Reyes <felipe.reyes@canonical.com>
Signed-off-by: Felipe Reyes <felipe.reyes@canonical.com>
Signed-off-by: Felipe Reyes <felipe.reyes@canonical.com>
Signed-off-by: Felipe Reyes <felipe.reyes@canonical.com>
Signed-off-by: Felipe Reyes <felipe.reyes@canonical.com>
Signed-off-by: Felipe Reyes <felipe.reyes@canonical.com>
This allows calling the deploy.sh from anywhere and any relative paths
will still work.

Signed-off-by: Felipe Reyes <felipe.reyes@canonical.com>
Signed-off-by: Felipe Reyes <felipe.reyes@canonical.com>
The script collect-logs.sh calls sosreport on the maas-controller node
and the hypervisor.

Signed-off-by: Felipe Reyes <felipe.reyes@canonical.com>
There are scenarios where the apt repo index is presenting invalid
checksums, likely during re-sync of the mirrors, so adding a simple
retry mechanism to make this step more robust.

Signed-off-by: Felipe Reyes <felipe.reyes@canonical.com>
This key is then used by terragrunt/terraform to provision the
maas-controller and access it, but more importantly to configure the
hypervisor access and allow MAAS to manage the libvirt instances via the
virsh power driver
Rely on `sudo su - ubuntu -c foo` to enforce the execution of the
deploy.sh script in a new shell session so the new group memberships
become effective

Signed-off-by: Felipe Reyes <felipe.reyes@canonical.com>
Signed-off-by: Felipe Reyes <felipe.reyes@canonical.com>
Signed-off-by: Felipe Reyes <felipe.reyes@canonical.com>
This allows the user to ssh into the node and debug interatively, the
job will be held on until it times out or the file /tmp/.continue
appears.
The genisoimage package is needed to build a iso image that's used to be
passed to cloud-init, this image contains all the cloud-init
configuration produced by the virtualnodes stack unit

Signed-off-by: Felipe Reyes <felipe.reyes@canonical.com>
This script allows the execution of the testing machinery directly
interacting with testflinger.

Usage example:

```
./testing/local-testflinger.sh
```

The script depends on finding a snap file at the top of the git
repository, this can be a locally built snap or a snap that was fetched
via `snap download ...`

Signed-off-by: Felipe Reyes <felipe.reyes@canonical.com>
Create a libvirt pool called "sunbeam" to store all the volumes used by
the libvirt instances, this allows a cleaner setup on non-dedicated
hypervisors

Signed-off-by: Felipe Reyes <felipe.reyes@canonical.com>
Add a busy loop until the MAAS admin API key is written to disk, this
prevents race conditions found when testing on physical hardware
This has the intention of putting less pressure on the maas controller
and reduce the chances that the libvirt instance fails to pxe boot.
Include a section to document how to run the testing from a local
development environment.

Signed-off-by: Felipe Reyes <felipe.reyes@canonical.com>
Signed-off-by: Felipe Reyes <felipe.reyes@canonical.com>
Signed-off-by: Felipe Reyes <felipe.reyes@canonical.com>
Signed-off-by: Felipe Reyes <felipe.reyes@canonical.com>
The terraform libvirt provider changed their schema definition in 0.9.0

Signed-off-by: Felipe Reyes <felipe.reyes@canonical.com>
Signed-off-by: Felipe Reyes <felipe.reyes@canonical.com>
Signed-off-by: Felipe Reyes <felipe.reyes@canonical.com>
Signed-off-by: Felipe Reyes <felipe.reyes@canonical.com>
Force mac address to be rendered as a literal string

Signed-off-by: Felipe Reyes <felipe.reyes@canonical.com>
@freyes freyes force-pushed the feature/multi-node-maas-testing branch from c062693 to bda71a2 Compare December 18, 2025 20:30
Signed-off-by: Felipe Reyes <felipe.reyes@canonical.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants