runsc: Only uninstall cgroup for sandbox stop.

PiperOrigin-RevId: 231263114
Change-Id: I57467a34fe94e395fdd3685462c4fe9776d040a3
This commit is contained in:
Lantao Liu
2019-01-28 11:58:25 -08:00
committed by Shentubot
parent 1cedccf8e9
commit 52b3cd873d
+4 -1
View File
@@ -721,7 +721,10 @@ func (c *Container) stop() error {
if err := c.Sandbox.DestroyContainer(c.ID); err != nil {
return fmt.Errorf("destroying container %q: %v", c.ID, err)
}
cgroup = c.Sandbox.Cgroup
// Only uninstall cgroup for sandbox stop.
if c.Sandbox.IsRootContainer(c.ID) {
cgroup = c.Sandbox.Cgroup
}
// Only set sandbox to nil after it has been told to destroy the container.
c.Sandbox = nil
}