Skip to content
Fuse
Esc
navigateopen⌘Jpreview
On this page

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)
}
  • ID is a free-form, operator-supplied string and doubles as the host’s primary key. Backend defaults to "firecracker" if left empty; only "qemu" hosts may register with Capacity.GPUs > 0.
  • Capacity.CPUs, RamMB, and StorageGB are optional hardware facts: leaving any at 0 (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 and cpus/ram_mb/storage_gb were not all declared, registration fails with a 502 *APIError instead, declare them explicitly in that case.
  • Token must be the host agent’s own FC_AGENT_TOKEN, not the orchestrator token. The capacity probe doubles as an auth probe, so a wrong token fails registration with a 502 *APIError carrying code unauthorized, even when capacity was fully declared.
  • Capacity.VMCount is scheduling policy, not something a host can report on its own, so it’s never probed and is always required.
  • Capacity.MIGProfiles advertises fractional GPU capacity as a map of MIG profile name to instance count ({"1g.10gb": 4}). Like GPUs it requires Backend: "qemu", and profile names must be in mig-parted form, either violation is a 400 invalid_argument. Keys are lowercased server-side before scheduling, so declared casing doesn’t have to match a Fusefile’s gpu_profile.
  • host.Warnings is 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.

Was this page helpful?