mirror of
https://github.com/hanzoai/visor.git
synced 2026-09-24 17:04:14 +00:00
Add a CLI tool and Go library that speak the libtpu checkpoint/restore control protocol (pkg/sentry/control/tpu_control.proto) against unsandboxed processes. gVisor coordinates libtpu C/R during sandbox save/restore (pkg/sentry/control/tpu_control.go), but there is no way to exercise or debug that protocol path without a full runsc save cycle. This tool fills the gap: it discovers libtpu control threads by scanning /proc/<pid>/task/*/comm, opens the encoded pipe FDs via /proc/<pid>/fd/, and sends ControlRequest messages. Accepts a comma-separated PID list and runs actions concurrently across PIDs with per-PID results, for multi-process jobs that need all processes checkpointed together. Co-authored-by: Hanzo Dev <[email protected]>
35 lines
767 B
Python
35 lines
767 B
Python
load("//tools:defs.bzl", "go_library", "go_test")
|
|
|
|
package(
|
|
default_applicable_licenses = ["//:license"],
|
|
licenses = ["notice"],
|
|
)
|
|
|
|
go_library(
|
|
name = "tpucontrol",
|
|
srcs = [
|
|
"control.go",
|
|
"discovery.go",
|
|
"errors.go",
|
|
],
|
|
visibility = ["//tools/tpucheckpoint:__pkg__"],
|
|
deps = [
|
|
"//pkg/sentry/control:tpu_control_proto_go_proto",
|
|
"@org_golang_google_protobuf//proto:go_default_library",
|
|
],
|
|
)
|
|
|
|
go_test(
|
|
name = "tpucontrol_test",
|
|
size = "small",
|
|
srcs = [
|
|
"control_test.go",
|
|
"discovery_test.go",
|
|
],
|
|
deps = [
|
|
":tpucontrol",
|
|
"//pkg/sentry/control:tpu_control_proto_go_proto",
|
|
"@org_golang_google_protobuf//proto:go_default_library",
|
|
],
|
|
)
|