container: SandboxCgroupOnly: no host cgroups.

No call cgroup operations for containers in host
if SandboxCgroupOnly is enabled.

Signed-off-by: Jose Carlos Venegas Munoz <jose.carlos.venegas.munoz@intel.com>
This commit is contained in:
Jose Carlos Venegas Munoz 2019-08-16 12:59:14 -05:00
parent b65063248f
commit 2fcb8bb4d8

View File

@ -879,8 +879,10 @@ func (c *Container) create() (err error) {
} }
c.process = *process c.process = *process
if err = c.cgroupsCreate(); err != nil { if !c.sandbox.config.SandboxCgroupOnly {
return if err = c.cgroupsCreate(); err != nil {
return
}
} }
if !c.sandbox.supportNewStore() { if !c.sandbox.supportNewStore() {
@ -908,8 +910,10 @@ func (c *Container) delete() error {
return err return err
} }
if err := c.cgroupsDelete(); err != nil { if !c.sandbox.config.SandboxCgroupOnly {
return err if err := c.cgroupsDelete(); err != nil {
return err
}
} }
return c.store.Delete() return c.store.Delete()
@ -1200,8 +1204,10 @@ func (c *Container) update(resources specs.LinuxResources) error {
return err return err
} }
if err := c.cgroupsUpdate(resources); err != nil { if !c.sandbox.config.SandboxCgroupOnly {
return err if err := c.cgroupsUpdate(resources); err != nil {
return err
}
} }
return c.sandbox.agent.updateContainer(c.sandbox, *c, resources) return c.sandbox.agent.updateContainer(c.sandbox, *c, resources)