mirror of
https://github.com/getcompanion-ai/computer-host.git
synced 2026-04-19 18:04:43 +00:00
feat: vsock mmds snapshot
This commit is contained in:
parent
39f8882c30
commit
07975fb459
13 changed files with 390 additions and 148 deletions
|
|
@ -331,6 +331,11 @@ func (r *Runtime) RestoreBoot(ctx context.Context, loadSpec SnapshotLoadSpec, us
|
|||
}
|
||||
}
|
||||
|
||||
var vsockOverride *VsockOverride
|
||||
if loadSpec.Vsock != nil {
|
||||
vsockOverride = &VsockOverride{UDSPath: jailedVSockDevicePath(*loadSpec.Vsock)}
|
||||
}
|
||||
|
||||
// Load snapshot (replaces the full configure+start sequence)
|
||||
if err := client.PutSnapshotLoad(ctx, SnapshotLoadParams{
|
||||
SnapshotPath: chrootStatePath,
|
||||
|
|
@ -345,6 +350,7 @@ func (r *Runtime) RestoreBoot(ctx context.Context, loadSpec SnapshotLoadSpec, us
|
|||
HostDevName: network.TapName,
|
||||
},
|
||||
},
|
||||
VsockOverride: vsockOverride,
|
||||
}); err != nil {
|
||||
cleanup(network, paths, command, firecrackerPID)
|
||||
return nil, fmt.Errorf("load snapshot: %w", err)
|
||||
|
|
@ -369,6 +375,11 @@ func (r *Runtime) RestoreBoot(ctx context.Context, loadSpec SnapshotLoadSpec, us
|
|||
return &state, nil
|
||||
}
|
||||
|
||||
func (r *Runtime) PutMMDS(ctx context.Context, state MachineState, data any) error {
|
||||
client := newAPIClient(state.SocketPath)
|
||||
return client.PutMMDS(ctx, data)
|
||||
}
|
||||
|
||||
func processExists(pid int) bool {
|
||||
if pid < 1 {
|
||||
return false
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue