Currently, one of kvm cgroup test, cpuset_cpus, will get and error
if the number of vcpus not equal to the hardware cpus.
for example, when vm_cpus is 2, and the host cpu number
(no_cpus) is 4, while i >= 3, vcpus[i - 1] will make no sense.

To avoid this, add i <= vm_cpus to correct it.

Signed-off-by: Mike Qiu <[email protected]>
---
 kvm/tests/cgroup.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/kvm/tests/cgroup.py b/kvm/tests/cgroup.py
index 6e8aa1d..108a5ab 100644
--- a/kvm/tests/cgroup.py
+++ b/kvm/tests/cgroup.py
@@ -1114,7 +1114,7 @@ def run_cgroup(test, params, env):
             cgroup.set_property('cpuset.mems', all_mems, i)
             if i == 0:
                 assign_vm_into_cgroup(vm, cgroup, 0)
-            else:
+            elif i <= vm_cpus:
                 cgroup.set_cgroup(vcpus[i - 1], i)
 
         timeout = int(params.get("login_timeout", 360))
-- 
1.7.7.6

_______________________________________________
Autotest-kernel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/autotest-kernel

Reply via email to