Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

Commit

Permalink
virtcontainers: cgroups: Don't error if no thread ID
Browse files Browse the repository at this point in the history
In case the hypervisor implementation does not return any thread
ID, this should not issue any error since there is simply nothing
to constrain.

Fixes #1062

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
  • Loading branch information
Sebastien Boeuf committed Dec 19, 2018
1 parent b51c57e commit a21d1e6
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion virtcontainers/cgroups.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,15 @@ func (s *Sandbox) applyCPUCgroup(rc *specs.LinuxResources) error {
// when new container joins, new CPU could be hotplugged, so we
// have to query fresh vcpu info from hypervisor for every time.
tids, err := s.hypervisor.getThreadIDs()
if err != nil || tids == nil {
if err != nil {
return fmt.Errorf("failed to get thread ids from hypervisor: %v", err)
}
if tids == nil {
// If there's no tid returned from the hypervisor, this is not
// a bug. It simply means there is nothing to constrain, hence
// let's return without any error from here.
return nil
}

// use Add() to add vcpu thread to s.cgroup, it will write thread id to
// `cgroup.procs` which will move all threads in qemu process to this cgroup
Expand Down

0 comments on commit a21d1e6

Please sign in to comment.