diff --git a/virtcontainers/cgroups_test.go b/virtcontainers/cgroups_test.go index a9a7c920c..27d848f5c 100644 --- a/virtcontainers/cgroups_test.go +++ b/virtcontainers/cgroups_test.go @@ -154,8 +154,7 @@ func TestUpdateCgroups(t *testing.T) { // fake workload cmd := exec.Command("tail", "-f", "/dev/null") assert.NoError(cmd.Start()) - s.state.Pid = cmd.Process.Pid - s.hypervisor = &mockHypervisor{mockPid: s.state.Pid} + s.hypervisor = &mockHypervisor{mockPid: cmd.Process.Pid} // no containers err = s.updateCgroups() @@ -167,7 +166,7 @@ func TestUpdateCgroups(t *testing.T) { s.containers = map[string]*Container{ "abc": { process: Process{ - Pid: s.state.Pid, + Pid: cmd.Process.Pid, }, config: &ContainerConfig{ Annotations: containerAnnotations, @@ -175,7 +174,7 @@ func TestUpdateCgroups(t *testing.T) { }, "xyz": { process: Process{ - Pid: s.state.Pid, + Pid: cmd.Process.Pid, }, config: &ContainerConfig{ Annotations: containerAnnotations, diff --git a/virtcontainers/kata_agent_test.go b/virtcontainers/kata_agent_test.go index cc3b8a97b..cda2dc26f 100644 --- a/virtcontainers/kata_agent_test.go +++ b/virtcontainers/kata_agent_test.go @@ -570,7 +570,6 @@ func TestHandlePidNamespace(t *testing.T) { } sandbox := &Sandbox{} - sandbox.state.Pid = 0 k := kataAgent{} diff --git a/virtcontainers/sandbox.go b/virtcontainers/sandbox.go index d207fc018..7f88973ad 100644 --- a/virtcontainers/sandbox.go +++ b/virtcontainers/sandbox.go @@ -1009,7 +1009,6 @@ func (s *Sandbox) addContainer(c *Container) error { ann := c.GetAnnotations() if ann[annotations.ContainerTypeKey] == string(PodSandbox) { - s.state.Pid = c.process.Pid s.state.CgroupPath = c.state.CgroupPath return s.store.Store(store.State, s.state) } diff --git a/virtcontainers/types/sandbox.go b/virtcontainers/types/sandbox.go index 002230c39..731736516 100644 --- a/virtcontainers/types/sandbox.go +++ b/virtcontainers/types/sandbox.go @@ -34,10 +34,6 @@ type SandboxState struct { // Index of the block device passed to hypervisor. BlockIndex int `json:"blockIndex"` - // Pid is the process id of the sandbox container which is the first - // container to be started. - Pid int `json:"pid"` - // GuestMemoryBlockSizeMB is the size of memory block of guestos GuestMemoryBlockSizeMB uint32 `json:"guestMemoryBlockSize"`