mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-07-05 03:26:37 +00:00
virtcontainers: cgroups: Don't error if no thread ID
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>
This commit is contained in:
parent
b51c57e6fe
commit
a21d1e693f
@ -100,9 +100,15 @@ func (s *Sandbox) applyCPUCgroup(rc *specs.LinuxResources) error {
|
|||||||
// when new container joins, new CPU could be hotplugged, so we
|
// when new container joins, new CPU could be hotplugged, so we
|
||||||
// have to query fresh vcpu info from hypervisor for every time.
|
// have to query fresh vcpu info from hypervisor for every time.
|
||||||
tids, err := s.hypervisor.getThreadIDs()
|
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)
|
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
|
// 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
|
// `cgroup.procs` which will move all threads in qemu process to this cgroup
|
||||||
|
Loading…
Reference in New Issue
Block a user