Files
werewulf/docs/25-openstack.md
ilkerandClaude Opus 5.5 a856aa3c65
ci / derle (push) Successful in 50s
portal: connect an OpenStack project from the portal
Sites -> Connect a site (administrators) joins another OpenStack project
- another cloud, region or project - to an installation: no shell, no
restart, nothing installed in the cloud but the images clusters boot
from. The form is setup's own fields for the site's part; the
installation's answers come from site.env. Check logs in and reads;
Connect runs setup's Connector in the portal, as the service, with its
log on the page.

- The head image is copied from another OpenStack site whose image is of
  the roles here (downloaded once into /var/lib/hpcod/images, SHA-512
  checked both ways), or built in the project when none is current.
- A connected site's files are the portal's, under /var/lib/hpcod:
  sites.d/<id>.yaml (read beside /etc/hpcod/sites.yaml, which is not
  written; written last), secrets/<id>.* (0600, by file: reference), its
  record and its Terraform environment.
- Per-site management windows (mgmt_first/mgmt_count), checked against
  each other: shared exactly or apart, never overlapping; build
  addresses unique.
- tofu.env in a site's environment names where the provider's variables
  come from, so a second OpenStack site is not the service's OS_PASSWORD.
- The portal reloads its site list when sites.yaml or sites.d changes,
  keeping the old list if the catalogue stops parsing; a connected site
  that does not parse costs only itself.
- hpcod selftest -site ID; Glance lookups scoped to the project.

Run on the DevStack control plane through the portal: demo connected
with its head image built there by the portal; hpc3 connected with its
image copied from demo's (6.5 GB, two minutes); selftest -site
devstack-hpc3 -compute 2 passed on the copy. Its head volume took 4m31s,
past Nova's 185 s, and Terraform waited.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-26 23:59:40 +01:00

256 lines
14 KiB
Markdown

# 25. OpenStack — clusters in a cloud project
Section 20 builds a tenant cluster on hypervisors hpcod drives itself;
section 24 on whole machines. This is the backend where hpcod is a tenant
of someone else's cloud: clusters are built in one OpenStack project, out of
its quota, with what the cloud lets a project do.
**Status: built, and run end to end on DevStack** (stable/2026.2, OVN,
nested KVM; Cinder on LVM, and before that without Cinder) from a freshly installed control plane: setup,
verify, a cluster built, two compute nodes network booted through the
cloud's own overlay, a Slurm job across both, and the cluster destroyed with
nothing left in the project. It has not yet run on a production cloud;
25.9 lists what that would be the first test of.
---
## 25.1 What a cluster is made of
| Part | On OpenStack |
|---|---|
| fabric | a Neutron network and subnet per cluster, Neutron's DHCP off, port security off on its ports |
| head | an instance of the head image, two ports: management (hpcod's address, on a network the site names) and fabric |
| compute nodes | instances of an iPXE ISO; iPXE does DHCP on the fabric and the head's Warewulf boots them, as PXE would |
| head image | built in the cloud by setup: a build instance, the same playbook, a snapshot in Glance |
| head disk | a 120 GB Cinder volume made from the head image, where the cloud has Cinder; else the flavor's root disk |
| sizes | the smallest flavor the project may use that fits each VM |
| who may reach a head | a security group per cluster: the control plane, and only it |
The names, MACs, addresses and head configuration come from the same layout
module as every other backend, so a cluster here is the same cluster as on
Proxmox or libvirt.
Why each choice:
- **Port security off on the fabric.** The head is the fabric's DHCP and PXE
server, and Neutron's anti-spoofing drops DHCP answers from an instance.
The fabric network belongs to the project and carries only that cluster.
- **iPXE from Glance.** Nova cannot boot an instance from the network. The
ISO from Debian's `ipxe` package does DHCP on the instance's NIC, and
Warewulf's DHCP server answers an iPXE client with its HTTP boot script.
- **MACs set on the cluster's own ports.** Warewulf knows nodes by MAC. The
project owns the fabric network, so Neutron lets it choose them; the
prefix is a locally administered one (`OS_MAC_PREFIX`), not OpenStack's
own `fa:16:3e`.
- **Flavors chosen, not made.** A tenant of a cloud seldom may create
flavors. A VM gets the smallest that fits, which may be bigger than asked
for; the cluster's Terraform output says which it got.
- **The head's disk on a volume.** A cloud's flavors usually have root disks
of 20 to 80 GB; one with the head's 120 GB is its largest, so a head of
2 vCPUs would take 8 and 16 GiB. On a volume the flavor's disk is not
used, and the head takes the smallest flavor with its vCPUs and memory.
The volume is a Terraform resource of the cluster's, made from the head
image before the head and deleted after it - not Nova's own image-to-
volume boot, which waits about three minutes and then fails the
instance, leaving the volume behind (25.8). `OS_HEAD_VOLUME` is `auto` (a volume where the catalog lists
Cinder), `yes` or `no`; `OS_VOLUME_TYPE` names a type other than the
cloud's default.
- **The fabric's MTU.** An overlay network (Geneve, VXLAN) is smaller than
1500 — 1442 on the DevStack it was tested on. The head learns it from the
config drive; the compute nodes are told it through Warewulf (the layout's
`fabric_mtu`, read back after it is set). A node left at 1500 still talks
to the head — the head's smaller MSS bounds TCP — and silently loses every
large packet between nodes, which is MPI's traffic.
## 25.2 What the project needs
- A **management network** the control plane can reach, with free addresses
for heads (`MGMT_FIRST`, `MGMT_COUNT`) and one for the build instance
(`BUILD_IP`). Giving a port a chosen address takes owning the network, or
admin: a provider network the cloud's operators make for this and share
with the project is the usual answer. Setup checks the addresses are in
its subnet and that the gateway is the one the site names.
- The **port-security** extension (setup checks).
- A **flavor** of at least 2 vCPUs, 4 GiB and 40 GB, which the head image is
built in; and for heads, one with their vCPUs and memory - and, without
Cinder, the head's 120 GB of disk.
- **Volume quota**, with Cinder: 120 GB for each head. Setup and verify
check there is room for one; the portal marks the site with a problem
when there is not, if the site's settings have `head_volume: "true"`
(setup writes it into a new `sites.yaml`, and says so when an older one
lacks it).
- **Image storage**: a head image is about 7 GB, and every rebuild keeps
the previous one for the heads made from it. Glance's per-project limit
(`image_size_total`) must allow it — DevStack's default of 2000 MiB let
the first head image in and refused the second (see 25.8).
- **Quota** for the clusters. hpcod offers what the quota leaves; where it
is unlimited, what Placement says the cloud has (admin only), or the
site's own `OS_MAX_CORES` and `OS_MAX_MEMORY_GB`.
## 25.3 Installing
```sh
sudo OS_PASSWORD=... hpcod setup -yes -config site.env
# or, with an application credential:
sudo OS_APPLICATION_CREDENTIAL_SECRET=... hpcod setup -yes -config site.env
```
`deploy/site.env.openstack.example` has every setting with its reason. The
secret is never in a file setup reads or writes besides `/etc/hpcod/env`
(root and the service): `sites.yaml` refers to it as `env:OS_PASSWORD`, and
Terraform's provider reads it from the service's environment, so neither
`site.auto.tfvars` nor any cluster's directory holds it.
Setup's OpenStack steps, after the common ones:
| Step | Does |
|---|---|
| `openstack` | logs in; checks the management network and subnet against the site, port security, the flavors; decides the head's disk (Cinder, the volume type, room in the quota); uploads the iPXE ISO and the cloud image to Glance unless the project has them, each checked against the file's SHA-512 |
| `template` | the head image: a build instance on `BUILD_IP`, the head playbook, a flush and a shutdown from inside, a snapshot carrying the roles' revision, the build instance removed |
`hpcod verify` then logs in, checks the network, port security and the
three images, and discovers the project through the portal's own provider
and settings.
The control plane must reach the management network, and heads must reach
the internet (packages, the node image's registry) through it. On the
DevStack lab that was a route to 172.24.4.0/24 through the DevStack host,
whose NAT carries the heads out.
## 25.4 Discovery
The site is one node: the project. A cloud does not show a tenant its
hypervisors and does not let it choose them — Nova places — so there is
nothing finer to report. Its size is the project's quota (Nova's absolute
limits), less what is in use; an instance quota reached is shown as a
problem. A quota that cannot be sized — unlimited, no Placement access, no
site limits — makes the site unhealthy rather than offering an unknown
amount.
## 25.5 Authentication
An application credential where the cloud allows them: it is scoped to one
project and can be revoked alone, and Keystone refuses one sent with a
scope, which hpcod does not send. Otherwise a user's password, scoped to the
project by name. A CA file for the cloud's certificates is
`OS_CACERT`.
## 25.6 Connecting another project or cloud from the portal
An installation's first site is set up by `hpcod setup`. Every other
OpenStack project - another cloud, another region, another project on the
same cloud - is *connected* from the portal: **Sites → Connect a site**, as
an administrator. hpcod installs nothing in the cloud but the two images
clusters boot from.
The form is setup's own fields for the kind: the site's id and name, the
login, the management network and the window of addresses on it, the
head-disk choice. What is the installation's - its names, the head nodes'
user and keys, the registry - is taken from `/etc/hpcod/site.env` and not
asked again. The password or secret is typed once; a check keeps it in the
portal's memory for an hour so the form can be corrected and sent again,
and it is never written back into the page.
**Check** logs in and reads, changing nothing:
| Check | Is |
|---|---|
| management window | the site's addresses against every other site's: the same window (shared: cluster ids keep heads apart) or one apart from it, never one overlapping it; a build address that is no one else's |
| login | the project the token is scoped to |
| management network | the network and subnet named, the addresses and the gateway in it |
| port security, flavors, head disks | as setup checks them (25.2) |
| iPXE image | `/usr/lib/ipxe/ipxe.iso` on this host |
| head image | one to copy - another OpenStack site's, built from the roles here - or a note that it will be built in the project |
**Connect** then does the work in the portal, as the service, and shows
its log as it goes: the checks again; the iPXE ISO into Glance; the head
image *copied* from the other site - downloaded once into
`/var/lib/hpcod/images`, checked against Glance's SHA-512 on the way down
and again on the way up - or, where none is current, built in the project
as setup builds it; then the site's files. The site is on the Sites page
at the next discovery, without a restart.
A connected site's files are the portal's, under `/var/lib/hpcod`:
| File | Holds |
|---|---|
| `sites.d/<id>.yaml` | its catalogue entry, read beside `/etc/hpcod/sites.yaml`; written last, so a site is there whole or not at all |
| `secrets/<id>.os_password` | its secret, mode 0600, the service's; the entry refers to it as `file:` |
| `openstack-<id>.json` | its record: images, flavors, the head-disk choice |
| `terraform/template/<id>/` | its environment; `tofu.env` there names the secret's file for Terraform's provider, which reads one fixed variable |
| `sites.d/<id>.log` | each connect's log |
`/etc/hpcod/sites.yaml` is not written. A connected site whose file does not
parse, or whose id `sites.yaml` also has, is left out and logged; it costs
only itself. A change to either is picked up at the next discovery.
To remove a connected site, destroy its clusters, then delete its three
files and its template directory. To test one: `hpcod selftest -site <id>`.
Portal flag: `-connected-sites /var/lib/hpcod/sites.d`, which setup's unit
passes; without it, connecting is off.
## 25.7 Not supported yet
- **Devices.** A cluster asking for passed-through devices is refused: on
OpenStack a GPU is a flavor's PCI alias, and choosing one is not built.
- **Connecting other kinds.** Proxmox, libvirt and bare-metal sites are
set up by `hpcod setup`; only OpenStack can be connected from the portal.
## 25.8 What was run, and what it found
On DevStack in a VM on pve3, from a control plane installed fresh on
another (Debian 13):
| Run | Result |
|---|---|
| `hpcod setup -yes` | every step; images in Glance, checked |
| `hpcod verify` | ready (lab DNS warnings only) |
| `hpcod selftest -compute 2` | built, both nodes idle in Slurm, `srun -N 2` answered by both, destroyed: 13 resources, nothing left |
| the same, after DevStack was rebuilt with Cinder | `setup` chose a volume by itself (`auto`); the head took m1.medium (2 vCPUs, 4 GiB) instead of m1.xlarge (8, 16), booted from a 120 GB volume and saw 119 GB at `/`; passed, and destroyed: 14 resources, the volume among them |
| again, with Cinder's image cache emptied | the volume copied from the image in 1m19s while Terraform waited; passed and destroyed |
| `demo` connected from the portal (Sites → Connect a site) | every check passed; no head image of the roles' revision to copy, so the portal built one in the project, as the service; the site appeared with no restart |
| a third project, `hpc3`, connected from the portal | its head image copied from `demo`'s - 6.5 GB down and up, both checked - in two minutes; `hpcod selftest -site devstack-hpc3 -compute 2` passed on the copy, the build reading the site's secret through `tofu.env`; its head volume took 4m31s, past Nova's 185 seconds, and Terraform waited for it |
What the runs found, all fixed before the run that passed:
- **The first head image was corrupt.** Nova's stop gives a guest about a
minute and then pulls the plug; XFS left 80 files written near the end of
the bake empty, the first-boot unit and script among them. systemd treats
an empty unit as masked, so every head booted, never configured itself,
and never answered. The build now flushes, checks those files, and shuts
the instance down from inside; every backend's bake now ends with a flush.
- **No DNS.** The management subnet had no DNS servers, and on Rocky
NetworkManager owns `resolv.conf`, so a cloud-config `resolv_conf` was
overwritten: the build instance had none, and its first `dnf` failed. The
site's servers are now NetworkManager's global DNS, on the build instance
and on heads.
- **The bake raced cloud-init.** It waited for SSH only; it now waits for
cloud-init to finish too.
- **Glance refused the second head image.** Its 2000 MiB per-project limit
had let the first (6.8 GB) in. Nova makes the image, fails the upload,
and deletes it, leaving only a 404; the error now says what happened and
where to look.
- **Nova gave up on the head's volume.** The first boot from a volume
asked Nova to make it from the image; on LVM, Cinder downloads the 7 GB
image and writes it out, which took 4m21s, and Nova waits 185 seconds.
The head went to ERROR and the volume, which Nova had never attached,
was left in the project outside Terraform's state. The volume is now
the cluster's own resource, which Terraform waits for (up to 30 minutes)
and deletes. Cinder keeps a cached copy of the image, `image-<id>`, in
its own internal project; that is the cloud's, not a cluster's.
- **The head did not fit.** Only DevStack's largest flavor has 120 GB of
disk, and its host had less free; the lab's disk was grown.
## 25.9 On a real cloud
What a production cloud will be the first test of:
- a management network the project does not own: whether its operators let
hpcod choose addresses on it, or a different arrangement is needed (a
dedicated provider network, or floating IPs, which hpcod does not use);
- a fabric on VXLAN rather than Geneve, and an MTU other than 1442;
- iPXE on that cloud's NIC model;
- an application credential login;
- a quota-limited project with flavors of its operators' choosing.