orchestrator: no CLI to inspect active NBD devices; lsblk shows 4096 pre-allocated noise
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 1.6k
- Forks
- 438
- PR merge metrics
- No merged PRs in 30d
Description
Problem
On a sandbox node, running lsblk | grep nbd | wc -l returns 4096 — one line per pre-allocated device. All show SIZE=0B when idle, making it impossible to quickly identify which devices are actively connected to a sandbox.
# current operator experience
$ lsblk | grep nbd | wc -l
4096
# no easy way to filter to just connected ones
The 4096 devices are expected — start-client.sh loads the nbd module with nbds_max=4096 and this is persisted in /etc/modprobe.d/nbd.conf. This is correct behavior. The problem is observability: there is no tool to see which of those 4096 slots are actually in use.
What exists today
pkg/sandbox/nbd/pool.go already has the machinery:
ConnectedDevices()— scans/sys/block/nbdX/pidand returns only connected slotsDevicePool.usedSlots— a bitset of pool-tracked slots (not accessible externally)- OTEL metrics:
orchestrator.nbd.slots_pool.acquired/released/ready— aggregate counts only
None of this is exposed via a CLI or debug endpoint. When a kernel I/O error like block nbd316: Receive control failed appears in dmesg, there is no way to correlate nbd316 to a sandbox ID.
Missing pieces
- No CLI tool that calls
ConnectedDevices()and prints a table of active devices (slot, path, size, PID) — analogous tocmd/inspect-build - No slot → sandbox ID mapping in
DevicePool— even internally,usedSlotsonly tracks which slots are occupied, not which sandbox occupies each slot DevicePooldoesn't storemaxDevices— callers must re-read/sys/module/nbd/parameters/nbds_maxto know the pool ceiling
Proposed fix
Add cmd/inspect-nbd: a lightweight operator tool that shows only active NBD devices.
Example output:
NBD devices: 3 connected / 4096 configured
SLOT DEVICE SIZE (MB) PID
3 /dev/nbd3 1024 18234
17 /dev/nbd17 2048 18891
316 /dev/nbd316 1024 19012
Flags: -json for machine-readable output.
Secondary improvement: store maxDevices on DevicePool at construction (avoids re-reading sysfs on every call) and expose a Status() method returning used/max counts for future debug endpoints.
Slot → sandbox ID mapping is left as follow-up work.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with pkg/sandbox/nbd/pool.go, especially ConnectedDevices and DevicePool construction, then compare the entry point and conventions in cmd/inspect-build. Done means cmd/inspect-nbd reports connected slots with device, size, and PID, supports -json, and includes the proposed pool status and configured maximum handling.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, linux
- Domain
- cli, observability
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 68/100