Hosts
Registering and managing the compute hosts the scheduler places VMs onto
client.Hosts registers and manages the compute hosts the scheduler places
microVMs onto. Register a host, letting the orchestrator probe its real
hardware capacity rather than trusting a guess:
host, err := client.Hosts.Register(ctx, fuse.RegisterHostRequest{
ID: "prod-east-1",
URL: "http://10.0.0.5:8090",
Token: agentToken,
Region: "us-east",
Backend: "firecracker",
Capacity: fuse.HostCapacity{
VMCount: 20, // required; cpus/ram_mb/storage_gb left at 0 to probe
},
})
if err != nil {
log.Fatal(err)
}
for _, w := range host.Warnings {
log.Println("warning:", w)
}
IDis a free-form, operator-supplied string and doubles as the host’s primary key.Backenddefaults to"firecracker"if left empty; only"qemu"hosts may register withCapacity.GPUs > 0.Capacity.CPUs,RamMB, andStorageGBare optional hardware facts: leaving any at0(as above) has the orchestrator probe the host agent for the real value instead of trusting a guess. Pass one explicitly to override the probe, for a deliberate overcommit or carve-out, a declared value above what the probe reports still registers, with a warning rather than a rejection. If the orchestrator cannot reach or probe the host agent andcpus/ram_mb/storage_gbwere not all declared, registration fails with a502*APIErrorinstead, declare them explicitly in that case.Tokenmust be the host agent’s ownFC_AGENT_TOKEN, not the orchestrator token. The capacity probe doubles as an auth probe, so a wrong token fails registration with a502*APIErrorcarrying codeunauthorized, even when capacity was fully declared.Capacity.VMCountis scheduling policy, not something a host can report on its own, so it’s never probed and is always required.Capacity.MIGProfilesadvertises fractional GPU capacity as a map of MIG profile name to instance count ({"1g.10gb": 4}). LikeGPUsit requiresBackend: "qemu", and profile names must be in mig-parted form, either violation is a400invalid_argument. Keys are lowercased server-side before scheduling, so declared casing doesn’t have to match a Fusefile’sgpu_profile.host.Warningsis only ever populated on this call’s response, non-fatal notices like a declared value exceeding what was probed.
Everything else
| Method | Purpose |
|---|---|
List(ctx) |
List every registered host with its declared Capacity and live Allocated figures. |
Get(ctx, hostID) |
Fetch one host by ID. |
Cordon(ctx, hostID) / Uncordon(ctx, hostID) |
Stop or resume scheduling new environments onto the host, without touching what’s already running. |
Deregister(ctx, hostID) |
Remove the host. Fails with a 409 conflict *APIError if environments are still assigned to it. |
fuse.IsConflict(err) reports true when the host is still busy, so branch on
that rather than on the error message. Cordon the host and drain its
environments before retrying.
Host.State is one of active, cordoned, or draining. Host.LastSeen is
set once at registration and never refreshed, it is not a liveness signal.
These mirror the HTTP API one to one.