Skip to content

Commit b28e6dc

Browse files
committed
Add VSockPath to GetVmInfoResponse
Firecracker's virtio-vsock implementation bypasses the the host kernel by mediating between AF_UNIX on the host and AF_VSOCK in the guest. Firecracker-containerd places the host AF_UNIX socket path in the internal shim storage directory when launching a VM. Vsock is currently only used for communication between the shim and the in-VM agent. For some use-cases (e.g. remote snapshotters) it would be useful to have additional services listening on vsock inside the VM with corresponding host services to communicate with them. This change adds VSockPath to GetVmInfoResponse to allow a host service to get the host AF_UNIX socket path to open additional connections to vsock services in the guest. Signed-off-by: Kern Walster <[email protected]>
1 parent 321527e commit b28e6dc

File tree

4 files changed

+78
-66
lines changed

4 files changed

+78
-66
lines changed

proto/firecracker.pb.go

Lines changed: 75 additions & 66 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

proto/firecracker.proto

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ message GetVMInfoResponse {
7474
string LogFifoPath = 3;
7575
string MetricsFifoPath = 4;
7676
string CgroupPath = 5;
77+
string VSockPath = 6;
7778
}
7879

7980
message SetVMMetadataRequest {

runtime/service.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -711,6 +711,7 @@ func (s *service) GetVMInfo(requestCtx context.Context, request *proto.GetVMInfo
711711
LogFifoPath: s.machineConfig.LogPath,
712712
MetricsFifoPath: s.machineConfig.MetricsPath,
713713
CgroupPath: cgroupPath,
714+
VSockPath: s.shimDir.FirecrackerVSockPath(),
714715
}, nil
715716
}
716717

runtime/service_integ_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,7 @@ func TestMultipleVMs_Isolated(t *testing.T) {
409409
return err
410410
}
411411
if vmInfoResp.SocketPath != filepath.Join(cfg.ShimBaseDir, nspVMid, "firecracker.sock") ||
412+
vmInfoResp.VSockPath != filepath.Join(cfg.ShimBaseDir, nspVMid, "firecracker.vsock") ||
412413
vmInfoResp.LogFifoPath != filepath.Join(cfg.ShimBaseDir, nspVMid, "fc-logs.fifo") ||
413414
vmInfoResp.MetricsFifoPath != filepath.Join(cfg.ShimBaseDir, nspVMid, "fc-metrics.fifo") ||
414415
resp.CgroupPath != vmInfoResp.CgroupPath {

0 commit comments

Comments
 (0)