The REST surface, fixed
Two crates are written against this without talking to each other: the API serves it, the console consumes it. Neither may change it alone.
gRPC is the native surface; this is the JSON gateway over the same handlers, so a field that is not here is not in the proto either.
The same surface as a document a program can read is docs/openapi.json
(OpenAPI 3.1), served by a running cell at GET /api/v1/openapi.json without a
token and printed by velstra-cloud-api --openapi. It is generated, never
edited: the collections are the router’s own list, the field shapes are the
console’s form schema, the custom methods are the ones the router dispatches —
and a test fails when the checked-in file is not what the code generates
(VELSTRA_WRITE_OPENAPI=1 cargo test -p velstra-cloud-api --test openapi
rewrites it). Feed it to a client generator or a Terraform provider framework;
this document stays the place the meaning is written down, because a schema
says what a field is called and not why it is derived or what refuses it.
What a gRPC update changes: update_mask
The one place where the two surfaces genuinely differ, and it is not a decoration.
A PATCH carries only what it changes; everything left out stays as it is.
A gRPC update cannot say that: proto3 has no absent scalar, so a field the
caller never touched arrives at its zero value and is byte-for-byte the same
as one they deliberately set to zero. An update carrying a message therefore
means make the object look like this — and a client resizing a guest writes
its cloud-init, its ports and its placement policy at the same time, with
whatever it happened to be holding.
Every Update…Request carries a google.protobuf.FieldMask:
UpdateInstanceRequest {
instance: { meta: { name: "projects/p1/instances/i1" }, spec: { vcpus: 8 } }
update_mask: { paths: ["spec.vcpus"] }
}
Paths are relative to the resource — spec.vcpus, meta.labels — and both
spellings of a step are accepted (spec.memory_mib and spec.memoryMib),
because a generated client whose JSON mapping is lowerCamelCase hands its user
the camel one and neither is a typo. A path that names a branch keeps the
whole branch, as AIP-134 says.
An empty mask means every field the message carries, which is the behaviour every existing client already has — so adding this breaks nothing. It is also the reason to send one.
A path that names a field nobody has is refused, not ignored: a caller who
writes spec.vcpu and is answered OK has been told their change was made. The
question is put to the type, not to the message — a field at its default is
not on the wire at all, and reading its absence as “no such field” made
clearing one impossible, which is the operation a mask exists for. So a
mask may name a field the message leaves unset, and that writes the empty
value:
UpdateImage { image: { sharedWith: [] }, updateMask: { paths: ["spec.sharedWith"] } }
unshares it, where an unmasked update carrying the same message would leave every other field alone and this one too.
Names and shapes
A resource is addressed the way AIP addresses one:
projects/{project}/instances/{instance}
and the HTTP path is that name under /api/v1/:
GET /api/v1/projects/p1/instances/i1
GET /api/v1/projects/p1/instances # list
POST /api/v1/projects/p1/instances # create, id in the body
PATCH /api/v1/projects/p1/instances/i1 # change spec
DELETE /api/v1/projects/p1/instances/i1
Collections, in the order the API serves them: projects, users,
ceph-clusters, instances, migrations, volumes, snapshots,
attachments, networks, routers, floatingips, load-balancers,
subnets, ports, security-groups, images, nodes, enrollments,
pools,
device-classes, backup-targets, backups, backup-schedules, audit,
captures, console-sessions, image-sources, usage,
snapshot-schedules,
maintenance-windows, releases, rollouts, operations, flavors, bgp-peers.
BGP peers: announcing the cell to the router in front of it
bgp-peers are the cell’s own (operator-only, like nodes): one object is one
BGP session from one gateway machine — spec.node — to one router outside the
cell (spec.peer, spec.peerAs, spec.localAs). The gateway’s agent renders
the host’s FRR configuration from it and reports back status.session (FRR’s
own word: Established, Active, …) and status.announced. Two optional
knobs cover the sessions real firewalls insist on: spec.password (TCP-MD5,
RFC 2385 — the same string on both ends; it sits on the spec because nobody
who is not already allowed to write this object can read it) and
spec.multihop (the distance to a peer that is not on the same wire; absent
means directly connected). Each gateway speaks with its own router-id,
derived from the node’s name, so two gateways sharing an AS never present to
the router as one speaker. Deleting the last bgp-peers object naming a
machine silences that machine’s daemon on the next pass — a session does not
outlive the object that made it.
What gets announced is derived, never listed: every external subnet whole,
plus a /32 (or /128) host route for each floating address that names a
port. An address in front of nothing is a reservation and is not announced.
The list is computed from the same objects :explainReach reads, so the
router in front of the cell cannot disagree with what the console says.
Flavors: the size menu
flavors are named machine sizes at cell scope — vcpus, memoryMib,
rootDiskGib, and a sentence of description. Everybody may read the list
(a tenant orders by name, so they must see the menu); only a cell operator may
write it. An instance carrying spec.flavor (either spelling: m1-small or
flavors/m1-small) has the flavor’s numbers copied into vcpus, memoryMib
and rootDiskGib when it is created — and again on any patch that names a
flavor — with the name kept on the object. A patch that types a size instead
takes the name off: a guest labelled m1-small with other numbers inside
would be a label, not a size.
Once the cell has at least one flavor, a tenant’s guest must be sized by
one unless their project carries spec.policy.customSizes — granted by the
cell operator, the same recorded act as policy.floatingIps. A cell with no
flavors has no menu to hold anybody to, and behaves as before.
Narrowing a list by label
Every object carries meta.labels. A list can be narrowed by them:
GET /api/v1/projects/p1/instances?labels=env=prod,tier=web
GET /api/v1/projects/p1/instances?labels=deprecated
Every term must match. There is no “or” — it would need precedence rules, and a filter whose meaning depends on precedence is one people get wrong silently. Somebody who needs “or” runs two searches and can see both answers.
A bare key asks whether the label is there at all, whatever its value. An empty selector matches everything, because that is what “no filter” has to mean: the alternative is a filter box that empties the list when it is cleared, which reads as “nothing here” rather than “no filter”.
A selector matching nothing is an empty list and 200, never an error — “no
guests are tagged that” is an answer, and refusing it would make a typo look
like a broken endpoint.
Filtering is not refusing, and the audit reflects that: narrowing a list
writes nothing, however many objects it skips. audit records somebody who
reached for a thing by name and was told no.
Sharing an image with another project
PATCH /api/v1/projects/p1/images/sha256-golden {"spec": {"sharedWith": ["projects/p2"]}}
PATCH /api/v1/projects/p1/images/sha256-golden {"spec": {"sharedWith": ["*"]}}
* is every project in the cell — how a provider publishes one golden image
instead of copying it into every tenant.
The grant is one-way and read-only. A project it is shared with can read the image and boot from it; it cannot edit, deprecate, retire or delete it. Editing goes through the ordinary authorisation, which knows nothing about sharing.
It grants nothing a person did not already hold: the question asked of each named project is the ordinary “may this caller read images there”, so sharing only says which image their existing access now reaches.
A firewall on a cell with no fabric
A node that is the first hop for its guests (VELSTRA_LOCAL_NETWORK=1) now
puts security-group rules in force itself, as an nftables chain per port. Until
this existed such a cell had one choice: no rules, or no guests — the tap
datapath refused a port carrying rules rather than accepting them and filtering
nothing.
The rules mean the same thing they mean on the fabric:
- A port with no rules is unfiltered.
- A port with any rule is default-deny in both directions, and that rule is the whole of what is allowed. Anything else would mean adding a rule could silently widen a port.
- The answer to something already allowed comes back without a second rule in the other direction.
- A port number in a rule always names the service being reached: ingress 443 is somebody connecting to the guest’s 443, egress 443 is the guest connecting to somebody’s 443.
What each port turned away is reported on the port:
"status": {
"dropped": {
"inboundPackets": 12, "inboundBytes": 800,
"outboundPackets": 3, "outboundBytes": 200
}
}
Absent means nothing is judging this port — no rules, or a datapath that counts elsewhere. Deliberately not zero: zero says “nothing was dropped”, and the truth there is “nothing was judged”. It is the one number that tells a firewall apart from a route and from a service that is not listening.
Narrowing a list by time
Every object carries meta.createdAt, so every collection takes the same
range:
GET /api/v1/audit?since=1h
GET /api/v1/audit?since=1788960000000&until=1788963600000
GET /api/v1/projects/p1/operations?since=7d&until=1d
since and until are either milliseconds since the epoch — the same
number every timestamp in this API is — or a span back from now: 30s,
30m, 6h, 7d. The span form exists because “the refusals of the last
hour” is the question people actually have, and making somebody compute an
epoch to ask it is how a filter ends up unused.
since is inclusive and until exclusive, so two adjacent ranges neither
overlap nor skip. A value that parses as neither is refused rather than
ignored: silently returning the whole audit is the shape where a page loads in
development and times out in production.
On most collections the range is a filter, and costs a walk. On the audit
it is an index: an audit id is {kind}-{minute}-{hash}, so the log is stored
sorted by kind and then by minute, and a range is read by seeking into each
kind’s keys rather than by walking past every record written before it. On a
cell with two hundred thousand records that is the difference between an answer
and a timeout.
Ordering a list
GET /api/v1/audit?since=24h&orderBy=createdAt desc&pageSize=50
Two fields, name and createdAt, each optionally followed by ` desc`. Those
are the two orders every collection has and that mean the same thing in all of
them; sorting on a status field would order half a list by a value the other
half does not carry.
An ordered listing is a top-N, not a pageable ordered stream. The API reads
everything the filter admits, sorts it, and returns the first pageSize of the
sorted order — so “the fifty newest refusals” really is the fifty newest. There
is no nextPageToken: a token is a key in the store’s own order, and following
one would give a list ordered inside each page and unordered across them. When
the answer was cut, the body carries "truncated": true.
orderBy and pageToken together are refused. Ask for a larger
pageSize, or page unordered and sort at the client.
Narrow first. orderBy reads everything the filter admits, so an ordered
request over a large collection should carry a since — on the audit that is
served by a key range and costs nothing (below), while an unfiltered ordered
read of a whole log is exactly as expensive as it sounds.
Asking for only some fields
GET /api/v1/projects/p1/instances?fields=status.phase,status.addresses
A read mask: comma-separated dotted paths, applied to the answer. meta.name
comes back whether it was named or not — a row without its name is one nothing
can be done with, and a caller who forgets it should get a list they cannot
use rather than an error they have to read.
The mask is applied to the finished document, so a computed field can be named:
status.addresses is not in the store.
It works on a single object too — GET /api/v1/projects/p1/instances/i1?fields=status.state
— which is the case a dashboard polling one guest wants: the same answer without
its spec, its conditions and its labels on every pass.
What a volume may take from its pool
A pool is shared and its disks are finite. Two places carry a number, and the split is the design:
PATCH /api/v1/pools/rbd {"spec": {"volumeCeiling": {"iops": 5000, "readMibps": 200, "writeMibps": 100}}}
PATCH /api/v1/projects/p1/volumes/logs {"spec": {"limits": {"iops": 1000}}}
- A volume carries what it asked for. Sizing a database volume differently from a log volume is a legitimate thing to want, and it is the tenant’s to say.
- A pool carries the ceiling. It is the operator’s, it applies to every volume in the pool, and a tenant cannot raise it. Asking for more than the ceiling gets the ceiling, not a refusal — a refusal would make a ceiling somebody lowers break every volume that was already above it.
The default is the part that matters. A volume that names no limit on a pool that has a ceiling gets the ceiling, not “unlimited” — otherwise the lever does nothing, because nobody sets a limit on themselves.
Zero is unlimited in both places, and that is what a cell starts with: nothing here changes behaviour until an operator sets a ceiling.
The settled number is mirrored onto the attachment (spec.limits), which
is the object the node holds — a node is told about neither volumes nor pools.
It is programmed when the disk is opened, so a changed ceiling reaches a
running guest at its next attach rather than immediately.
Snapshot schedules
The cheap half of the pair:
POST /api/v1/projects/p1/snapshot-schedules
{ "spec": { "volume": "projects/p1/volumes/data-1", "everyHours": 1, "keep": 24 } }
A snapshot lives in the volume’s own pool. It is taken in a moment, costs almost nothing, and is the right tool for “let me be able to go back an hour”. It is not a backup: lose the pool and it goes with it. That is why these are two collections rather than one with a flag — a flag is a thing people set wrong, and the consequence only shows up on the day the pool is gone.
The retention rules are the same code as backup-schedules, not a second
copy of them: a snapshot still being taken holds the schedule, only finished
ones count toward keep, at least one always survives, and ones taken by hand
are never expired. A rule written twice is a rule that will eventually be two
rules.
Generated snapshots carry output-only spec.scheduleUid, equal to the creating
schedule’s immutable meta.uid. Cadence and retention use that exact identity,
never a name prefix. Recreating a schedule with the same name does not transfer
ownership of existing snapshots. Clients cannot set, clear or reassign the UID;
restating its unchanged value in an edit is allowed.
Upgrade conservatively: snapshots without this field (manual or legacy)
remain readable and restorable, but no schedule adopts or automatically deletes
them. Review and delete old copies explicitly after confirming their provenance;
do not infer ownership from names such as hourly-*. Upgrade APIs and pool agents
to the schema carrying this field before enabling the updated schedule controller,
so status reports preserve ownership. A schedule missing its own UID reports
OwnerMissing and neither creates nor prunes snapshots.
Networks: logical, or the machine’s own wire
A network is logical by default: the platform allocates its addresses, the fabric — or the node, as a first hop — carries its segment, and its security groups mean something.
An operator may instead put one on a bridge that already exists on the nodes:
POST /api/v1/projects/p1/networks
{ "id": "lan", "spec": { "mtu": 1500, "host_bridge": "br0" } }
Guests on it go straight onto whatever the machine is on. Their addresses come
from whatever serves that wire, so this platform allocates none, holds no
gateway on it, translates nothing out of it, and answers no DHCP — a second
server on one segment is how a guest ends up with an address nobody agrees on.
The metadata service still answers them: a guest on a host bridge reaches
169.254.169.254 on its node like any other neighbour.
Only a cell operator may set it. A tenant asking is refused:
403 { "error": { "code": "PERMISSION_DENIED", "field": "spec.hostBridge",
"message": "only a cell operator may put a network on a host bridge…" } }
A bridge that is not there is refused by the node, on the port, rather than created — making one means deciding what goes in it, and the only useful answer involves the machine’s uplink.
Usage: what a project had, and when
project.status.used says what is in use now, counted from the objects that
exist. It has no memory, so a guest that ran for three weeks and was deleted
this morning is indistinguishable from one that never existed — which is right
for a quota and useless for a bill.
So the present is written down, once an hour, under the project:
GET /api/v1/projects/p1/usage
→ { "items": [ { "meta": { "name": "projects/p1/usage/1787824800000" },
"spec": { "project": "projects/p1",
"at": 1787824800000,
"used": { "instances": 3, "vcpus": 12, … } } } ] }
Ids are the millisecond, zero-padded, so a listing is in time order without an index. Readings are kept ninety days.
A reading is a sample, not a total. Something created and destroyed between two readings is in neither, and is not billed. The alternative is charging from the object lifecycle, which means a counter — and a counter loses a charge for ever when the process holding it dies at the wrong moment, with nothing able to prove afterwards which happened. The interval is the knob; a provider who needs finer than an hour shortens it and pays for the rows.
Written by the controller and by nothing else. They are not creatable, editable or deletable through the API: a usage record that could be changed after the fact is a bill nobody can stand behind.
The month, added up — because forty-nine rows of “at 14:00 you had one guest” are readings, not a bill:
GET /api/v1/projects/p1:explainUsage?month=2026-08
{ "month": "2026-08", "hours": 49, "hoursInMonthSoFar": 744,
"vcpuHours": 49, "memoryGibHours": 49, "volumeGibHours": 196,
"instanceHours": 49, "floatingIpHours": 12,
"loadBalancerHours": 49, "deviceHours": 0,
"snapshotGibHours": 320, "backupGibHours": 0,
"rxBytes": 9182736, "txBytes": 1827364 }
Every dimension the platform counts has a line here. A dimension it tracks on the project and leaves out of this answer is worse than one it does not track: the operator sees a number on the project, no line for it on the bill, and no way to tell a pricing decision from a bug.
rxBytes and txBytes are the one line that is a flow rather than a
level, and tx is the egress every cloud charges for. Each hourly reading
already holds its own interval’s traffic, so the month is the sum of its hours
— no subtraction anywhere, and a gap in the readings is a gap in the bill
rather than a number invented from two ends of it. The node carries each
guest’s totals across a tap that was remade, so a restart or a migration no
longer loses everything since the last reading.
It under-counts by design, in two places, and both err the same way. A guest deleted mid-interval takes its unbilled bytes with it: it is no longer in the sum, so the difference comes out smaller and is clamped at zero rather than going negative. And an hour whose predecessor carried nothing at all bills nothing — otherwise the first reading after this field existed would have put every guest’s whole life onto one hour’s line. A bill that quietly over-charges for traffic nobody can point at is the one nobody forgives.
Each reading is one hour at what the reading says — the industry’s own
arithmetic. month omitted means the current one; a spelling that is not
YYYY-MM is refused. hours is the number of readings, and that is the
honest count: a cell that was down took none, those hours are missing from
the sum rather than invented, and hoursInMonthSoFar is what makes the gap a
number instead of a suspicion. Authorised as a read of the project, so a tenant
sums their own bill and nobody else’s. What the platform deliberately does not
have is prices: metric-hours times a price list is the billing system’s line of
business, and this answer is what it multiplies.
Two families at once
IPv6 reaches a guest by being written into its netplan, which the guest fetches from the metadata service over its IPv4 address. There are no router advertisements and no DHCPv6 in this platform; the address is stated, the same way the v4 one is.
A subnet holds one range, and the fabric’s network holds one range against which it checks every port’s address — so two families means two networks, two subnets and two ports on one guest:
POST /api/v1/projects/p1/networks { "id": "v6", "spec": { "vni": 5006, "mtu": 1500 } }
POST /api/v1/projects/p1/subnets { "id": "v6", "spec": { "network": "projects/p1/networks/v6",
"cidr": "fd00:19:136::/64",
"gateway": "fd00:19:136::1" } }
POST /api/v1/projects/p1/ports { "id": "p6", "spec": { "network": "projects/p1/networks/v6",
"subnet": "projects/p1/subnets/v6" } }
POST /api/v1/projects/p1/instances { "id": "web-1", "spec": {
"ports": ["projects/p1/ports/p4", "projects/p1/ports/p6"], … } }
The subnet’s network must already exist in the same project. A missing,
deleted, or cross-project network is refused at spec.network before a subnet
is stored, rather than leaving a subnet that cannot be provisioned.
The allocator hands out v6 addresses like any other (fd00:19:136::2), and
status.addresses carries both. Each family gets its own default route —
they are different route tables and cannot race, and a guest given a v6 address
with no way off its own link can reach its neighbour and nothing else.
A guest with no v4 address at all cannot reach the metadata service — it listens on a v4 link-local — so it cannot fetch the configuration that would tell it its v6 address. The one mechanism that breaks that circle is a router advertisement, and an advertisement has to come from the machine that holds the gateway.
On a cell whose datapath is the local bridge, that machine is the node, and it advertises: one prefix per v6 segment, on-link and autonomous, so a guest builds its own address and learns its default route without asking anybody. It also answers a router solicitation, which is what a guest sends at boot rather than waiting five minutes for the next unsolicited one.
On a cell whose datapath is the fabric, the gateway lives there and the node holds only a tap — so the node says nothing, because a router claiming a link it does not route is worse than no router. The fabric’s TC egress hook cannot yet enforce inbound IPv6 guest policy. An IPv6 port is therefore refused on this datapath rather than shown as programmed while its protection is incomplete.
What a guest is using
status.usage on an instance, written by the node that runs it:
GET /api/v1/projects/p1/instances/web-1
{ "status": { "usage": {
"at": 1787998635432,
"cpuMs": 1843250, "cpuPercent": 137,
"memoryMib": 7910,
"rxBytes": 9182736, "txBytes": 1827364,
"rxPackets": 12345, "txPackets": 6789 } } }
Counters, plus one rate. The cumulative figures are for a monitoring
system, which takes its own differences and never has to trust this platform’s
idea of an interval. cpuPercent is for a person: 100 is one vCPU
saturated, so a four-vCPU guest can reach 400. It is measured over the
interval since the previous reading, never since boot — an average since boot
converges on a number that stops moving, which is the one shape of graph that
cannot show a problem.
Milliseconds rather than seconds for the CPU counter, because the rate is a difference of two readings: over a thirty-second pass a guest using three percent of one core advances a whole-second counter by zero or one, and the graph is then a square wave.
Three things to know:
- These are the host’s numbers — CPU the kernel charged the guest’s machine, resident memory the host is holding for it, bytes across the wires this node programmed. What the guest believes about itself needs an agent inside it, and no cloud gets that from outside.
rxandtxare named from the guest’s side. The host’s tap sees them the other way round; the swap happens once, on the node.- The field is absent on a guest that is not running, and after a restart the counters begin again. Absence is the answer, never a zero: a zero reads as idle, and idle is something people act on.
Disk read and write come from the VMM’s own monitor — query-blockstats on
QEMU, vm.counters on Cloud Hypervisor — summed across every disk the guest
holds, because a guest with a root disk and two volumes is one guest:
"diskReadBytes": 5368709120, "diskWriteBytes": 1073741824,
"diskReadOps": 40000, "diskWriteOps": 12000
They are the VMM’s answer rather than the host’s, because the host sees a file being written and not which guest disk it was.
A way into a guest: the console
A guest’s serial line is reachable when the network is not — which is the only time it matters. Ask for a console on the instance:
POST /api/v1/projects/p1/instances/i1:console
→ 200 { "session": "projects/p1/console-sessions/console-3f9a2c81",
"ticket": "…", "readOnly": false, "expiresAt": … }
Then open a websocket to the API, which relays to the node holding the guest:
GET /api/v1/projects/p1/instances/i1:consoleStream?ticket=…
Upgrade: websocket
Binary frames are the guest’s bytes in both directions. A caller with Read
but not Write on the project is given readOnly, and what it types is
dropped rather than refused mid-session.
The grant’s encrypted flag describes only the API-to-node connection. Clients
must also check their own WebSocket transport before reporting encryption;
encrypted: true does not make an HTTP/WS browser connection private. The API
relays the stream, so transport TLS is not end-to-end encryption through the API.
The display, over the same door. {"kind": "Vnc"} in the :console body
asks for the guest’s screen instead of its serial line — what a guest whose
kernel has stopped writing to ttyS0 is still showing. The answer has the same
shape, the ticket is spent the same way, and the stream carries VNC’s own
protocol (RFB) instead of raw bytes; the client speaks it. Nothing, {} or
{"kind": "Serial"} is the serial console it always was, and a kind that is
neither is refused rather than read as the default.
One combination is refused at the door: a caller who may only read the guest asking for its screen. The serial relay enforces “may only watch” by dropping what a viewer types; RFB cannot be watched that way — its own handshake is bytes the client sends — so a view-only screen would be a broken screen. The refusal says to use the serial console, which viewers can watch.
The ticket is spent once and expires in a minute. It is minted by the API, stored hashed on the session — every node in the cell may read the cell, and a session carrying the ticket in the clear would hand each of them a way into a guest on somebody else’s machine — and the node that accepts it records the fact so a second connection presenting it is refused.
A console-sessions object is therefore a record rather than something to
create by hand: posting to the collection is possible and pointless, because a
session whose ticket nobody knows opens nothing.
Templates: capture a guest, stamp out copies
Build a guest by hand, get it right, stop it, capture it. Every guest made from the result starts where that one left off.
POST /api/v1/projects/p1/captures
{ "spec": { "instance": "projects/p1/instances/golden",
"label": "debian-13-golden",
"target": "backup-targets/shared" } }
The guest must be stopped. A disk copied from under a running machine is crash-consistent at best — survivable for a backup, which is read once in an emergency by somebody who knows what happened, and not survivable for a template that will be stamped out a hundred times by people who assume it is clean:
409 { "error": { "code": "FAILED_PRECONDITION", "field": "spec.instance",
"message": "…is running, and a disk copied from under a running machine is crash-consistent — which a template stamped out a hundred times must not be. Stop it first. If what you want is a copy of a live guest, take a backup: that is read once, by somebody who knows what happened." } }
It is a resource rather than a call, and that follows from something already
true: an image’s name carries its digest, which is what makes fetching one
verifiable — the agent refuses any image whose name does not. So there is no
name to hand back before the bytes exist. The node copies and reports
status.digest; a controller then creates the image, named
<label>-sha256-<digest> and pointing at file://<target>/<digest>. Any node
that can reach that path can boot from it.
Which image a capture became is computed, not stored: the node owns the
capture’s status and does not create the image, so a field saying “it is over
there” would need a second writer on one object. label and digest are both
on the capture, and a derived link cannot go stale — a capture whose image was
deleted stops naming one instead of pointing at something gone.
Cloning is then what it already was: create an instance with
spec.image naming the captured image. image.spec.sourceInstance records
which guest it came from, so a list of near-identical templates says which is
which.
Audit
audit is not a log of everything that happened. Every successful write
already creates an operation carrying its target, its verb, who asked for it
and when it finished — that is the record of what was done, and a second log
beside it would eventually disagree with it about one afternoon.
What no operation exists for is a request that was refused: nothing is created, nothing changes, and the only trace is a status code somebody else received. That is exactly what a multi-tenant cell is asked about afterwards — who tried to reach another tenant’s guests, and from when. Sign-ins are here for the same reason.
GET /api/v1/audit
{ "items": [ { "spec": { "kind": "refused", "subject": "alice@example.com",
"verb": "read", "target": "projects/p2/instances/i1",
"detail": "…", "at": 1787687886000 } } ] }
detail is the same sentence the caller was given, not a paraphrase — an
audit line an operator has to correlate by hand against what somebody actually
saw is one they stop trusting.
Cell-scoped, and readable by a cell operator, by the person a record is about, and by anybody who may read what it names — nobody else. The first is the fleet’s view. The second is a person answering “did I do that?”, which they can settle without asking an operator. The third is what makes a refusal actionable: a tenant whose own guest was touched may read the line about it.
What none of that gives is the shape this collection could otherwise become: a tenant reading the log whole would learn the names of projects and people that are not theirs, which is the opposite of what it is for.
It cannot be flooded. A refusal is something an attacker can cause at will, so the record’s id is derived from who, what, which verb and which minute — a thousand attempts in one minute collide on create and leave one record. The exact count is lost and the fact is not, which is the right way round.
Nothing expires it. Refusals are rare in a working cell and sign-ins are bounded by how many people there are, so the volume is small — and a record that quietly went away before somebody came looking is worse than a disk they can see filling. Records can be deleted by an operator who has read them.
Backups
A snapshot lives in the volume’s own pool. It is the right tool for “let me be able to go back an hour” and it is not a backup: lose the pool and the snapshot goes with it, at exactly the moment somebody needs it.
A backup is a copy on a backup-target — somewhere that is not the source
pool. That single property is the reason the collection exists, and it is
enforced rather than documented:
POST /api/v1/projects/p1/backups
{ "spec": { "volume": "projects/p1/volumes/data-1", "target": "backup-targets/same-pool" } }
409 { "error": { "code": "FAILED_PRECONDITION", "field": "spec.target",
"message": "backup-targets/same-pool is pools/fast, which is where projects/p1/volumes/data-1 already lives — a copy in the same pool is a snapshot, and is lost with the pool it is in. Back up to a different target." } }
backup-targets is cell-scoped: the storage belongs to the cell. backups and
backup-schedules are a project’s.
A schedule is an intention, never a job queue:
POST /api/v1/projects/p1/backup-schedules
{ "spec": { "volume": "projects/p1/volumes/data-1", "target": "backup-targets/nightly",
"everyHours": 24, "keep": 7 } }
A controller creates a backup when nothing this schedule made is younger than
everyHours, and deletes this schedule’s oldest once more than keep have
finished. Two rules that are not obvious and both matter:
- A copy still being made counts toward “is one recent enough” — so a volume that takes an hour to copy does not have a second asked for every pass, and a copy that is stuck holds the schedule for one interval and no longer.
- Only finished copies count toward
keep, and at least one always survives. A week of failed attempts must not expire the last copy that worked, which is precisely the week somebody will need it. - Copies taken by hand carry no
scheduleand are never expired by one. They are somebody’s decision.
Restoring is making a new volume, never writing one back:
POST /api/v1/projects/p1/volumes
{ "spec": { "sizeGib": 40, "pool": "pools/fast",
"sourceBackup": "projects/p1/backups/nightly-1787687886" } }
sourceBackup sits beside sourceImage and sourceSnapshot — three spellings
of one statement about where a volume came from. An in-place restore would be a
command living in a spec, carried out again on every resync, undoing whatever
the guest wrote in between, forever, with nothing on the object to say it
happened.
device-classes is cell-scoped, like nodes: a class names interchangeable
PCI hardware across the fleet, and defining it per project would be a different
name for the same silicon in every tenancy. What a project controls is
quota.devices — how many passed-through devices its instances may hold.
An instance asks for a class, never a PCI address:
POST /api/v1/projects/p1/instances
{ "spec": { "devices": ["gpu-a100"], ... } }
An address (0000:41:00.0) belongs to one machine, so an instance naming one
could only ever be scheduled there. Two entries of the same class mean two
different devices. A device is offered only when everything in its IOMMU
group is free — a group is the unit of isolation, so it is passed through
whole or not at all — and :explainPlacement says which neighbouring device
stands in the way:
{ "node": "node-b", "why": "NoDevice",
"detail": "no free gpu-a100 here — 0000:41:00.0: 0000:41:00.1 is in the same IOMMU group (17) and is bound to snd_hda_intel; a group is passed through whole or not at all" }
A guest holding one cannot be live-migrated — a device’s state is in hardware and there is nothing to send — and the refusal names the alternative:
{ "node": "node-b", "allowed": false, "why": "HoldsDevices",
"detail": "it holds 0000:41:00.0 — a device's state is in hardware and cannot be transferred; move it with mode Reboot, which stops the guest and gives it the destination's devices" }
Three collections stored beside these are deliberately not served and are on
no path here: credentials (a password hash), sessions (a live bearer token),
and node-credentials (the digest of a per-node agent token). A route that does
not exist cannot leak what it would have returned; signing in and out reach the
first two through the session endpoints below, and a node token is minted at
registration and verified on every request, never listed.
One of them hangs off another object rather than off a project: a snapshot is
created under the volume it copies, at
projects/p1/volumes/data-1/snapshots/nightly. A name is a path, so it is still
listed by any prefix of itself — …/volumes/data-1/snapshots for one volume’s
copies, projects/p1/snapshots for the project’s.
Every resource body is the same three parts, always all three:
{
"meta": {
"name": "projects/p1/instances/i1",
"uid": "…", "generation": 3, "revision": "412",
"placement": { "region": "eu-central", "cell": "cell-1" },
"createdAt": 1786732800000,
"deletedAt": null,
"finalizers": ["node.velstra.io/release"],
"labels": {}
},
"spec": { … },
"status": {
"observedGeneration": 2,
"conditions": [
{ "kind": "Ready", "status": "Unknown", "reason": "Converging",
"message": "the node has not reported on this change yet",
"observedGeneration": 2, "lastTransition": 1786732801000 }
],
…
}
}
status.status is one of True, False, Unknown — never a free string.
Who may do what
A project is the unit of tenancy: everything under projects/p1 is governed
by p1’s bindings, whatever its kind. Resources outside every project — nodes,
pools, the projects collection itself — are the cell operator’s, and the
cell’s operators are named in the cell’s own configuration rather than in any
object. They are the provider; they may do anything anywhere.
The roles
| Role | May | Cannot |
|---|---|---|
viewer |
look at everything in the project | change anything |
operator |
run what is there — start, stop, resize, attach, open a console with a keyboard | bring anything into existence or take it away |
editor |
that, and create and delete | change who may |
admin |
everything, including the bindings | widen what the cell allowed the project |
PATCH /api/v1/projects/p1
{ "spec": { "bindings": [
{ "role": "admin", "members": ["ada@example.com"] },
{ "role": "operator", "members": ["oncall@example.com"] },
{ "role": "viewer", "members": ["audit@example.com"] }
] } }
operator is the rung a platform serving customers needs: the people who keep
an estate running are usually not the people who decide what it consists of, and
before it existed anybody who needed to restart a guest was given the ability to
destroy one.
Changing bindings needs admin — kept apart from everything else so an editor
cannot grant themselves more than they were given. A role name that does not
parse reads as viewer: a typo lands on the least, not the most.
Withdrawing an image
An image is content-addressed and immutable, so one is never replaced — a newer
one is published beside it and families/<family> resolves to that instead. On
its own that leaves the superseded image looking exactly as current as its
replacement on every list, so spec.state says where it is in its life:
Active |
the ordinary state; chosen by family |
Deprecated |
still boots; no longer chosen by family, so new guests land on the newer image while everything pinned to the digest keeps working |
Obsolete |
refused for anything new; guests already built from it are untouched |
spec.replacement names what to use instead, and it is read out in the
refusal:
409 { "error": { "code": "FAILED_PRECONDITION", "field": "spec.image",
"message": "images/debian-13-old has been retired, so nothing new is built
from it. Guests already running on it are unaffected.
Use images/debian-13-new instead." } }
Publishing from an image source does this by itself: the newer image deprecates
the one it supersedes, with replacement pointing forward. Only images that
source published — a hand-made image in the same family is somebody else’s.
Deleting an image is still what reclaims the bytes. The states are the notice period before it.
Publishing an image into the catalogue
An image under a project is that project’s; one under the cell is the catalogue’s, and everybody may boot it. To move one up, name it:
POST /api/v1/images
{ "id": "debian-13-hardened",
"spec": { "from": "projects/p1/images/unser-basis",
"family": "debian-13-hardened", "version": "1" } }
The digest, format, size, source and signature are taken from the image
named by from; anything the caller also sends wins, which is how something
called our-base inside a project becomes something the whole cell recognises.
Saying a field and saying it is empty counts as saying it — "signature": ""
publishes an unsigned copy on purpose. from is a request and not a record: it
comes back empty, because an image that remembered where it was published from
would be one whose source can be deleted.
The signature travels because it is a statement about the digest, and the digest
is what is copied: a copy that lost it would be an unsigned image, which a node
started with --require-signed-images will not boot. It is judged again like
any other create, so a signature that no longer verifies is refused here rather
than stored.
Three things are deliberately not copied. state and replacement, because a
published image starts its own life in the catalogue and a judgement about one
object’s place in a family is not a statement about another’s. And
sharedWith, because a grant is made by whoever holds an image and publishing
makes a new holder — copying it would re-grant projects that holder never chose.
A retired image is not published under another name. from naming an
Obsolete image is refused at spec.from, with the replacement read out, the
same way building a guest or a volume from one is: publishing it would put the
withdrawn bytes back in the catalogue under a fresh, Active name, and
families/<name> would resolve to them.
Nothing is copied and nothing is fetched. An image is content-addressed, so a cell-wide image with the same digest is the same bytes: every node that had them cached still has them, and a guest booting the published image boots what it booted before.
Creating outside a project is a cell operator’s, so publishing is too. Anybody may boot from the catalogue; only the cell may put something in it.
Signed images
spec.signature is an Ed25519 signature over the digest line — the string
spec.digest carries, sha256:<64 hex> or sha512:<128 hex>, no newline —
written as base64, over the spelling as stored rather than a normalised one. The
API judges it at admission under the keys it was started with
(--image-signing-key, repeatable; VELSTRA_IMAGE_SIGNING_KEYS, comma-separated):
- no signature: the image is stored unsigned; whether a node boots it is the
node’s policy —
--require-signed-imagesrefuses it before a disk is made from it, not only before the bytes are fetched. Those are not the same door: an image already in a node’s cache is never fetched again, so a gate on the fetch alone stopped nothing on a cell that had been running; - a signature that verifies: stored;
- a signature that does not verify, or any signature offered to a cell with no
keys:
400 INVALID_ARGUMENTatspec.signature, with the reason.
So a stored signature is a verified one, and the console’s Signature
column reads verified or unsigned and nothing else. A patch that adds a
signature is judged over this image’s one digest — the stored one, or the same
one restated.
The digest is the image’s identity, and a patch does not change it. A patch
naming a different one is refused at spec.digest: every guest built from this
image holds its name, and pointing that name at other bytes would leave
spec.signature standing over a digest nobody signed. Restating what is already
there is not a change, because the console’s edit form carries the field on
every save. A case-only difference is not a change either, which is how an old
object’s spelling gets corrected.
At create the digest is checked for being one — sha256: and 64 hex, or
sha512: and 128 — and stored lowercase. Both matter to the signature: the
message is the digest line exactly as written, so a platform that files one
spelling and signs another is one where a signature quietly stops meaning
anything.
The node agent judges again under its own keys before it fetches, and refuses
an image whose signature fails — or, with --require-signed-images, one that
has none — with the sentence on the guest that needed it. Making a key and a
signature is in docs/operating.md.
Roles the cell writes down
The four rungs say how much somebody may do, over a whole project. That is the right shape for most people and the wrong one for the case every operator eventually meets: somebody who may restart the database machines and must not touch the network. A fifth rung cannot express it — the difference is not how much but what.
roles is a cell-wide collection. A role names verbs and the collections each
one applies to:
POST /api/v1/roles
{ "id": "db-operator",
"spec": { "displayName": "Database operator",
"description": "Restart the database machines, nothing else",
"grants": [{ "verb": "operate", "collections": ["instances"] }] } }
A binding then names it in the same field a rung goes in — one field, never two:
PATCH /api/v1/projects/p1
{ "spec": { "bindings": [{ "role": "roles/db-operator",
"members": ["ada@example.com"] }] } }
Always narrower than a rung, by construction. Every grant names at least one
collection and there is no wildcard: somebody who wants everything has four
rungs already, and a custom role that could mean it would be a second spelling of
admin with no way to tell them apart in a list of who may do what.
administer may not be granted this way. It is about who may, not about
objects, so a role claiming to grant it on one collection would be a lie about
what it does — and the one escalation a role system has to be closed against is
somebody granting themselves the ability to grant.
Being able to act on something carries being able to see it. A grant of
operate on instances implies read on instances — anything else is a
button that works above a screen that shows nothing. It does not imply reading
anything else; reading everything is what viewer is for.
Defining a role is a change to the cell, so it is a cell operator’s. A tenant who could define one could define one granting more than they hold.
Two bindings for one person add up, as they always have. A binding naming a role that does not exist is refused at the door; one whose role is deleted afterwards grants nothing, rather than refusing every request in the project.
Folders: granting a role once instead of forty times
folders is a cell-wide collection above projects. A folder holds a name, a
parent (another folder, or nothing at the top) and the same bindings a project
carries — and a role granted on a folder governs every project under it, at any
depth.
POST /api/v1/folders # { "id": "engineering", "spec": { … } }
PATCH /api/v1/folders/engineering
DELETE /api/v1/folders/engineering # refused while anything is inside it
PATCH /api/v1/projects/p1
{ "spec": { "parent": "engineering" } } # or "folders/engineering"
Either spelling of parent is accepted — bare, like every other cell-scoped
reference the console writes, or in full — and what is stored is the full name.
Roles add up going down. There is no deny and no way for a project to shed a role granted above it. “Who may do this” is answered by reading upward once and taking the union, which is a question a person can hold in their head; a resolution order is not.
A parent that names something which is not a folder is refused, as is one that would put a folder inside itself, as is a chain more than eight deep — a permission check reads every level above the object, so the depth is what one of those costs. A folder that has been deleted grants nothing and ends the walk: a project whose folder was tidied away is a project its own bindings still govern, because an outage caused by housekeeping above somebody is the wrong answer.
Quota and policy do not inherit. They are the project’s own, decided by the cell for that project.
What a project is capped at
Twelve dimensions, every one counted from the objects that exist rather than tracked as a running total — a total that is incremented on create and decremented on delete is wrong the first time either half is missed, and it fails closed.
Asked on both doors. A create is counted, and so is a change: a cap
enforced only at creation is not a cap, and a tenant capped at eight vCPUs
could make a one-vCPU guest and PATCH it to five hundred and twelve. A change
is judged on the object as it would be — the stored spec with the change laid
over it, since a patch carries only what it moves — and the object being
changed is taken out of the sums first, so a project sitting exactly at its cap
may still make a guest smaller.
instances, vcpus, memoryMib |
the guests and what they are made of |
volumes, volumeGib |
volume objects, and the gibibytes they and the guests’ root disks take together |
floatingIps, loadBalancers |
addresses and services the cell has a finite number of |
devices |
passed-through PCI hardware, which exists once and cannot be oversubscribed |
snapshots, snapshotGib, backups, backupGib |
copies, and what they occupy |
Two things about the storage dimensions are worth stating because they surprise people:
- A guest’s root disk counts as volume storage. A project capped at 100 GiB cannot take 100 GiB of volumes and a 40 GiB guest.
- Snapshot and backup gibibytes are counted from what each one turned out to
occupy, which the pool reports afterwards. A new snapshot therefore adds
nothing to the sum at the moment it is asked for: the limit refuses the next
one once the project is already over, which is the honest bound a size nobody
can state in advance allows. The count (
snapshots,backups) has no such caveat.
A limit of zero means nobody set one, in every dimension. It is not a limit of none.
GET /api/v1/projects/p1:explainQuota answers all twelve at once, with what is
left in each and whether the quota or the cell is the binding constraint.
What the cell allows a project
A quota says how much. A project’s policy says what kind, and it is the cell operator’s to set:
PATCH /api/v1/projects/p1
{ "spec": { "policy": {
"hostBridges": ["br0"],
"devicePassthrough": false,
"floatingIps": true
} } }
hostBridges— bridges on the nodes this project’s networks may be put on. Empty means logical networks only. Named rather than a yes/no, because what anybody means by a host bridge is a particular wire.devicePassthrough— whether guests here may be given a GPU or a NIC of their own.floatingIps— whether this project may hold addresses the world can reach.
A project admin may not change it, which is what makes the rest of it worth anything:
403 { "error": { "code": "PERMISSION_DENIED", "field": "spec.policy",
"message": "what a project may reach for is set by a cell operator…" } }
A project created today gets the closed policy. A project stored before the field existed reads as it behaved before — open — because yesterday’s object has to keep meaning what it meant.
The rules a client may rely on
specis writable,statusis not. A PATCH carryingstatusis rejected with 400 and a message naming the field. This is the same rule the store enforces; the API does not get to be more permissive.generationmoves iffspecchanged. A client that PATCHes an identical spec gets 200 and an unchanged generation, not a no-op error.revisionis the ETag. Send it back asIf-Matchto make a write conditional; withoutIf-Matcha write is last-writer-wins and the client said so by omission. On mismatch: 409 with the current revision in the body.- Convergence is
status.observedGeneration == meta.generation. There is nostate: PENDINGanywhere to poll on. A client waiting for a change waits for that equality plus aReadycondition. - Deletion is two-phase and visible. DELETE sets
meta.deletedAtand returns 202 with the object; the object stays listable, with its finalizers, until they are released. A client that wants “gone” waits for 404. - A rule the datapath cannot key on is refused where it is written. The
datapath keys a rule on one protocol and one port, so
protocol: "any", a TCP or UDP rule with no port, and a range wider than 64 ports are refused with a sentence naming what to write instead. They used to be accepted and shown, and then the whole port failed to program and the guest waiting on it never started. - A second subnet on a network the fabric is carrying is refused. The fabric’s network holds one range and checks every port’s address against it; two subnets have no faithful mirror. Adding one used to leave the network quietly unmirrored — working until the next fabric restart. On a cell with no fabric, several subnets per network work and are not refused.
- A create can be retried. Send
Idempotency-Key: <your own string>and the second attempt of the same create is answered with the first attempt’s operation and target, having made nothing new. See below.
Retrying a create
A create that carries its own id is already safe to repeat: the second
attempt answers 409 AlreadyExists, which a client reads as “mine”. A create
that lets the platform pick the name is not — the request that timed out may
have been accepted, and the only way to find out is to look, which is the race
the retry was trying to avoid.
Idempotency-Key closes that. Invent a key, send it on every attempt of the
same create, and:
- the first attempt does the work and remembers the answer;
- a second attempt with the same body is answered with that same answer,
202, plus
x-velstra-idempotent-replay: true, and makes nothing new; - a second attempt with a different body is refused with 409 — a key stands for one create, and answering a different request with somebody else’s object is the failure this check exists to prevent;
- an attempt that arrives while the first is still in flight gets 409
Abortedand should be retried in a moment; - a create that failed does not spend the key, so the corrected retry may reuse it.
Keys are remembered for a day and are scoped to the caller and to what was
being made — the project and the collection the create was aimed at. Two
tenants who pick the same string never collide, and neither do one tenant’s two
scripts: a volume and an instance asked for under nightly-1 are two creates,
and refusing the second would be the API inventing a conflict out of a naming
habit.
An attempt that never came back — the API died between accepting the create and answering it — holds its key for two minutes, not for the day. Past that the next retry takes the key over and does the create, because a key its owner can never spend is an object they can never make. Registering a node or a pool does not take a key at all: its answer carries a credential shown once, which a replay could not return.
POST /api/v1/projects/p1/instances
Idempotency-Key: 4d1f0f2c-1b6e-4a9e-9d3f-6a0b2c8e1a77
Derived fields
A field the platform already knows is not asked for twice. They follow one rule: omitted means the API fills it in, stated means it must agree, and a value that disagrees is refused rather than quietly corrected — rewriting what somebody typed changes what an object says without them asking.
attachment.spec.node is derived from the instance. Omit it at create and
the API copies it from instance.spec.node. State it and it must agree; a value
that disagrees is refused rather than stored, because an attachment whose node
is not the instance’s is a meaningless object — the node it names does not have
the guest, and the node that does is not watching for it, so the volume is never
opened and nothing says why. Derived, that state cannot be written down.
Attaching to an instance that has not been placed yet is a
FAILED_PRECONDITION on spec.node, with the sentence saying so: there is no
node to open the volume on. An interface should show that where the choice is
made, not after the request.
port.spec.node is derived from the guest that uses it. Not by the API but
by a controller, because the answer changes over the port’s life: it is the node
holding whichever instance names the port, taken from instance.status.node —
where the guest is, not where a scheduler decided it should go. A client never
sets it, and a client never needs to.
It exists because it is what makes a port claimable at all. A node may write an
object’s status only when it owns it or when the object is assigned to it, and a
port had neither, so every node’s report on a port it was carrying was refused.
The symptom was quiet and thoroughly misleading: the guest ran, and its port sat
at programmed: false with no tapDevice for ever. A port now reports honestly,
and securityGroup.status.conditions[Applied] above depends on it.
It is derived once, at create. A migration moves the attachment deliberately; nothing follows a guest silently.
migration.spec.fromNode is derived from the instance. Omit it at create
and the API copies it from instance.status.node — the node’s own report of
where the guest is, not spec.node, which is only where it was assigned. Those
two disagree for as long as a handover takes, and the machine that can send a
guest is the machine that has it; naming the assignment would name the wrong
source in exactly the case that matters, a second migration asked for while the
first is still in flight. State it and it must agree; a value that disagrees is
refused with the sentence saying where the guest actually is.
An instance that no node is reporting has no source to move from, and that is a
FAILED_PRECONDITION on spec.instance rather than a migration that no agent
will ever pick up.
snapshot.spec.pool is derived from the volume it copies. A copy is made
where the bytes already are; no backend makes one in a pool that does not hold
the original. Stated and disagreeing is refused on spec.pool, with a sentence
naming the pool the volume is really in.
A volume made from a snapshot takes spec.pool and spec.sizeGib from it.
Both are omitted-means-filled-in as above, with one relaxation, stated here
because it is the only one in this document: sizeGib must be at least the
snapshot’s size rather than equal to it. A volume is grown, so asking for a
larger one at the moment it is created is an ordinary thing to want; asking for a
smaller one is the clone not fitting into what it is written into, and that is a
FAILED_PRECONDITION on spec.sizeGib.
port.spec.address and port.spec.mac are filled in after the create, not
during it. They are the one pair in this document that is derived by a
controller rather than by the API, and the difference is visible to a client:
a POST returns a port with both fields null, and they appear a moment later.
That is deliberate. Whether an address can be given depends on objects other
than the port — the subnet may not exist yet, or may be full — and none of those
are reasons for the create to fail. A port whose subnet arrives second would
otherwise have to be created twice. So the port exists immediately, and until it
has an address it says why on itself: Ready=False with reason NoSuchSubnet,
SubnetNotAddressable or SubnetFull, and a sentence naming what to change.
Stating either field is allowed and is never overruled — an operator who picks
10.20.0.99 keeps it. An address is only ever filled in, never moved: a port
whose address changed under a running guest is an outage with no error message.
The MAC is derived from the port’s uid, so a write that was lost and retried
produces the same NIC rather than a new one.
A client waiting for a usable port waits for spec.address to be non-null, the
same way it waits for anything else here — there is no ALLOCATING state.
Computed fields
Six fields are answered on every read and stored nowhere, so none of them can disagree with the world they describe:
operation.status.done— from the target’s convergence.migration.status.conditions[Moved]— from the migration and the instance together, including its deadline. A migration whose destination agent has died can write nothing at all, and that is precisely when somebody needs to be told it timed out.image.status.cachedOn— from what each node reports innode.status.images. Which nodes hold an image is an aggregate, and an aggregate is not a fact anybody owns: a list on the image would need every node in the cell writing into one field, which is the shared mutable list the one-writer rule exists to forbid. Each node says what it holds; the API adds them up.instance.status.pendingChanges— what a running guest has been asked for and will only get at its next start, fromspecagainststatus.runningSize. Absent, not empty, when there is nothing pending. Resizing a running machine is ordinary; what was not ordinary is that nothing said so, and a spec reading as applied while the guest ran on the old numbers is a disagreement no screen showed.node.status.pciDevices[].groupWith— every device sharing an IOMMU group with this one, frompci::group_members. Passing one device through takes its whole group;pci::offerablealready refuses an unsafe assignment, and this is the sentence before the decision. Computed rather than left to a client because a device with no group is answered as being alone: grouping by equal group number would instead collect every un-isolatable device into one imaginary group, which reads as “these come together” when the truth is that none of them can be passed at all.securityGroup.status.conditions[Applied]— from the ports that name the group. Same shape as the one above: nothing about a group is a fact any single writer owns. Each port reports whether its own node has it in force, and the API adds those up;observedGenerationfollows only once every one of them has caught up, so a group whose rules were just changed does not claim to be in force before any port has re-read it. A group nothing references isApplied— vacuously, and truthfully: there is nothing for it to wait on.
A client reads all three as ordinary fields. What it may not do is PATCH one —
they are status, and status is not writable.
lastTransition on a computed condition is not an age. A stored condition
keeps the moment it changed; a computed one is built during the request, so its
lastTransition is the moment of that read. Rendering it as “changed 2s ago”
would put movement on a transfer that stalled an hour back. There is one
exception, and it is anchored because the moment is genuinely knowable: a
Moved condition with reason Timeout carries createdAt + timeoutS, which is
accurate to the minute and worth showing. For every other computed condition,
show the message and leave the time alone.
Where a guest goes
Nobody has to make a port. A port is a join — this guest, that network, this address — which is right in the model and wrong in a form. Asking for one machine used to mean creating a network, a subnet on it, and a port on that, in that order, before the guest: four objects and a dependency order, none of which the person wanted.
So an instance is created with spec.networks, and the platform mints the ports:
POST /api/v1/projects/p1/instances
{ "id": "web-1", "spec": { "image": "families/debian-13", "vcpus": 2,
"memoryMib": 4096, "rootDiskGib": 20 } }
- Nothing named — the guest joins the project’s default network, made the
first time somebody needs one, with a
/24derived from its VNI so two cells restoring from a backup cannot hand the same range to different tenants. Two machines in a project can talk without anybody configuring anything. networks: [...]— one port per entry. An entry is a network, or one of its subnets when the network is not a complete answer. Both are answers to “where does this guest go”, the same wayimagetakes a family or a concrete build.ports: [...]— the explicit path, for an address that has to outlive the machine. Naming bothnetworksandportsis refused rather than merged: they are two answers to one question.ports: []— a guest on no network, said out loud. Different from saying nothing.
networks is consumed: what is stored is ports. Two fields describing one
set of interfaces is two fields that drift.
A network is a complete answer exactly when it has one subnet. With none, a port on it could never be given an address, and the create says so. With more than one, naming the network does not say which range the address comes out of, and the create refuses listing the subnets and their ranges rather than taking whichever came first:
POST /api/v1/projects/p1/instances → 400 FAILED_PRECONDITION
{ "error": { "field": "spec.networks", "message":
"`projects/p1/networks/prod` has more than one subnet, so naming it does not
say which range this guest's address comes out of. Name the subnet instead:
projects/p1/subnets/prod-a (10.20.0.0/24), projects/p1/subnets/prod-b (10.21.0.0/24)" } }
The same argument one layer over gives an instance spec.volumes: a disk list
rather than attachments made by hand. Unlike networks it is kept, not
consumed — taking an entry out is how you detach, and a field that emptied itself
could not express that.
Networking, from the guest’s side
Two things a guest talks to are not part of this REST surface at all, and they are described here because what they say is built entirely out of objects that are: both run on the node that runs the guest, and both answer only for the guests on that node. A cell’s control plane can be down, and a node that is up still tells its own guests who they are.
The metadata service, 169.254.169.254:80. A guest is identified by the
source address of its connection — an address this node programmed onto its
port. Nothing in the request selects an answer: no token, no header, no
parameter, so there is no request one guest can make that asks about another.
An address the node does not run gets a 404, the same answer as a path that does
not exist.
The paths are EC2 IMDS, which is what an unmodified cloud image probes with no configuration:
/latest/meta-data/instance-id projects/p1/instances/i1
/latest/meta-data/hostname i1
/latest/meta-data/local-ipv4 the address it is asking from
/latest/meta-data/mac that NIC's MAC
/latest/meta-data/public-keys/0/openssh-key
/latest/meta-data/network/interfaces/macs/<mac>/local-ipv4s
/latest/meta-data/network/interfaces/macs/<mac>/subnet-ipv4-cidr-block
/latest/user-data instance.spec.userData
The same facts are written to a read-only NoCloud cidata drive — meta-data,
user-data and network-config — and remain available at the three flat HTTP
paths. The local seed is required for first boot: a guest cannot fetch the
network configuration that gives it networking over a network it does not have
yet. The HTTP service remains useful after that first configuration. Both
renderings come from one document, so they cannot disagree.
network-config matches interfaces by MAC and states addresses rather than
dhcp4: true, so a guest whose DHCP client is slow, disabled or replaced still
comes up on the network it was given.
DHCP, on each guest’s tap. The node answers DISCOVER and REQUEST with the address the port already carries: mask and gateway from the subnet, resolvers from the subnet, MTU from the network, hostname from the instance. A guest is identified by the pair (tap it arrived on, MAC in the packet) — it can forge the MAC, but not which tap the frame came out of, so a spoofed neighbour’s MAC finds no binding at all.
There is no lease anywhere. The binding is the Port object and nothing
else; an ACK writes nothing, and the answer is re-derived from the objects each
time it is asked for. That is why a port that was deleted stops being answered
for immediately, why a node restart loses nothing, and why there is no
leases collection in this API. A REQUEST for an address that is not the
port’s is answered with a NAK naming the one that is.
Security groups
A port names its groups in spec.securityGroups, by resource name. A group is a
list of rules, and a rule is one allowance:
{
"direction": "ingress",
"protocol": "tcp",
"ports": { "from": 443, "to": 443 },
"remote": { "cidr": "0.0.0.0/0" }
}
Four things a client may rely on:
- Ingress is denied, egress is allowed, replies are always allowed. Rules only add allowances. There is no deny rule and no ordering, so two groups on one port cannot contradict each other and “which rule won” is not a question.
remoteis either acidror agroup. A group remote — “anything inwebmay reach me” — is resolved to the addresses its members hold at the time of the pass, so it keeps working as guests come and go, and it is never stored anywhere. Membership does not chain: namingwebadmits the ports inweb, not whateverwebitself admits.- A group with no members admits nothing, which is emphatically not the same as admitting everything.
- Naming a group that does not exist is not an error. Rules only add allowances, so a missing group is strictly fewer of them — the safe direction — and the port keeps working rather than a typo costing a guest its network.
On a fabric cell, the guest tap uses separate defaults for each interface direction: guest-originated traffic passes by default, while unsolicited traffic entering the guest is denied. Cloud reverses its guest-relative rule directions when programming Fabric’s interface-relative hooks. DHCP replies are a narrow exception so the guest can acquire its assigned address.
The node-local metadata service currently identifies a guest by its source IPv4 address and installs one host return route per guest. Two guests with the same IPv4 address cannot safely share a node, even if their fabric networks have different VNIs: the node refuses programming a second port when the address already has a return route. If ambiguous guest views nevertheless exist, its DHCP and metadata responders answer for neither. Supporting overlapping tenant addresses on one node requires per-network routing and metadata isolation; VNI separation alone does not provide that host boundary. The node also refuses an address that would replace one of its own local, connected or specifically routed prefixes; only its default route may be superseded by the guest’s return route. It tags its own return routes so a restarted agent can recover them and port deletion cannot remove an operator’s route merely because it names the same tap.
A rule whose port range is set on a protocol that has no ports, or that runs
backwards, or whose cidr is not a prefix, is refused on write with the index
of the offending rule in the error’s field.
Storage
A volume lives in a pool — spec.pool — and the pool is what reports on it.
That is the same two-field ownership as an instance and its node, and it is why
volume.status.pool exists: spec.pool is the ask, status.pool is the pool
that has claimed it. A volume whose status.pool is null has not been picked up
by anything, which usually means no agent is running for the pool it names.
Pools are an ordinary collection. spec.backend selects the requested backend
and spec.backendTarget its destination; status.backend reports what the agent
is actually running. status.allocatedGib is counted from the volumes in the
pool rather than tracked as a total.
Two behaviours a client may rely on:
- A volume is grown, never shrunk. A
sizeGibsmaller than the current requested or provisioned size is rejected with HTTP 400 and a field-specific error. The agent also refuses shrink requests encountered in existing state. Shrinking would destroy whatever is past the new end, and no request makes that recoverable. - Deleting waits for the pool.
DELETEreturns 202 and the volume stays listable, carryingpool.velstra.io/release, until the pool reports it holds nothing of it. A volume that vanished from the API while its pool still held the gigabytes would be storage nobody is billed for and nobody can find.
Snapshots
A snapshot is a point-in-time copy of a volume, in that volume’s own pool, and it is created under the volume:
POST /api/v1/projects/p1/volumes/data-1/snapshots → 202
{ "id": "nightly" }
GET /api/v1/projects/p1/volumes/data-1/snapshots/nightly
{ "meta": …, "spec": { "pool": "pool-a" },
"status": { "taken": true, "sizeGib": 100, "takenAt": 1786732800000, … } }
The source is in the name, and there is no field for it. Which volume a copy
came from is the one thing about it that must never change — a snapshot
repointed at another volume is a restore that quietly hands back somebody else’s
data — and a name cannot be patched. It is also why a copy is created under a
volume rather than in a collection of its own: a POST to
projects/p1/snapshots is refused on meta.name, with the shape that works.
status.sizeGib is the logical size of the copy: how large the volume was
when it was made, and therefore the smallest volume that can be made from it.
It is not what the copy occupies in the pool — a delta grows as the volume it
was taken from moves on, and that is a billing question this API does not answer
yet. For the same reason a snapshot does not count against a project’s
volumeGib quota: quota is counted from what was asked for, and nobody asks for
a snapshot’s size.
Four behaviours a client may rely on:
- A snapshot is taken once and never again. A volume that vanished from its
pool is created again on the next pass; a snapshot that vanished is not. A
copy made now is a copy of a different moment, and it would be restored under
the name of the one somebody wanted. It reports
Ready=Falsewith reasonVanishedand stays that way until it is deleted. - A copy is refused before it costs anything. Of a volume whose pool has not
provisioned it yet — there is nothing to copy — or of one that is being
deleted, which the copy would pin forever. Both are
FAILED_PRECONDITION, answered before the object exists. - The source may not go first. A snapshot is a delta against the volume it
came from on every backend this platform speaks to, so deleting the volume
would make the copies unreadable — silently, at the moment somebody deletes
something they believe they have backups of.
DELETEon a volume with snapshots returns 202 as always, and then the volume stays: it carriessnapshot.velstra.io/sourcealongside the pool’s finalizer, and the pool destroys nothing while it can still see copies, reportingReady=Falsewith reasonSnapshotsDependOnItand how many are in the way. Delete the snapshots and the volume goes by itself. Nothing cascades: this platform does not delete objects an operator did not ask about. - Restoring is creating a volume, not writing one back. There is no
restore verb and no
RestoreSnapshotRPC. A volume is created withspec.sourceSnapshotset, and the clone is part of creating it — so there is no pass in which the new volume exists blank.
POST /api/v1/projects/p1/volumes → 202
{ "id": "data-1-restored",
"spec": { "sourceSnapshot": "projects/p1/volumes/data-1/snapshots/nightly" } }
A PATCH that sets spec.sourceSnapshot on an existing volume is refused,
on spec.sourceSnapshot, with a sentence saying to create a volume instead.
That refusal is the shape of the whole decision, so it is worth stating why: an
in-place restore is a command, and a command that lives in a spec is carried
out again on every resync — the second time undoing everything the guest wrote
since the first, with nothing on the object to say it happened. The alternative
was a Restore resource of its own, the way a migration is one; it would work,
and what it buys over sourceSnapshot is keeping the volume’s name — which is
what attachments point at. That is a real cost and it is paid deliberately:
re-attaching a new volume is a visible, reversible step, and overwriting a
volume a guest has open is not. spec.sourceImage is refused on change for the
plainer reason that nothing would be re-cloned, so the field would start
describing a volume that does not exist.
A volume comes from one place: naming both sourceImage and sourceSnapshot is
a FAILED_PRECONDITION. So is naming a snapshot that has not been taken yet, or
one held by a different pool than the volume would live in — no backend clones
between pools behind a single command.
Load balancers
One address in front of many ports, served by the fabric’s own L4 balancer: flows are DNAT-rewritten at the ingress host with connection tracking and reverse NAT, so there is no appliance to place and no machine that owns the object — its status is written by the controller, like a router’s.
{ "spec": {
"network": "projects/p1/networks/prod",
"subnet": "projects/p1/subnets/prod-a",
"vip": "10.20.0.20",
"listeners": [ { "protocol": "Tcp", "port": 443, "memberPort": 8080 } ],
"members": [ "projects/p1/ports/web-1-eth0",
"projects/p1/ports/web-2-eth0" ],
"sessionAffinity": false,
"draining": [ "projects/p1/ports/web-2-eth0" ] },
"status": {
"vip": "10.20.0.20",
"listeners": [ { "protocol": "Tcp", "port": 443,
"members": 2, "draining": 1 } ], … } }
What a client may rely on:
spec.vipis derived like a floating IP’s address. Omitted, a controller fills in the lowest address nothing else holds — the same counting the ports and the floating IPs use, so no two holders ever share an address. Stated, it is kept and never overruled.status.vipis the observed half: the address the fabric actually serves, empty until it does.- A listener is
protocol(TcporUdp— the datapath balances no others), theportthe VIP answers on, andmemberPort, the port the members answer on;0or omitted keeps the client’s own destination port. A listener on port 0, or two listeners claiming oneprotocol/port, is refused on write with the index of the offending listener in the error’sfield. A load balancer with no listeners is accepted and waits, reportingReady=Falsewith reasonIncomplete— the same shape as a router with no networks. membersnames ports, not addresses, so a migrated guest stays in the pool, and a member can never point at an address nothing serves. Empty is a drained pool — a legitimate state to hold an address in. A member that does not resolve yet (no such port, not placed, not programmed) holds the whole pool back withReady=FalsereasonMembersNotReadynaming it; the fabric is never programmed with part of a pool, because a pool serving three of its four members looks balanced and silently leaves one out.drainingnames members being taken out of service. They take no new connections and keep the ones they have until the clients finish — which is the difference between draining a member and removing it, because removing it cuts its connections mid-request. Every name indraininghas to be one ofmembers; one that is not is refused on write, because a name sitting there matching nothing looks exactly like a member that has finished draining. Draining can empty the pool, unlike a failed health check: it is an instruction rather than an observation, and an operator draining everything is asking the service to stop.status.listeners[].drainingcounts them, so a drain that took can be told from one the platform ignored.sessionAffinitysends every connection from one client address to one member, instead of spreading each connection on its own — for a service keeping something per client between connections. The cost is stated because it is easy to ask for by accident: one client is one member, so a pool fronting few busy clients spreads worse, and everyone behind one NAT is one address and so one client. Turning it on or off moves clients exactly once.- There are still no weights and no health-check policy — deliberately.
This API does not carry a field nothing reads: a weight the console displayed
as if it biased traffic would be the unverified-signature defect over again.
status.listeners[].membersis a count of what is programmed, emphatically not a health verdict. Affinity and draining arrived under the same rule and the other way round — with the datapath code that honours them, in both datapaths, or they would not be here. - An older fabric says so. A cell whose fabric predates these two fields accepts the service and ignores them, and answers a list with nothing where they belong — which is how the controller can tell “off” from “not understood”. It programs the listeners and says in the condition’s message that connections are spread over the whole pool as if neither had been asked for, rather than reporting a binding no packet obeys.
- Deleting waits for the fabric.
DELETEreturns 202 and the object stays listable, carryingfabric.velstra.io/release, until every fabric service has been retired — an address that kept answering after its object vanished would be traffic arriving somewhere nothing can explain. - Quota: a project’s
quota.loadBalancerscaps how many a project may hold, counted from what exists like every other dimension, and refused withRESOURCE_EXHAUSTED.
The address is the cell’s, not the world’s
A balancer’s VIP is reachable from inside the cell. A public address in front of a service is not yet a thing this platform does, and the shape of the gap is worth stating exactly, because two of the three pieces are already there and it is easy to conclude from that it works.
What does work: a load balancer may name an external network and take its VIP from one of its subnets, and it is given one — counted against the same pool the ports and the floating IPs draw from, so it is a real address nothing else holds, inside a prefix a gateway node is already announcing. What does not work is the last hop. Neither datapath will hold that address:
- The node’s own balancer puts a VIP on the bridge for the VIP’s subnet,
and builds that bridge only for a subnet one of its guests is on — holding
the gateway address of the segment while it does. For an external subnet
that would be this node claiming to be the upstream router of somebody else’s
network, which is the same thing it refuses to do for a network on a host
bridge. It declines, and the balancer reads
Ready=Falsewith reasonNoDataPlanesaying no node is answering — which is true, and is the whole of what it can say. - The fabric associates a floating IP to a
port_idand a fixed address — one guest interface. A service has no port; its VIP is not an interface anything holds. Translating a public address onto a VIP means a second NAT in front of the balancer’s own, and that is fabric work.
So today a public service is a guest with a routed floating IP — the guest holds the public address itself and answers for it — and a balancer in front of several guests serves the cell. Do not read the accepted external VIP as more than it is: the object is honest about it in its condition, and this paragraph exists so the plan is not mistaken for the feature.
Like security-groups, this collection is served on the JSON surface only;
there is no gRPC service for it yet.
Where a balancer actually balances
Two datapaths, two answers, and the object says which:
- With a fabric, the controller programs one fabric service per listener and the fabric balances wherever the packet arrives.
- Without one — the local-bridge datapath, the single box that is a whole
cell — each node holds the balancer’s address on its own bridge and forwards
connections to the members it carries. It says so in
status.balancers, and the balancer’s own condition readsServednaming those nodes, orNoDataPlanewhen nothing is answering.
The second was nothing at all until recently: a balancer on a fabric-less cell took an address, said nothing and forwarded nothing, while being in the model, on the console, in this document and in the API.
It does not terminate TLS, and that is a decision. The stream is passed
through byte for byte and whichever guest receives it presents the certificate —
which is what a network load balancer is, and what AWS’s NLB does. Terminating
would mean this platform holding a tenant’s private key, and it has nowhere safe
to hold one: it refuses encryptionKey for exactly that reason and would be
contradicting itself. So a public HTTPS service is a balancer with a Tcp
listener on 443 and a guest that speaks TLS:
{ "spec": { "listeners": [ { "protocol": "Tcp", "port": 443, "memberPort": 443 } ],
"members": [ "projects/p1/ports/web-a", "projects/p1/ports/web-b" ] } }
sessionAffinity and draining mean the same thing here as on a fabric, and
are honoured the same way: a draining member is left out of the rotation while
its open connections keep being spliced, and affinity picks the member from a
hash of the client’s address instead of a counter — the same bytes hashed the
same way the fabric hashes them, so a service that moves between datapaths moves
its clients once rather than reshuffling them.
TCP only. This balancer accepts a connection and splices it, and there is
no such thing for UDP — so a Udp listener is left out of what this node
serves rather than bound as TCP, and the balancer’s condition names the nodes
that do serve it. On a fabric cell both protocols are programmed.
Two more things it does not do, stated so nobody looks for them: it balances only across members on the node holding the address — without a fabric there is no path from one machine to a guest on another, so a member elsewhere is one that node could not reach — and it is round robin, with no weights and no least-connections. Both are real things and neither is worth pretending to have.
The member sees this node, not the client. The connection is opened by the
node agent, so a member reads the node’s own address on the segment as its
peer. The client’s address is still what picks the member under
sessionAffinity — the balancer knows it even though the member does not.
Preserving it means transparent proxying (a routing rule, IP_TRANSPARENT, and
a reply path this process does not own), which is fabric work.
The member’s security group is consulted anyway. Because the connection is node-originated it never crosses the hook a member’s own firewall chains are on, so a client the member’s rules deny would have reached it through the VIP. The balancer is the last thing that still knows the client, and it asks the member’s ingress rules itself before handing over a connection: a member whose rules do not admit the client is skipped, exactly as one that refuses the connection is. On a fabric cell the fabric enforces the port’s group wherever the packet arrives, and this does not apply.
Long-running operations
Anything that cannot finish inside the request returns an operation, AIP-151:
POST /api/v1/projects/p1/instances → 202
{ "operation": "projects/p1/operations/op-7", "target": "projects/p1/instances/i1" }
GET /api/v1/projects/p1/operations/op-7
{ "meta": …, "spec": { "target": "…", "targetGeneration": 1, "verb": "create" },
"status": { "done": false, "error": null, … } }
While an operation is pending, done is computed from the target’s convergence.
The controller stores the first terminal result, including any error, so a
later request on the same target cannot rewrite the outcome of an earlier one.
Migrations
What has to be true before a guest can move at all
A migration transfers memory. It does not transfer disks. A guest’s root disk
is a file in the node agent’s state directory, and the destination starts the
guest’s own VMM with -incoming — which opens that disk before anything arrives.
So a guest whose root disk is private to the machine it is running on cannot
arrive anywhere, in any mode: Reboot starts it on the destination, where its
disk is not either.
A cell where machines share one state directory — one NFS export, one Ceph
filesystem, mounted at the same path by every node — is a cell where all of this
works. Nothing on a machine can tell a local filesystem from one mount of a
shared one, so the agent is told, with --shared-state, and reports it as
node.status.sharedState.
Both ends have to say it. A migration between machines that do not is refused before anything is started:
POST /api/v1/projects/p1/migrations → 400 FAILED_PRECONDITION
{ "error": { "field": "spec.toNode", "message":
"node-a keeps guest root disks on its own filesystem, and moving a guest does
not move its disk. …" } }
:explainMigration answers RootDiskIsNotShared for every candidate node, and a
node being emptied — by spec.evacuate or by a maintenance window — strands its
guests with that reason rather than creating migrations no destination could ever
complete.
Not yet built: copying a guest’s disk as part of the move, which is what would let a cell on local storage migrate at all.
Moving a running guest to another node is a resource, not a state on the
instance. There is no MIGRATING anywhere to poll on, for the same reason there
is no PENDING: a controller that dies mid-flight would leave it set forever,
and somebody would have to decide by hand whether the guest is on the old node,
the new one, or both.
POST /api/v1/projects/p1/migrations → 202
{ "id": "m1", "spec": { "instance": "projects/p1/instances/i1", "toNode": "node-b" } }
mode (Live, PostCopy, Reboot), downtimeMs, timeoutS and
connections may be given; omitted, they are the model’s defaults — live
pre-copy, a 300 ms final pause, an hour, one stream — never zeroes.
Reboot is not a transfer. No receiver is opened and nothing crosses a
wire: the source stops the guest, lets go by the same handover every mode uses,
and the destination starts it from the same disk. downtimeMs and connections
say nothing about one. timeoutS does: it is how long the guest is given to
shut down politely. Stopping it is an ACPI power button — a request — and a
guest that ignores one would hold the migration open for ever, so when the time
is up the source takes it down and says so.
That is what makes it the mode for a fleet of unlike machines. A live move
carries the guest’s memory across while it runs, so a processor it has already
been told about has to keep working; a guest that is stopped and started reads
the CPUID it is given like any freshly booted machine. So Reboot crosses
processors — and carries a guest holding hardware — where Live refuses both.
The price is stated and not hidden: the guest is off for the length of a boot.
Creating one refuses anything that cannot work, before a byte moves:
the destination is draining, has less free memory than the guest, does not hold
the image, or runs an agent too many versions away. Each is a
FAILED_PRECONDITION naming the field an operator would change — spec.toNode
for a destination that cannot receive, spec.instance for a guest that is not
running — with a sentence saying which node lacks what. Nothing is created when
one of those answers comes back. This is the point: the far end refusing after a
gigabyte of memory has been copied is the same refusal, an hour later.
Creating one changes nothing about the instance. The migration is an ask;
the instance keeps its node until the source reports that the guest has left it,
and only then does a controller move instance.spec.node. That is the single
moment of handover, and it is why a failed transfer costs nothing: under
pre-copy the guest is still running on the source.
What it is doing arrives as a Moved condition that is computed on read and
never stored — the same rule as an operation’s done, and for the same
reason. It is a judgement about another object: the instance running on the
destination is the whole definition of finished. A stored copy could go stale,
and the case it goes stale in is the worst one — a migration whose destination
agent has died cannot write anything, and that is precisely when somebody wants
to be told it timed out. Computed, the answer comes from the process being
asked:
reason |
status |
what it means |
|---|---|---|
PreparingReceiver |
Unknown |
the destination is not listening yet |
Transferring |
Unknown |
memory is moving; status.transferredMib says how much |
HandingOver |
Unknown |
the source has let go, the destination has not claimed it yet |
Arrived |
True |
it is running on the destination |
Timeout |
False |
it did not finish within spec.timeoutS, and it says where the guest is now |
NoSuchInstance |
False |
the instance it names does not exist |
Arrival beats the clock: a guest that landed a second after the deadline
landed. Anything else in status.conditions is stored, and is the destination
reporting on itself — that it could not bind a receiver, say. Moved is never
among those, so a client must read it from a GET, a list or a watch event
rather than expect it on an object it wrote.
Timeout is a report, not a repair: nothing is moved back, because nothing was
moved. The deadline that actually stops a transfer is spec.timeoutS, handed to
the hypervisor with the send. Abandoning a migration is a DELETE, which tells
the source to stop sending and the destination to tear its receiver down; the
guest stays where it is.
Watching
GET /api/v1/projects/p1/instances?watch=true&fromRevision=412
Server-sent events, one JSON object per event:
data: {"type":"PUT","resource":{…}}
data: {"type":"DELETE","name":"projects/p1/instances/i1","revision":"460"}
A client lists first, notes meta.revision of the newest object (or the
X-Velstra-Revision header on the list response), then watches from it. Nothing
between the list and the watch is lost.
Errors
{ "error": { "code": "FAILED_PRECONDITION", "message": "…", "field": "spec.vcpus" } }
code is one of INVALID_ARGUMENT, NOT_FOUND, ALREADY_EXISTS,
FAILED_PRECONDITION, ABORTED (revision conflict), RESOURCE_EXHAUSTED
(quota), PERMISSION_DENIED, UNAUTHENTICATED, INTERNAL. message is a
sentence for a person; field points at the offending path when there is one.
Explain
Placement failures are answerable, not greppable:
GET /api/v1/projects/p1/instances/i1:explainPlacement
{ "placed": null,
"rejected": [ { "node": "node-a", "why": "InsufficientMemory", "detail": "4096 free, 8192 wanted" },
{ "node": "node-b", "why": "NoNumaNodeFits", "detail": "8192 wanted" } ] }
So are the destinations a guest could be moved to, answered per node and before anything is created:
GET /api/v1/projects/p1/instances/i1:explainMigration
{ "from": "node-a", "mode": "Live",
"destinations": [ { "node": "node-a", "allowed": false, "why": "AlreadyThere",
"detail": "it is already on node-a" },
{ "node": "node-b", "allowed": true, "why": "", "detail": "" },
{ "node": "node-c", "allowed": false, "why": "DestinationLacksImage",
"detail": "node-c does not have projects/p1/images/sha256-3f9a2b" } ] }
Every node gets a verdict, including the one the guest is on: a console
greys out what cannot work before the click, and a destination missing from
the answer is one it cannot decide about. The verdict is the same function the
create runs, so the two can never disagree. why is a stable token
(AlreadyThere, NotRunning, NotFromThere, DestinationDraining,
DestinationTooSmall, VersionsTooFarApart, DestinationLacksImage) and
detail is the sentence; both are empty on a destination that is allowed.
Asking creates nothing and writes nothing.
?mode= picks which move is being asked about — Live (the default, and
what a console’s picker opens on), PostCopy or Reboot — and the answer echoes
it back, because it is only true of one of them. The modes refuse different
things: a cold move crosses processors and carries a guest holding hardware,
where a live one can do neither. This used to answer for Live and nothing else,
so a fleet of unlike machines was told its guests could not move at all when
every one of them could, with a restart. A mode that is not one of the three is
refused rather than read as Live.
And so is the state of the cell’s processors — the one question that is about the fleet rather than about any member of it, which is why it hangs off the collection:
GET /api/v1/nodes:explainCpu
{ "unreported": [],
"domains": [ { "nodes": ["node-a","node-b"], "arch": "x86_64",
"level": "x86-64-v2", "canBaseline": true },
{ "nodes": ["node-c"], "arch": "x86_64",
"level": "x86-64-v4", "canBaseline": true } ],
"advice": [ { "kind": "NodeOutsideTheAggregate", "node": "node-c",
"presents": "host", "aggregate": "x86-64-v2",
"aggregateNodes": 2, "missing": [] } ],
"pendingAdoption": [ { "instance": "projects/p1/instances/i1", "node": "node-a",
"running": "x86-64-v4", "wouldGet": "x86-64-v2" } ] }
And what would actually still fit:
GET /api/v1/nodes:explainCapacity
{ "usableNodes": 8, "unusableNodes": 2,
"total": { "vcpus": 320, "memoryMib": 1310720, "diskGib": 40960 },
"allocated": { "vcpus": 210, "memoryMib": 917504, "diskGib": 22000 },
"free": { "vcpus": 88, "memoryMib": 262144, "diskGib": 14000 },
"largestFit": { "vcpus": 16, "memoryMib": 32768, "diskGib": 4000 } }
largestFit is the field worth having and the reason this is computed here
rather than left to whoever draws the dashboard: free memory does not add up
into a guest. Sixty-four gibibytes spread over eight nodes fits no
sixteen-gibibyte guest, and a summary showing only free tells somebody one
does.
free counts the usable nodes only, so it and total disagree by exactly
the drained capacity — on purpose. A node that is draining, being emptied, or
not reporting still exists and still has memory; none of it is somewhere a
guest can go. unusableNodes is named rather than folded in, because “we have
twelve nodes” and “eight will take a guest” are different sentences and the
second is the one somebody planning capacity needs.
A domain is a set of nodes that can exchange a guest. Computed on every read, never stored: a stored grouping drifts from the fleet the moment a machine is replaced.
advice is tagged by kind, so a console branches on what it is rather than
sniffing which fields are present. Every recommendation carries its cost:
BaselineWouldMerge lists featuresLost per node, because a suggestion that
names only the benefit arrives wearing the platform’s authority. On
NodeOutsideTheAggregate, an empty missing means the machine could join and
simply has not been told; a non-empty one means it never can, and the honest
remedy is a second aggregate.
pendingAdoption lists guests still running a CPU their node no longer hands
out — the ordinary, self-clearing state after a baseline change. Each adopts
on its next restart. Until then it can only move to a node still presenting
what it booted with, which after a fleet-wide change may be nowhere.
unreported names nodes whose agent has not said what processor they have.
Named rather than dropped: “2 of 5 nodes” with no list reads as a broken
report. Such a node is in no domain and is never shown as compatible with
anything — the whole surface fails closed.
Asking creates nothing and writes nothing.
Start order
After a power cut a node brings back everything it holds at once, and the database everything else needs loses the race for disk to a dozen web servers.
PATCH /api/v1/projects/p1/instances/db-1 { "spec": { "startOrder": 1 } }
PATCH /api/v1/projects/p1/instances/web-1 { "spec": { "startOrder": 2, "startDelayS": 30 } }
Lower starts first; the same number is a group that starts together. 0 — the
default — is the first group. startDelayS is measured from the newest
start in the group ahead, not from each member in turn: otherwise a fleet’s
boot is the sum of every delay rather than the longest one.
Nothing is queued and there is no “starting” state. Every pass asks the same question of the same world, and a guest that may not start yet is simply not started this pass.
What counts as settled, ahead of you, is where the deadlock would live:
Running— up.Failed— it had its chance. Waiting forever for a guest that cannot start would take a whole node down for one broken disk.- Anything whose
desiredStateisStopped— it is not coming up.
Everything else holds the guests behind it, and that is deliberate: the alternative is starting the application servers without the database and calling it success.
Resizing a guest
spec.vcpus, spec.memoryMib and spec.rootDiskGib can be changed on a guest
that is running. Nothing changes on the running machine. The guest gets what
was asked for the next time it starts.
That is said rather than implied, and this is the fix for a real hole: the platform used to accept such a change, do nothing, and report the object as converged — a spec that read as applied while the guest ran on the old numbers.
What a running guest actually has is on its status:
GET /api/v1/projects/p1/instances/i1
{ "spec": { "vcpus": 8, "memoryMib": 8192, "rootDiskGib": 40, ... },
"status": { "runningSize": { "vcpus": 4, "memoryMib": 8192, "rootDiskGib": 40 }, ... } }
The difference between the two is the pending change; there is no separate
flag, because a flag can be stale and a comparison cannot. runningSize is
absent while the guest is not running — there is nothing to differ from, and
its next start gives it the spec by construction.
A root disk may grow. It may not shrink:
PATCH /api/v1/projects/p1/instances/i1 { "spec": { "rootDiskGib": 10 } }
400 { "error": { "code": "FAILED_PRECONDITION", "field": "spec.rootDiskGib",
"message": "…has a 40 GiB root disk and cannot be shrunk to 10: the bytes past the new end would be gone and the filesystem using them would find out later. Make a smaller guest from a backup instead." } }
Shrinking is not a resize, it is a truncation. No backend asks the guest first and none can.
Taking a node out of service
Two fields, and they are separate because they are separate intentions:
nodes/<id>.spec.schedulable: false— drain. Nothing new is placed here; what runs keeps running. This is what an operator wants for a reboot.nodes/<id>.spec.evacuate: true— empty it. And none of the old stays either.
Evacuating creates one ordinary migration per guest that can move — nothing
else, because the migration machinery already knows when moving a guest is
safe, and a second path that also moved guests would be a second set of rules
about that. The emptiest destination wins by free memory: first-fit would move
every guest to the same machine, which is how emptying one node fills another.
A guest that cannot move is left where it is, and the node still empties around
it. Some never can — one holding a passed-through device is bound to that
machine — and :explainMigration says which node refused for what. Turning
evacuate off stops further moves; it does not bring anything back, because a
transfer that has started is a thing to see through rather than a state to
unwind.
When a node stops answering
A node that has gone quiet is not a node that has stopped. It may be unreachable and still running every guest it holds, and starting those guests elsewhere then produces two of each writing to one volume — an outage turned into a restore from backup.
Recovery requires independent fencing: the host must be powered off or isolated
from shared storage before an operator records its current status.lastHeartbeat
in the node label velstra.io/fenced-heartbeat. A later heartbeat invalidates
that confirmation. The agent attempts to kill its guests after spec.fenceAfterS,
but an agent crash can leave guests running, so silence alone is never proof.
The control plane also waits for the configured deadline plus its safety margin.
See operations.md for the fencing and reconciliation procedure.
A node whose fenceAfterS is zero — the default — is never recovered from.
A guest opts in with spec.onNodeLoss: "restart" (default "leave"). Only for
one whose storage every node can reach: a guest on local storage started
elsewhere is an empty machine wearing a familiar name.
Why a guest has or has not come back is answered, never written onto it — the agent on its node owns that status, and two writers on one object is the thing this platform is built to prevent:
GET /api/v1/projects/p1/instances/i1:explainRecovery
{ "node": "nodes/node-b", "recoverable": false, "why": "WaitingForFencing",
"detail": "nodes/node-b was last heard from 30s ago; recovery requires at least 120s of silence and external fencing confirmation" }
why is a stable token — PolicyIsLeave, WaitingForFencing,
NodeDoesNotFence, FenceNotConfirmed, HoldsDevices, NotRunning, NotPlaced — because the
reasons are four different afternoons for whoever reads them. Recovery itself
is one write: the controller clears spec.node, and the scheduler then places
the guest exactly as it would any unplaced one.
Keeping guests apart, and keeping them together
"placementPolicy": {
"antiAffinityGroup": "web", "spread": "Required",
"affinityGroup": "checkout", "affinity": "Preferred"
}
Anti-affinity keeps a service alive when a machine dies; affinity keeps it fast while they all live — an application and the cache it reads on every request, where a hop between machines is the whole latency budget. A platform with only the first can express half of what people actually run.
spread and affinity are each Required (the default, and what this platform
did before the fields existed) or Preferred. Both are right answers to
different questions: three replicas of a database must not share a machine even
if that means one stays down; twelve web servers would rather be crowded than
short. A Preferred constraint is carried into the score instead of rejecting,
where “beside its sibling” loses to “anywhere else” and still beats “not running
at all”. The order is lexicographic and not weighted — be with your group, then
away from your siblings, then on the emptiest machine — because a weight is a
number somebody has to tune and the first time it is wrong it is wrong silently.
Affinity only bites once a member is placed: before that there is nothing to be near, and refusing every node would mean a group whose first member could never start. When it cannot be honoured, the rejection says where the group actually is:
"rejected": [ { "node": "node-a", "why": "NotWithGroup", "detail": "checkout is on node-b" } ]
Sharing a processor, and never sharing memory
PATCH /api/v1/nodes/node-a { "spec": { "vcpuOvercommit": 4 } }
Zero — the default — means one for one, the same reading a quota’s zero gets, so a node stored before the field existed behaves exactly as it did. It applies to placement only: the guest still gets the vCPUs it asked for and the hypervisor still schedules them; what changes is how many the cell believes the node has room for.
There is deliberately no memory ratio. A processor can be shared — two guests that both want a core get one each in turn, and being wrong costs speed — and that is a trade an operator makes on purpose. Memory cannot: a guest promised 8 GiB and handed 4 is not slow, it is killed, and the operator finds out from a guest that has vanished. There should be no such field until this platform can take a page back, which means ballooning, and which is a feature rather than a number.
Past 32 vCPUs per core the ratio is refused: that is where it stops being a
trade and becomes a way of hiding that a cell is full.
nodes:explainCapacity reports both numbers — total.vcpus is silicon,
offeredVcpus is what the usable nodes will hand out. Either alone reads as
though the cell had grown a processor.
One recorded shape, two implementations
The console is tested against velstra-cloud-console/tests/console/fake-api.mjs,
which implements this document in memory — so a console can be written and
tested before the server runs. The cost is that every custom method has two
implementations with nothing between them.
So the API records what it answers. velstra-cloud-api/tests/contract_shapes.rs
writes velstra-cloud-api/tests/contract/shapes.json — the shape of each
answer, keys and value kinds, never values — and the console’s own suite holds
its fixture to the same file. One artifact, generated by the implementation that
ships.
null, [] and {} on either side mean “this fixture had nothing here”, which
is a fact about a fixture and not about the contract. What is left is what
breaks a screen: a key spelled differently, missing, or holding a number on one
side and a string on the other. Re-record deliberately and read the diff:
UPDATE_SHAPES=1 cargo test -p velstra-cloud-api --test contract_shapes
One spelling worth knowing about. hugepages1gi is all lowercase on the
wire. The field is hugepages_1gi, and hugepages_1_gi — which would read
hugepages1Gi — cannot round-trip: coming back, a digit followed by an
uppercase letter is how l3Vni is told from hugepages1gi, and one convention
cannot serve both.
Public address pools, and who sees machines
A pool is an external network at cell scope. An operator declares one —
POST /api/v1/networks {"id": "public", "spec": {"external": true, ...}} — and
puts real prefixes on its subnets, v4 and v6 alike. Cell-scoped networks and
subnets are readable by everybody, by the same argument as the image
catalogue: a tenant draws an address from the pool, so they must be able to see
its name and whether the cell offers v4, v6 or both. Creating or editing at
cell scope stays an operator’s alone.
A tenant asks the way a customer asks: which of my machines gets a public address.
POST /api/v1/projects/p1/floatingips
{ "id": "web-ip", "spec": { "instance": "projects/p1/instances/web" } }
instance is consumed: the API resolves the guest’s interface and stores
port, the same way an instance’s networks becomes ports. A guest with two
interfaces is asked which, by name. subnet left out settles to one of the
cell’s public subnets — IPv4 first; naming subnets/public-v6 is how you say
v6, or choose among pools. A cell with no pool refuses with what an operator
would have to declare. Naming both instance and port is refused rather than
merged.
Machines are invisible to a tenant, through every window at once:
spec.nodeandstatus.nodeare taken off instances, attachments, console sessions, ports and captures on the way out to anybody who is neither a cell operator nor a machine agent. Nothing stored changes; operators and agents read the same objects whole. A port’s computedReadycondition is rewritten without the machine’s name too (“programmed and carried”) — the words were the fifth place the name appeared, found live in a tenant’s own list after the other four were shut. Captures were the sixth: the API itself writes the guest’s machine ontospec.node(the machine with the disk is the only one that can copy it) and served it back to the tenant who asked for the template.- Migrations are the operator’s entirely — create, read and list. A migration names the machines a guest moves between, and its record is meaningless with them removed. The guest’s own object tells a tenant everything they were going to learn.
- A tenant may not pin:
spec.nodewritten by a non-operator is refused on instances and attachments, at create and at patch. A name they cannot see is a name they may not write.
Public addresses: the ones the guest actually holds
Two ways an address can reach a guest, and they are not variants of one thing:
POST /api/v1/projects/p1/floatingips
{ "id": "web", "spec": { "subnet": "projects/p1/subnets/public",
"port": "projects/p1/ports/web-1-eth0",
"delivery": "Routed", "announce": "FromHost" } }
delivery: "Nat"(the default, and what this object meant before there was a choice) — translated at the edge; the guest never sees the address. The datapath half of it is the fabric’s and is deferred there.delivery: "Routed"— the address is bound to the port as a second address and configured by the guest. Nothing rewrites a packet. The guest gets it as a/32(or/128) with an on-link next hop,169.254.1.1, which is in no subnet anybody declared — that is what frees the address from any L2 segment, so the same configuration is correct on every hypervisor and stays correct across a live migration.
A guest holding a public address defaults out through it. Leaving the default on the tenant gateway would send replies from the public address out of a door they cannot return through.
A routed address must come from a subnet on a network an operator marked
external: true — a tenant range is not an address the world can reach, and
only a cell operator may set that flag (a tenant who could would mint themselves
a public prefix by typing a CIDR).
Who announces it is the second choice, and it is a real one:
FromHost— the hypervisor holding the guest announces the /32 itself. Shortest path: for north-south traffic the overlay is not in the path at all, and the route follows a migration by construction, because each host announces the addresses of the ports it holds. Needs every hypervisor to peer with the network above it.FromGateway(the default) — a node withspec.gateway: trueannounces it and traffic reaches the guest over the overlay. Few, stable next hops upstream; a hairpin in both directions. A cell with no gateway node is refused by name rather than silently doing nothing.
The network says what the cell does (network.spec.announce); an address may
disagree (floatingip.spec.announce). Those are two different questions — one
about the wiring, one about a particular service — and an address that is silent
takes the network’s answer.
GET /api/v1/projects/p1/floatingips/web:explainReach
{ "address": "203.0.113.7", "delivery": "Routed", "external": true,
"port": "projects/p1/ports/web-1-eth0", "on": "node-a",
"announced": { "from": "host", "nodes": ["node-a"] },
"guest": { "address": "203.0.113.7/32", "via": "169.254.1.1",
"onLink": true, "defaultRoute": true } }
announced.from is null with a why when nothing is announcing it — held and
pointing at nothing, a guest not yet placed, a cell with no gateway, or a
translated address, which has no route of its own to announce.
A capture is real bytes now
The node holding the guest claims the capture, copies the disk to the target, hashes it, and reports the digest. Until then the object was created, assigned to that node, and nothing ever picked it up — so the controller that turns a finished capture into an image never had a finished one to act on.
The copy is written under a temporary name and hashed there: the final name
carries the digest, and a digest cannot be known before the bytes exist. That is
the same reason capture is a resource rather than a call that hands back an
image.
A running guest is refused, in the model’s own words — and the refusal names the tool that does what they wanted (a backup, which is read once by somebody who knows what happened, rather than stamped out a hundred times by people who assume it is clean).
A guest whose root disk is a pool volume answers NoDisk: the node has no
bytes to read, and the honest place to capture it from is the pool.
Where copies are kept
POST /api/v1/backup-targets
{ "id": "archive",
"spec": { "kind": "directory", "path": "/srv/archive", "accepting": true,
"agent": "nvme" } }
kind is directory, lowercase — the one field on this object people
mis-type, because it reads as an exception beside Running and Stopped. The
refusal names the spelling it wanted.
agent names the pool agent that reports on the target: whether the path is
there, whether it can be written, how much room is left. Named by an operator
rather than claimed by whoever gets there first, because a target assigned to
nobody is one any agent could grab — and “an agent may only report on what it
was given” is what makes a node token a boundary rather than a formality.
Leaving it empty means nobody is looking. status.writable is then null,
which is not the same as false: copies are still written there by the pool
holding the volume, and a path it cannot reach fails loudly on the backup rather
than quietly on the target.
Backups are real bytes now
A Backup is claimed by the pool holding the volume, which copies the bytes out
to the target’s path under the backup’s own name with its slashes flattened —
/srv/archive/projects~p1~backups~b1 — so a person can read a target with ls
and two cells sharing one cannot collide.
status.taken is consulted, not merely reported: a copy that exists is
never made again, because a second one would be of a different moment under a
name somebody trusts. A copy that failed is never reported as taken, and the
reason lands on the backup itself — “why is there no copy” is asked months
later by somebody looking at the backup, not at a log on whichever machine
happened to run that pool.
Restoring is creating a volume from a copy:
Omit sizeGib (or use zero) to inherit the backup’s original volume size. The
API resolves that size before checking pool capacity and project quotas. A
smaller explicit size, an unfinished or deleting backup, an unknown source size,
or a failed integrity check is refused before a volume is created.
POST /api/v1/projects/p1/volumes
{ "id": "restored", "spec": { "sizeGib": 40, "pool": "nvme",
"sourceBackup": "projects/p1/backups/b1" } }
The backup’s name, never a path: a path is a fact about one machine’s filesystem. The pool resolves it — the backup says which target, the target says where — and if it cannot (the copy was never taken, or the target is not mounted on that machine) the volume is refused rather than made blank. A volume that was asked to be a restore and quietly came up empty is the worst outcome available: it boots, it is the right size, and everything that was on it is gone.
Writing too fast
A cell may cap how fast one caller writes (--writes-per-second, off by
default). Over the cap:
429 Retry-After: 1
{ "error": { "code": "RESOURCE_EXHAUSTED",
"message": "too many writes at once; this one would be the 21st in a second. Try again in 50 ms — the same request, unchanged, will be accepted then." } }
The wait is on the response, in the header for a client library and in the
sentence for a person, because a client that guesses either spins or backs off
far longer than it needed to. Retry-After is rounded up to whole seconds,
so a client that obeys it to the letter is never turned away twice for the same
reason.
Three properties worth relying on:
- Reads are never counted. A caller reading in a loop is only slowing themselves down.
- Node agents are never limited. An agent reports when something changed, and something changing is not something it can defer; refusing one would make it fall behind and be judged unreachable by the control plane that was the reason.
- It is a bucket, not a window. Somebody who has been quiet may spend a burst at once — creating twenty guests is a normal Tuesday — and a caller who keeps going settles at the sustained rate.
This is not a security boundary and does not pretend to be one. What it stops is the ordinary accident: one tenant taking the cell’s write path from the rest without ever meaning to.
A field this platform does not have
A spec field nobody has heard of is refused, not ignored:
PATCH /api/v1/nodes/node-a { "spec": { "memoryOvercommit": 2 } }
400 { "error": { "code": "INVALID_ARGUMENT", "field": "spec.memoryOvercommit",
"message": "there is no field called memoryOvercommit on a nodes; nothing would have been done with it" } }
Serde ignores what it does not recognise, which is right for reading stored
objects — a field removed from the code must not make yesterday’s data
unreadable — and wrong at the door: an operator answered 200 goes home
believing memory is overcommitted. So the strictness is at the boundary and not
on the types.
At every depth, not only the top. A field inside a known object, or inside an element of a list, is refused the same way and the path says where it sat:
PATCH /api/v1/projects/p1/volumes/logs { "spec": { "limits": { "readMbps": 200 } } }
400 { "error": { "code": "INVALID_ARGUMENT", "field": "spec.limits.readMbps", … } }
limits is a field a volume has and readMbps is not a field of Limits
(readMibps is). Until this descended, that request answered 200 and the
volume kept the pool’s ceiling — an operator told the tenant was throttled when
nothing had been written.
An unknown field carrying nothing — null, "", 0, [], {} — is
accepted in silence. That is somebody echoing back an object or clearing a
field, and no intention is lost. false is not nothing: there are two
values and somebody picked one, so a switch turned off on a field nobody has is
refused like any other.
A query parameter this platform does not have
The same rule, through the other door. A name nobody has is refused:
GET /api/v1/projects/p1/instances?label=env=prod
400 { "error": { "code": "INVALID_ARGUMENT", "field": "label",
"message": "there is no query parameter called `label`; it would have been
ignored, and the answer would have looked like one to the question
you asked. Did you mean `labels`?" } }
?label= returned the collection unfiltered, ?pagesize=20 the default page,
?Since=1h everything, and ?watch=1 a page where a stream was asked for —
each a plausible answer to a question nobody asked, which is the failure this
document already argues against for a bad value. A parameter carrying an
empty value is still ignored, for the reason an empty field is.
The records about one object
GET /api/v1/projects/p1/operations?target=projects/p1/instances/i1
GET /api/v1/audit?target=projects/p1/instances/i1
Only operations and audit carry a target; any other collection asked for one
is refused rather than answered with the whole cell as though the filter had
applied. A target that matches nothing is an empty list — “nothing has happened
to it” is an answer.
The two together are the object’s history, and reading only the first is how somebody concludes their click did nothing: the refusal is the answer.
audit is cell-scoped, and a cell operator reads it whole. It is not
operators-only, and the exception has two exact edges: a record is readable by
whoever may read what it is about, and by the person it is about.
Neither leaks — the first already reads the target, the second is their own
refusal — and everything else about the cell stays the operator’s, including a
refusal about another project and a sign-in, which is about no object at all.
As with every list, a caller who may see none of it gets an empty list rather
than a 403: a refusal on a collection would be an oracle for what is in it.
What a project has left, and what it could actually start
Two halves in one answer, because either alone answers the wrong question. “24 vCPUs of quota left” is what a tenant reads before creating a guest that will never be placed; “no valid host” is what they get afterwards, from a scheduler that knows nothing about quotas.
GET /api/v1/projects/p1:explainQuota
{ "project": "projects/p1",
"dimensions": [
{ "name": "instances", "limit": 10, "used": 3, "left": 7,
"unlimited": false, "exhausted": false },
{ "name": "memoryMib", "limit": 0, "used": 20480, "left": null,
"unlimited": true, "exhausted": false }, … ],
"largestStartable": { "vcpus": 16, "memoryMib": 16384,
"vcpusLimitedBy": "quota", "memoryLimitedBy": "cell",
"none": false } }
limitedBy is the point: quota is a message to an operator, cell is
waiting or picking a smaller shape, and both says that raising the quota
alone would give this tenant nothing. A limit of zero is a limit nobody set,
so left is null rather than 0 — the two are different answers and must not
render as one.
largestStartable is never a sum. The cell’s free memory does not add up into a
guest — a hundred nodes with 2 GiB each cannot run a 4 GiB machine — so its
cell-side input is the largest single node, and a node inside an open
maintenance window is not one of them.
All eight dimensions are always present, in a fixed order: a list that showed only the interesting ones would rearrange itself between two reads of the same screen.
Taking a machine out of service on purpose
A maintenance window is a declaration about a stretch of time. Nothing flips
schedulable or evacuate on the operator’s behalf — placement and evacuation
ask “is this node inside an open window right now” and act, so the operator goes
on being the only writer of those two fields, and a window that ends puts
everything back by ceasing to be open:
POST /api/v1/maintenance-windows
{ "id": "dimm-swap",
"spec": { "node": "node-b", "startsAt": 1755600000000, "minutes": 60,
"drain": false, "note": "swapping the failed DIMM in slot 3" } }
drain: false says nothing new is placed here and everything already running
stays put — a four-minute firmware update. drain: true also migrates the
guests away, by the ordinary evacuation machinery. One field, two intentions;
conflating them would move a fleet for a reboot.
Upcoming, open and over are not stored. They are arithmetic on startsAt,
minutes and the clock — a stored state would be a transient state, right
only while somebody was awake to write it.
Four windows are refused at the moment they are declared, because all four are
knowable then and the alternative is finding out at three in the morning: a
length of zero, a length past 20160 minutes, a window whose end is already
past, and one that overlaps another window on the same node. A start time in the
past is accepted — work that has already begun is a true thing to declare.
A node in an open window is rejected by placement like any other unsuitable node, with the reason on the instance:
"rejections": [ { "node": "node-b", "why": "InMaintenance",
"detail": "out of service for another 40 minutes: swapping the failed DIMM in slot 3" } ]
Relative, not a clock time: this is read out of an instance’s condition hours after it was written, when “back at 03:00” no longer says whether that has happened.
What a window will cost is answerable before it opens, which is the only time the answer is any use:
GET /api/v1/nodes/node-b:explainMaintenance
{ "node": "node-b",
"open": { "window": "maintenance-windows/dimm-swap", "startsAt": …, "endsAt": …,
"minutes": 60, "drain": false, "note": "…", "opensInMinutes": null },
"next": null,
"draining": false,
"willMove": [ { "instance": "projects/p1/instances/web-1", "to": "node-a" } ],
"cannotMove": [ { "instance": "projects/p1/instances/gpu-1",
"why": [ { "node": "node-a", "detail": "…holds a passed-through device…" } ] } ] }
cannotMove is the half that decides whether tonight goes well: a guest that
cannot move is stopped when the machine is, and every node’s verdict is on the
line rather than a flattened “no host found” — the remedy for “a generation too
old” and the remedy for “it holds a GPU” are nothing like each other.
A baseline is declared per node, and refused if the machine cannot reach it:
PATCH /api/v1/nodes/node-c { "spec": { "cpuBaseline": "x86-64-v4" } }
400 { "error": { "code": "FAILED_PRECONDITION", "field": "spec.cpuBaseline",
"message": "node-c cannot present x86-64-v4: it lacks avx512f, avx512dq" } }
Refused here rather than at boot. -cpu <level>,enforce would catch it —
QEMU refuses to start a guest it cannot give the promised processor — but “the
guests on node-c stopped booting” is a long way from the sentence above.
Clearing the field is always allowed: going back to the host’s own processor
asks nothing of the machine.
Watching the cell from outside
GET /metrics answers Prometheus’ text format, behind the same bearer token as
everything else (Prometheus scrapes with authorization.credentials_file
natively; an open metrics port would hand the cell’s machine names and
capacities to whoever finds it). Deliberately few series — the numbers an alert
fires on, not a metric per field:
velstra_node_heartbeat_age_seconds{node="hv-1"} 4
velstra_node_memory_mib{node="hv-1",kind="capacity"} 262144
velstra_pool_gib{pool="nvme",kind="allocated"} 120
velstra_instances{state="Running"} 12
velstra_instances_off_desired_state 0
velstra_store_revision 457027
velstra_instances_off_desired_state counts guests not in the state they were
asked for — the one to page on. velstra_store_revision rising unusually fast
is the early warning for the store-quota incident class. It is an operator’s
read: the lines carry machine names.
Authentication
Who may do what. Authentication says who; the bindings on a project say
may they. A project carries spec.bindings — a role (viewer, editor,
admin) and the subjects holding it — and every object under that project is
governed by them. viewer reads, editor also writes, admin also changes the
bindings themselves; the last is kept apart so an editor cannot grant themselves
more than they were given.
Resources outside every project — nodes, pools, ceph-clusters, the users
collection, and the projects collection itself — belong to the cell, and only a
cell operator may touch them. A subject is a cell operator two ways: named
in the API’s --cell-admin, or holding a user record whose
spec.cellAdmin is true. The first is configuration, not data: it is what a
fresh cell is bootstrapped from, and a permission stored inside the thing it
protects has no answer for the first request. The second is the ordinary,
storable grant, checked from the record the same way the config list is — so a
cell administers its own operators once it has a first one, without editing the
API’s flags. whoami (below) reports the combined answer as cellAdmin.
A refused request is 403 PERMISSION_DENIED with the same sentence whether the
resource is yours and forbidden or somebody else’s and invisible — an error that
told the two apart would enumerate other tenants. A list is the exception
that proves it: it is filtered rather than refused, because a caller has no
permission on a collection as a whole and answering 403 would leave nobody able
to find the projects they do have.
An agent must be a cell operator, and the consequence of getting that wrong is
silence. A node agent reads two cell-wide collections — nodes and
ceph-clusters — and, by the rule above, a cell-wide list is filtered rather
than refused. So an agent authenticating as an ordinary subject is not told it
may not read them: it is handed {"items": []} and reads that as “there is
nothing to do”. No error, no refusal, every node quiet, and a Ceph cluster stuck
at Bootstrapping for ever.
That is a configuration mistake this document cannot prevent, so the agent looks for it instead: a node always exists for itself, so a node list that comes back without the agent’s own node in it has been filtered, and the agent says so once at that point. The contract line is here because it is the thing to check first; the run-time detector is what helps somebody who has already got it wrong.
Authorization: Bearer <token>. A token is verified one of two ways, tried in
order: it may be a session token minted by a password sign-in (below), or a
static token a service account or an agent holds — accepted by a fallback
verifier (a --token-file in development, an OIDC-issued JWT in production). The
console only ever sees a bearer token and must not care which kind it is; the
difference shows only at whoami, which reports whether a session stands
behind the token.
Sessions and passwords
Passwords are exchanged for tokens, never sent on every request. The
credentials and sessions collections are unserved (above); these four routes
are the only way to reach them.
POST /api/v1/sessions # sign in: {username, password} -> {token, …}
GET /api/v1/sessions/current # whoami: who this token is, and what it may do
DELETE /api/v1/sessions/current # sign out: end the session this token names
PUT /api/v1/users/{id}/password # set a password (a person)
POST /api/v1/users/{id}/tokens # mint a token (a service account)
POST /sessionsis the one route with noAuthorization— it is what issues the token every other route requires. Body{username, password}; on success201with{token, subject, displayName, cellAdmin, expiresAt}. Thetokenis returned once and only its digest is stored, so it cannot be recovered from the cell afterwards. Every failure — no such user, wrong password, disabled account — is the same401sentence, so the response is not an oracle for which usernames exist.GET /sessions/current(whoami) returns{subject, displayName, cellAdmin, session, projects, capabilities}.cellAdminis the combined operator answer (config list or stored flag).sessionis true only when this token is a live session — a static token or service account readsfalse, because there is no session behind it for a sign-out to end.projectsmaps each project the subject is named in to a display role ({"p1": "admin", "p2": "viewer"}), folders included; a custom role appears by its name.capabilitiesmaps those project ids to collections and the exact verbs allowed by all direct and inherited bindings together (for example{"p1": {"volumes": ["read", "write"]}}). It excludes cell-only collections and migrations, which a tenant cannot manage. A console uses this answer to draw controls; the API still authorizes every request.DELETE /sessions/currentends the session the caller presented, and only that one. It names no session: a route that ended a session by name would be a way to sign somebody else out. Idempotent — a token already gone is not an error.PUT /users/{id}/passwordsets a password. A cell operator may set anyone’s; a subject may set their own, and only then must prove the current password in the body ascurrentPassword— without that, a stolen session would be a permanent account takeover. A project admin may set no one’s: project membership is not a route to the cell. Changing your own password ends every other session you hold and keeps the one you are sitting in; an operator changing someone else’s ends all of theirs, which is the point when an operator is shutting a door.
Node agents, and the two ways they write
A node agent runs one of two ways, and the difference is a real trust boundary rather than a configuration preference.
Direct (the default). The agent holds a cell-operator token and writes to the store directly. The store’s one-writer rule still refuses a write that is not this node’s, but the identity on that write is self-declared: anything holding the operator token could write any node’s status, so this is safe only because the operator token is held by the operator’s own agents. This is the single-operator phase — a trusted deployment, not an enforced boundary.
--api (per-node identity). Each node is minted its own token when it is
registered, and the agent reads and writes through the API with that token
instead of touching the store. The token authenticates the caller as that one
node, and the API enforces what it may do:
- It may read the machine room — a node needs tenant network config, images
and the node list to run its guests, and reads them as it always has. Of the
cell’s own collections it reads four:
nodes,pools,backup-targetsandceph-clusters— what it computes over, what it is, and what it reports on. The cell’s accounts are not among them:usersis refused403 PERMISSION_DENIED, by name as well as by list. Those two used to disagree —GET /userswas refused to a pool agent’s token andGET /users/adminwas served to it — which was a curtain over an open door, and read as a rule. - It may write status only of objects it owns or was assigned — its own node
object, and the instances, ports and attachments placed on it. A write for
another node’s object is refused
403 PERMISSION_DENIED; it may not change anyspec, and it may not create or delete anything. - What it reads is the store’s own bytes, not the presentation. The API
computes answers on the way out to people — an operation’s
done, a port’sReady, a subnet’sallocated— and a machine that read the decorated object would write its own undecorated one straight back, on every pass, for ever. That loop was found live: three writes a second on a settled two-node cell, each write waking the watch that started the next pass, and the traffic filled the store’s quota. Reads, lists, watches and the answer to a status report all serve an agent raw.
So a compromised node holds a credential that can write only its own objects’ status, which the operator token never was.
A node token is minted once, at registration. A POST that creates a node
returns, alongside the operation, a nodeToken field — the only time the token
is shown. Only its digest is stored, in a collection the API does not serve
(beside credentials and sessions), so it cannot be recovered from the cell
afterwards, and a node cannot rotate its own credential: the digest is a spec a
node may never write. Deleting the node deletes its credential with it.
POST /api/v1/nodes → 202
{ "operation": "operations/op-3", "target": "nodes/node-a",
"nodeToken": "…64 hex chars, shown once…" }
A pool is the same machinery under a different name. Registering one answers
with a poolToken, and its agent presents it exactly as a node agent presents a
nodeToken. A registration answers with one of the two, and which one says
what was registered.
A machine that already exists can be issued a fresh credential, with
:issueCredential. Minting only at registration is the right shape for a secret
and the wrong shape for the only way to get one: a machine whose token was lost,
or a pool registered before pools had credentials at all, would otherwise have to
be deleted and made again — and deleting a pool means deleting the thing every
volume in it is written against.
POST /api/v1/pools/local-2:issueCredential → 200
{ "target": "pools/local-2", "poolToken": "…64 hex chars, shown once…" }
Three things about it are deliberate:
- No
operation. Nothing converges here. A create answers with one because the object it made has not settled yet; a credential is finished the moment it is in the answer. - It does not revoke. The old digest still opens the door until it is deleted
— otherwise an operator who mis-typed the new token into a file would have
taken the agent down while fixing it. That is why it is
issueCredentialand notrotateCredential, which would be a name promising the other thing. - It needs
Write, notOperate. Handing out the credential a machine speaks with is not part of running the estate. It is also refused for a name nobody registered, and for any kind that has no agent.
The same credential, as a file somebody can carry, with :joinFile and
:cloudInit. A join token is about 1.3 KB of base64; it removes every
hand-copied fact between the control plane and an installer, and then asks
whoever is standing at a machine to type it, at a console, where there is no
paste buffer. These two answer with the artefact instead:
POST /api/v1/nodes/peter:joinFile → 200
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment; filename="peter.join"
# Velstra Cloud join token for node peter in cell cell-1.
# Drop this file at velstra/join on any medium you plug into the
# machine; the installer offers it by name. It is a credential:
# anything holding it can register as peter.
velstra1.…
POST /api/v1/nodes/peter:cloudInit → 200 # a #cloud-config, filename peter-cloud-init.yaml
curl -X POST … -o /mnt/velstra/join is the intended use, which is why the
answer is the file and not JSON wrapping it. Four things are deliberate:
- POST, not GET. Each call mints a machine credential, and a GET that
minted one is a GET a browser can be made to issue from somebody else’s
page. Same rule, same reason, as
:issueCredential— and the sameWritepermission. - The file names the machine. It will be found by somebody who did not write it, possibly a year later, possibly on a stick carrying three others. A naked kilobyte of base64 says nothing about which node it belongs to, and installing the wrong machine is the expensive mistake here. The installer reads past comment lines for exactly this reason.
- It is the token, not a second rendering of the seed. The obvious
endpoint is “give me this node’s
node.env”, and it is the wrong one:velstra-cloud-node setup --joinalready turns a token into a seed, and a renderer here would be a second place that has to agree about the same keys. This platform has paid for that mistake four times (two seed renderers where only one knewVELSTRA_ROLES; a bootstrap password written to one directory and read from another; five keys rendered and never parsed back). - cloud-init installs no package. It writes the file 0600, runs
setup --join-file, and shreds it. Which repository a fleet takes the package from is the fleet’s decision; a cloud-config that pulled a binary from an address this platform chose would be one nobody could audit.
Enrolment: the two doors with no token
Everything else in this contract needs a bearer token. Two things do not, and cannot: a machine that has just booted an installer holds none.
POST /api/v1/enrollments:announce → 201
{ "publicKey": "…Ed25519, base64…",
"seenCertificate": "9F:2C:…",
"reported": { "hostname": "nixos", "addresses": ["10.10.10.47"],
"vcpus": 16, "memoryMib": 65536,
"disks": ["nvme0n1"], "serial": "PT-0042" } }
→ { "enrollment": "enrollments/m-5691f8f2b609", "id": "m-5691f8f2b609",
"fingerprint": "1A:2B:3C:4D:5E:6F:70:81",
"seenCertificate": "9F:2C:…", "phase": "Pending", "expiresAt": … }
The machine prints that fingerprint on its screen. The same value is on the
enrolment’s row in the console, beside what the machine said about itself. An
operator compares the two, sets spec.node and spec.roles, and sets
spec.approved — an ordinary PATCH, which needs a token like every other
change. Then:
POST /api/v1/enrollments:claim → 200
{ "id": "m-5691f8f2b609", "signature": "…Ed25519 over the claim message…" }
→ { "target": "nodes/peter", "nodeToken": "…", "joinToken": "velstra1.…" }
Seven things about these two are deliberate.
- Neither grants anything by itself.
announcemakes a request. Until somebody names the machine and says what it is for, there is nothing to claim, andclaimsays which of the two is missing rather than “no”. - The comparison is the authentication, both ways. The fingerprint is eight bytes of SHA-256 over the public key: only the holder of the private key can produce it, and nothing on the wire can change it without changing the fingerprint. The machine also reports the fingerprint of the certificate it was served, and a control plane’s console banner prints that same value for itself — so a man in the middle has to show a certificate it holds the key for, which is a different fingerprint, on the machine’s own screen.
- The claim is signed over the enrolment’s id, as
velstra-enrollment-claim:v1:<id>. Without the id in the message one machine’s signature would open every row. - Nobody registers themselves. The API records who approved on the enrolment’s status — a field the platform writes and no caller can send — and mints the node’s credential as that person. A machine cannot create a node, and the API does not act on its own behalf; it acts on the recorded authority of somebody who may already create nodes, once, for the one node they named. The audit line carries a human.
- Once. A second claim is refused as already claimed, whether it is a retry that lost its answer or somebody else holding the key. A machine that lost its credential announces again.
- An unknown id and a wrong key answer identically (
404). A door open to anybody must not let a stranger enumerate which machines are waiting. - The open door is capped and idempotent. The id is derived from the key, so a machine that announces again lands on its own row rather than adding one; past 512 unsettled rows an announcement is refused by name. This is the one place in this API where a stranger can make the store grow.
They are collection verbs — enrollments:claim with the id in the body, not
enrollments/<id>:claim — because a path segment in this router is either a
literal or a parameter and never both. The id is not a secret: the machine
announced it and was told it, and the signature is what authorises.
A node reports status with a custom method, AIP-136’s :reportStatus, which
is the one write outside the spec-only PATCH surface because it is a different
caller doing a different thing:
POST /api/v1/projects/p1/instances/i1:reportStatus
Authorization: Bearer <node token>
If-Match: "412" # the revision the agent read, for a compare-and-swap
{ "status": { … } } # only the status is written; spec and meta are kept
A person, a service account or a cell operator has no node identity and so may
not use it: status is the agent’s half, and the API does not get to be more
permissive than the store.
Releases, rollouts, and the install medium
A release is a build the cell can move to, named by its channel: a
directory holding the artefacts CI publishes and the SHA256SUMS that names
them. A GitHub release’s download directory is one; so is a directory copied
onto the control plane and named as file:///var/lib/velstra/releases/v0.2.0.
Cell-scoped, and the cell operator’s to add.
POST /api/v1/releases
{ "id": "v0.2.0", "spec": { "url": "https://github.com/Velstra/cloud/releases/download/v0.2.0/" } }
The release controller reads the sums, writes what the channel offers onto the
status — version, and image, package and installer with the digest each
must hash to — and fetches every file into the releases directory, one per
pass, verifying each before it is marked fetched. The Ready condition is
True when all of them are; while it is not, its message says which file is
being fetched, or why one was refused. A channel that carries two builds, or
names nothing a release publishes, is refused rather than guessed at. From then
on the cell is the channel for its machines: nothing on a node reaches out
past its own control plane.
GET /api/v1/releases/{id}/files/{file} # one of the release's files, verified
is what a node fetches — only a file the release’s status names, only once it is fetched, and only for the cell’s machines and its operators.
What a node runs is status.installed on the node (see Nodes); what it
should run is spec.wanted, written by a rollout or by hand:
PATCH /api/v1/nodes/peter
{ "spec": { "wanted": { "release": "releases/v0.2.0", "version": "0.2.0+…",
"file": "velstra-cloud_0.2.0+…_amd64.deb", "sha256": "…" } } }
Everything the machine needs is in it, chosen for its kind of installation, so
the agent reads its own node and nothing else. It fetches the file from its
cell, verifies the digest, applies it — an appliance writes the image into its
inactive slot and reboots; a package node runs apt-get install and lets the
package’s postinst restart what runs — and reports installed again on the
way back. It reports as it goes on the node’s Updating condition: True with
Fetching, Working or Applied and a sentence, False with Failed and the
sentence when it could not, or UpToDate once it runs what it is wanted to.
A machine that failed does not try again until it is wanted something else.
A rollout moves machines to a release, one at a time:
POST /api/v1/rollouts
{ "id": "spring", "spec": { "release": "v0.2.0", "nodes": ["peter", "paul"],
"evacuate": true, "maxUnavailable": 1, "paused": false } }
release is the bare id, as every reference to a cell-scoped object is (the
full name is accepted too); nodes empty means every node. The controller cordons the next machine,
evacuates it if asked and waits until nothing is running there, writes
spec.wanted, waits until the node is Ready on the release’s version with a
heartbeat newer than the hand-over, puts it back in service, and moves on —
the control plane last, because the controller runs there and its own
reboot ends the pass. status.nodes[] carries each machine’s phase
(Pending, Refused, Cordoned, Draining, Applying, Done, Failed),
what it moved from and to, and a message; status.phase is the whole:
Planning until the release is ready, then Running, Paused, Done or
Failed. It fails closed: a machine that reports its apply failed, or is
not back within 45 minutes, stops the rollout with that machine named and every
machine not yet started left as it was. A machine the cell cannot update — the
NixOS module on somebody’s own operating system, or one that has not reported
how it was installed — is Refused by name, and the rest go on. paused: true
finishes the machine in flight and starts no other.
The install medium is the last piece: the installer a release holds, cut for one machine.
POST /api/v1/nodes/{name}:installMedium { "release": "v0.2.0" } # optional
→ { "url": "/api/v1/media/<ticket>", "filename": "velstra-cloud-installer_0.2.0+…_peter.iso",
"release": "releases/v0.2.0", "version": "0.2.0+…", "size": …, "expiresAt": … }
GET /api/v1/media/{ticket} # once, no token; streams the medium
The medium is the release’s installer ISO, byte for byte, with the node’s join
file — the same one :joinFile hands out — appended after the ISO’s last byte
between two markers. Nothing in the ISO is rewritten; the installer reads past
the end its volume descriptor declares and finds the file there, so a machine
booted from the stick joins as that node without anything typed. POST,
because it mints the node’s credential, and audited as installMedium; the
answer is a one-time link rather than the bytes, because two gigabytes are not
a thing to hand a browser’s fetch(). The link needs no token — it is the
credential, as a console ticket is — is spent on the first GET, and is gone
after ten minutes. Without release, the newest release whose installer is on
this cell is used; while no release holds one, the cut is refused with
FAILED_PRECONDITION and says to add one.
Image families and where images come from
An image’s name is its digest, which is what makes fetching one verifiable
and what made every screen ask people to choose an operating system from
images/sha256-cbf3e1f588f02f8d738dbecb…. Two functions are addressed by, and
the digest says which: sha256:<64 hex> and sha512:<128 hex>. Not a
preference — Debian publishes only SHA512SUMS for its cloud images and the RPM
family and Ubuntu publish SHA256SUMS, so a platform that insisted on one of
them could not point at half the distributions people actually run. A node hashes
with the function the image names; a checksums file naming both is read as the
sha256. spec.family is the name a person
uses — debian-13 — and spec.version says which one in the family.
An instance may name families/<family> instead of an image:
POST /api/v1/projects/p1/instances
{ "id": "web-1", "spec": { "image": "families/debian-13", … } }
That is resolved once, when the instance is created, and what is stored is
the concrete image. A guest never changes its operating system on a restart:
“always the newest” means new machines get the newest, not that existing ones are
rewritten under their owners. A project’s own family beats the cell’s, so a
tenant publishing debian-13 of their own gets theirs.
Nor does it change on a PATCH: spec.image may be said again — by name, or as
a family that still resolves to the same build, which is what a form sending
everything back does — and a different image is refused with
FAILED_PRECONDITION at spec.image. A different image is a different machine;
make one, and let a capture of this one keep its disk.
image-sources keeps a family current:
POST /api/v1/image-sources
{ "id": "debian-13", "spec": {
"family": "debian-13",
"url": "http://cloud.example/debian-13-genericcloud-amd64.qcow2",
"checksums": "https://cloud.example/SHA256SUMS",
"everyMs": 21600000,
"keep": 3
} }
format says what the bytes are, and is required unless the filename settles
it. Only .qcow2 settles it: the source check learns the digest without reading
the image, and the filename lies because Ubuntu ships qcow2 under .img. A
source that can say neither reads
Checked=False with Unusable and the sentence on its own object, rather than
publishing an image a node will refuse to make a disk from.
“What this source published” is a fact the source writes down —
image-source.velstra.io/by on every image it makes — not a guess from the
URL. A URL is a value an operator edits when a mirror moves and one anybody can
copy: matched on it, a source lost its own back catalogue after an edit, and a
tenant registering the same public URL under the same family had their image
deprecated and then deleted by the cell’s retention. Images published before the
label fall back to the URL, so nothing is orphaned.
The cell reads the checksums file, finds the line for the image’s filename, and publishes an image for that digest if it does not have one. Two different jobs with two different trust models, and conflating them is the hazard:
- the digest is learned over
https://with the certificate checked, and anything else is refused at this door — whoever can rewrite that answer chooses what every new guest in the cell boots; - the bytes are streamed by the image verifier as soon as the image object
is created, over whatever scheme the URL names, including plain
http://.Ready=True/Verifiedis written only after the declared digest and, when present, size match. A guest or volume cannot use the image while this is pending or after it fails. Nodes still verify their own downloads, so the early check improves feedback without making the controller a trust anchor.
keep is retention, and it takes away only what it is safe to take: versions
this source published, past the newest keep, that nothing names — no
instance, and no volume. A guest keeps the bytes it was built from for as long
as it exists, and a volume resolves its image when the pool opens it, so either
one keeps its image alive whatever keep says — and the source says on its own object how many it spared
and why, because “why does this family still hold eleven versions” should not
have to be worked out from a list of guests. Retention runs only after something
new was published: nothing can fall out of keep unless something came in.
A SHA512SUMS file is not a SHA256SUMS file. They sit side by side in every
distribution’s directory, and a 128-digit line is refused rather than taken as a
digest — one that no bytes will ever match would be a source that looks healthy
and publishes something that cannot boot. The source says on its own object what
it found, or why it could not look.
Service accounts
A caller that is a program is a users object with spec.service set. It has no
password and does not sign in; a cell operator mints it a token:
POST /api/v1/users/ci/tokens
{ "purpose": "nightly backups" }
200 { "token": "…", "user": "ci", "purpose": "nightly backups", "shownOnce": true }
Shown once. The platform keeps a digest, exactly as it does for a node’s
credential, so a lost token is replaced rather than recovered — and a stolen
store holds nothing usable. Several tokens may exist for one account, which is
what makes rotation possible without a gap; purpose is what tells them apart
when one of them has to go.
Everything else about a service account is deliberately identical to a person’s.
It is named in a project’s bindings like anybody else, gets the same four
roles, and appears in the audit trail under its own subject — so “what may this
pipeline do here” is answered by reading the project.
Disabling one stops its tokens on the next request: the account is read back on every call rather than copied into the credential, so an operator shutting a door does not have to find the tokens first.
Before this, a service account was a line in a static token file: no object, no bindings, nothing in the audit trail, and no way to revoke one but editing a file and restarting the API — so the practical answer was to hand a program a person’s password.