fix: update remote LXD scripts to use OVN backed NAT-ed networks.

This commit is contained in:
slawek committed 2026-11-22 19:27:53 +01:00
1 parent da889b4865
commit 5fff009320
9 files changed
+500 -19

No files matched your search

+80
View File
@@ -89,6 +89,86 @@ tests/remote/vm.py --remove
| `--config` | | `core.json` | The configuration from `configs/` |
| `--listen` | `LXD_LISTEN` | the remote URL's host | An address of the LXD host the proxies listen on |
In a test project made by `lxd-project.py`, `vm.py` installs the package from the project's
repository instead of `out/`, so later dev builds reach the VM as updates. LXD refuses NAT proxy
devices in a project with networks of its own, so there the ports lead through a network forward
on the project's `wan`, whose listen address LXD allocates from the uplink's `--routes`;
`--listen` does not apply, and `--remove` deletes the forward with the VM.
## A test project with dev builds
`lxd-project.py create` makes a project for manual tests that stays until
`lxd-project.py remove`; `run.py` keeps making and removing its own projects. The project has:
- networks of its own (`features.networks`), OVN networks on the physical uplink `--uplink`:
`wan`, with NAT and DHCP on a subnet LXD picks, and `lana` and `lanb`, on subnets LXD picks
without DHCP; OVN gives each network's router an address, which LAN hosts don't use as their
gateway;
- a default profile with a root disk on the pool and `eth0` on `wan`;
- the container `repo`, whose nginx serves a signed apt repository of the dev builds,
`resolute main` for amd64 and arm64, at its pinned address.
What the other scripts need, the repository's URL among it, is written to
`tmp/lxd-project-<project>.json`, and the repository's key to `tmp/lxd-project-<project>.gpg`.
`remove` deletes the project's instances, its networks, the project and those files.
The remote needs OVN, set up as LXD's standalone OVN guide describes, and a host bridge on the
LAN, whose host address stays on the bridge. `uplink setup` creates on it, once per remote, the
physical network `--uplink` that the OVN networks use as uplink:
- `--gateway`: the LAN's gateway, as address/prefix;
- `--dns`: the LAN's name servers, comma-separated;
- `--ovn-ranges`: free LAN addresses outside the LAN's DHCP pool, as `FIRST-LAST`, one for the
router of each OVN network;
- `--routes`: a free LAN subnet, in CIDR, whose addresses network forwards listen on.
OVN answers ARP for its routers' and forwards' addresses on the LAN (`ovn.ingress_mode`
`l2proxy`, LXD's default), so the LAN needs no route. `uplink setup` leaves an existing network
of that name as it is; `uplink remove` deletes it.
```sh
tests/remote/lxd-project.py uplink setup
```
```sh
tests/remote/lxd-project.py uplink remove
```
```sh
tests/remote/lxd-project.py create
```
```sh
tests/remote/lxd-project.py remove
```
| Option | Variable | Default | Meaning |
|---|---|---|---|
| `--remote` | `LXD_REMOTE` | required | The `lxc` remote |
| `--pool` | `LXD_POOL` | required by `create` | The storage pool of the project's root disks |
| `--project` | `LXD_PROJECT` | `lm-dev` | The project |
| `--image` | `LXD_IMAGE` | `ubuntu:26.04` | The image of the repository container |
| `--uplink` | `LXD_UPLINK` | `uplink` | The physical uplink network of the OVN networks |
| `--parent` | `LXD_UPLINK_PARENT` | required by `uplink setup` | The host bridge on the LAN |
| `--gateway` | `LXD_UPLINK_GATEWAY` | required by `uplink setup` | The LAN's gateway, address/prefix |
| `--dns` | `LXD_UPLINK_DNS` | required by `uplink setup` | The LAN's name servers |
| `--ovn-ranges` | `LXD_UPLINK_OVN_RANGES` | required by `uplink setup` | LAN addresses for OVN routers |
| `--routes` | `LXD_UPLINK_ROUTES` | required by `uplink setup` | A LAN subnet for network forwards |
`dev-build.py` builds and publishes the next dev build. Its version is the newest changelog
entry's with `~dev<N>` before the Debian revision, `0.41.0~dev7-1` for `0.41.0-1`, so the release
of that entry is newer than its dev builds. `N` is kept in `tmp/test-number` and goes up with each
build that succeeds. `./build.sh` builds it, with `CONTAINER_RUNTIME` and `DOCKER_CONTEXT` from the
environment; the build is moved to `out/dev/`, copied into the repository and published there. A
VM of the project then gets it with Check update and Upgrade in the Manager, or `apt-get update`
and `apt-get upgrade`.
```sh
tests/remote/dev-build.py
```
`--project` (`LXD_PROJECT`, `lm-dev` by default) names the project.
## Scope of the tests
Not covered by `run.py`: IKEv2 client access, HTTPS with Let's Encrypt, the OpenID Provider and