Skip to content

Commit 027758a

Browse files
committed
Set cgroup path when calling GetVMInfo
GetVMInfo already had the CgroupPath field, but it looks like it was never set. This commit sets the cgroup path if the jailer is a cgroupPather. Signed-off-by: xibz <[email protected]>
1 parent cbc9eba commit 027758a

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

runtime/service.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -597,11 +597,17 @@ func (s *service) GetVMInfo(requestCtx context.Context, request *proto.GetVMInfo
597597
return nil, err
598598
}
599599

600+
cgroupPath := ""
601+
if c, ok := s.jailer.(cgroupPather); ok {
602+
cgroupPath = c.CgroupPath()
603+
}
604+
600605
return &proto.GetVMInfoResponse{
601606
VMID: s.vmID,
602607
SocketPath: s.shimDir.FirecrackerSockPath(),
603608
LogFifoPath: s.machineConfig.LogFifo,
604609
MetricsFifoPath: s.machineConfig.MetricsFifo,
610+
CgroupPath: cgroupPath,
605611
}, nil
606612
}
607613

runtime/service_integ_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,7 @@ func TestMultipleVMs_Isolated(t *testing.T) {
370370
require.Equal(t, vmInfoResp.SocketPath, filepath.Join(cfg.ShimBaseDir, defaultNamespace, strconv.Itoa(vmID), "firecracker.sock"))
371371
require.Equal(t, vmInfoResp.LogFifoPath, filepath.Join(cfg.ShimBaseDir, defaultNamespace, strconv.Itoa(vmID), "fc-logs.fifo"))
372372
require.Equal(t, vmInfoResp.MetricsFifoPath, filepath.Join(cfg.ShimBaseDir, defaultNamespace, strconv.Itoa(vmID), "fc-metrics.fifo"))
373+
require.Equal(t, resp.CgroupPath, vmInfoResp.CgroupPath)
373374

374375
// just verify that updating the metadata doesn't return an error, a separate test case is needed
375376
// to very the MMDS update propagates to the container correctly

0 commit comments

Comments
 (0)