[shimV2] Add sandbox filtering to ShimDiag Tasks RPC and introduce DiagSandboxes RPC
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 694
- Forks
- 304
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 28
Description
Summary
The DiagTasks RPC in the ShimDiag service currently returns all tasks running in the UVM across all pods, with no way for callers to filter by sandbox/pod. This is a holdover from when the LCOW shim only supported a single pod per UVM. Now that the shims (V1 and V2) support multiple pods sharing a single UVM, diagnostic callers need a way to scope task listings to a specific sandbox.
Relevant Discussion: https://github.com/microsoft/hcsshim/pull/2685#discussion_r3111949188
// Originally this method was intended to be used in a single pod setup and therefore,
// we do not specify a TaskID in the request. Since this shim can support multiple pods,
// we will return all tasks running in the UVM, regardless of which pod they belong to.
Proposed Changes
- Add a
sandbox_id field to TasksRequest
Updateinternal/shimdiag/shimdiag.proto:
message TasksRequest {
bool execs = 1;
// Optional. If set, only tasks belonging to the specified sandbox/pod
// will be returned. If empty, all tasks across all pods are returned
// (preserves current behavior for backward compatibility).
string sandbox_id = 2;
}
Update diagTasks to look up the specific podController by sandbox_id when provided, instead of iterating over all s.podControllers. Return a NotFound error if the sandbox ID does not exist.
- Add a new
ListSandboxesRPC
Allow callers to enumerate thesandboxes/podscurrently hosted in the UVM, so they can then make targetedDiagTaskscalls.
service ShimDiag {
// ...existing rpcs...
rpc ListSandboxes(SandboxesRequest) returns (SandboxesResponse);
}
message ListSandboxesRequest {
}
message Sandbox {
string id = 1;
// Optional future fields: created_at, task_count, state, etc.
}
message ListSandboxesResponse {
repeated Sandbox sandboxes = 1;
}
Implementation would iterate s.podControllers under the existing service lock and return their IDs.
Backward Compatibility
Adding sandbox_id as an optional field is wire-compatible; existing clients that omit it continue to receive the all-pods listing.
DiagSandboxes is purely additive.
Contributor guide
No contributing guide indexed for this repository
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 internal/shimdiag/shimdiag.proto and the existing diagTasks implementation. Trace how s.podControllers are accessed under the service lock, then add the sandbox-filtered behavior and ListSandboxes response described in the issue. Done means omitted sandbox_id preserves all-pods results, unknown IDs return NotFound, and callers can enumerate sandbox IDs.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- backend-api-design
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 58/100