mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 10:11:27 +01:00
The enforce_dom0_cpus test sets the number of vcpus for the Dom0 and
checks to see if they have been set correctly. We found that on multi-proc systems, it takes a certain amount of time for the number of vcpus to change. This patch checks the number of vcpus inside a loop until it is correct or 20 seconds elapse, whichever happens first. If after 20 seconds the number of vcpus is not changed correctly, an error is raised. Signed-off-by: Rajagopalan Subrahmanian <raj.subrahmanian@unisys.com>
This commit is contained in:
1 parent
e1b53df502
commit
ddc7a4667e
1 file changed
+25
-7
@@ -65,13 +65,24 @@ if check_status and status != 0:
|
||||
FAIL("\"%s\" returned invalid %i != 0" %(cmd,status))
|
||||
|
||||
# 5) check /proc/cpuinfo for cpu count
|
||||
cmd = "grep \"^processor\" /proc/cpuinfo | wc -l"
|
||||
status, output = traceCommand(cmd)
|
||||
if check_status and status != 0:
|
||||
os.unsetenv("XEND_CONFIG")
|
||||
restartXend()
|
||||
FAIL("\"%s\" returned invalid %i != 0" %(cmd,status))
|
||||
|
||||
# It takes some time for the CPU count to change, on multi-proc systems, so check the number of procs in a loop for 20 seconds.
|
||||
#Sleep inside the loop for a second each time.
|
||||
timeout = 20
|
||||
starttime = time.time()
|
||||
while timeout + starttime > time.time():
|
||||
# Check /proc/cpuinfo
|
||||
cmd = "grep \"^processor\" /proc/cpuinfo | wc -l"
|
||||
status, output = traceCommand(cmd)
|
||||
if check_status and status != 0:
|
||||
os.unsetenv("XEND_CONFIG")
|
||||
restartXend()
|
||||
FAIL("\"%s\" returned invalid %i != 0" %(cmd,status))
|
||||
# Has it succeeded? If so, we can leave the loop
|
||||
if output == str(enforce_dom0_cpus):
|
||||
break
|
||||
# Sleep for 1 second before trying again
|
||||
time.sleep(1)
|
||||
if output != str(enforce_dom0_cpus):
|
||||
os.unsetenv("XEND_CONFIG")
|
||||
restartXend()
|
||||
@@ -94,7 +105,14 @@ if check_status and status != 0:
|
||||
FAIL("\"%s\" returned invalid %i != 0" %(cmd,status))
|
||||
|
||||
# check restore worked
|
||||
num_online = int(getDomInfo("Domain-0", "VCPUs"))
|
||||
# Since this also takes time, we will do it in a loop with a 20 second timeout.
|
||||
timeout=20
|
||||
starttime=time.time()
|
||||
while timeout + starttime > time.time():
|
||||
num_online = int(getDomInfo("Domain-0", "VCPUs"))
|
||||
if num_online == dom0_online_vcpus:
|
||||
break
|
||||
time.sleep(1)
|
||||
if num_online != dom0_online_vcpus:
|
||||
os.unsetenv("XEND_CONFIG")
|
||||
restartXend()
|
||||
|
||||