WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] The enforce_dom0_cpus test sets the number of vcpus for

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] The enforce_dom0_cpus test sets the number of vcpus for the Dom0 and
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 19 May 2006 17:26:16 +0000
Delivery-date: Fri, 19 May 2006 10:29:31 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User emellor@xxxxxxxxxxxxxxxxxxxxxx
# Node ID ea609f28ec01b7cc9b540481cf99173b83135863
# Parent  167790b102ac48e6645882b0cf74ffdb60758f3c
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@xxxxxxxxxx>
---
 tools/xm-test/tests/enforce_dom0_cpus/01_enforce_dom0_cpus_basic_pos.py |   32 
+++++++---
 1 files changed, 25 insertions(+), 7 deletions(-)

diff -r 167790b102ac -r ea609f28ec01 
tools/xm-test/tests/enforce_dom0_cpus/01_enforce_dom0_cpus_basic_pos.py
--- a/tools/xm-test/tests/enforce_dom0_cpus/01_enforce_dom0_cpus_basic_pos.py   
Fri May 19 15:52:35 2006 +0100
+++ b/tools/xm-test/tests/enforce_dom0_cpus/01_enforce_dom0_cpus_basic_pos.py   
Fri May 19 16:21:43 2006 +0100
@@ -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()

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] The enforce_dom0_cpus test sets the number of vcpus for the Dom0 and, Xen patchbot-unstable <=