Commit 9de87ec
Shreyansh Sancheti
guest: use OCIBundlePath as sandbox root source of truth
Replace heuristic sandbox path derivation (hard-coded /run/gcs/c prefix + ID)
with host-provided OCIBundlePath as the canonical sandbox root directory.
This change prepares the guest-side GCS for Shim v2 and multi-pod UVM support,
where the host may use a different path layout than the legacy /run/gcs/c/<id>.
Key changes:
- Add sandboxRoots mapping on Host to store resolved sandbox root per sandbox ID
- Sandbox containers: register OCIBundlePath as sandbox root
- Virtual pods: derive sandbox root from OCIBundlePath parent + /virtual-pods/<id>
- Workload containers: resolve sandbox root from Host mapping (fallback to legacy)
- Standalone containers: use OCIBundlePath directly as root
- Container.Delete: use stored sandboxRoot for cleanup paths
- Remove duplicate setup functions (setupVirtualPod* merged into unified setup*)
The refactor produces identical paths when the old shim sends OCIBundlePath in
the legacy format, ensuring zero behavior change for existing deployments.
Security: virtualPodID is validated against path traversal before use.
Signed-off-by: Shreyansh Sancheti <shsancheti@microsoft.com>1 parent 5a0252a commit 9de87ec
File tree
6 files changed
+531
-206
lines changed- internal/guest/runtime/hcsv2
6 files changed
+531
-206
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
| |||
30 | 31 | | |
31 | 32 | | |
32 | 33 | | |
33 | | - | |
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| |||
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
80 | 85 | | |
81 | 86 | | |
82 | 87 | | |
| |||
229 | 234 | | |
230 | 235 | | |
231 | 236 | | |
232 | | - | |
233 | | - | |
234 | | - | |
235 | | - | |
236 | | - | |
237 | | - | |
238 | | - | |
239 | | - | |
240 | | - | |
| 237 | + | |
| 238 | + | |
241 | 239 | | |
242 | 240 | | |
243 | | - | |
244 | | - | |
245 | | - | |
| 241 | + | |
246 | 242 | | |
247 | 243 | | |
248 | | - | |
249 | | - | |
250 | | - | |
| 244 | + | |
251 | 245 | | |
252 | 246 | | |
253 | 247 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
| 23 | + | |
36 | 24 | | |
37 | 25 | | |
38 | 26 | | |
39 | 27 | | |
40 | 28 | | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
| 29 | + | |
| 30 | + | |
48 | 31 | | |
49 | 32 | | |
50 | 33 | | |
51 | | - | |
| 34 | + | |
52 | 35 | | |
53 | 36 | | |
54 | 37 | | |
| |||
62 | 45 | | |
63 | 46 | | |
64 | 47 | | |
65 | | - | |
| 48 | + | |
66 | 49 | | |
67 | 50 | | |
68 | 51 | | |
69 | 52 | | |
70 | 53 | | |
71 | 54 | | |
72 | | - | |
| 55 | + | |
73 | 56 | | |
74 | 57 | | |
75 | 58 | | |
76 | 59 | | |
77 | 60 | | |
| 61 | + | |
78 | 62 | | |
79 | 63 | | |
80 | 64 | | |
| |||
97 | 81 | | |
98 | 82 | | |
99 | 83 | | |
100 | | - | |
| 84 | + | |
101 | 85 | | |
102 | 86 | | |
103 | 87 | | |
| |||
125 | 109 | | |
126 | 110 | | |
127 | 111 | | |
128 | | - | |
129 | 112 | | |
130 | 113 | | |
131 | | - | |
132 | 114 | | |
133 | 115 | | |
134 | 116 | | |
| |||
0 commit comments