All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] 01_enforce_dom0_cpus_basic_pos reset vcpu count on failures.
@ 2006-05-23 19:31 Paul Larson
  2006-05-23 19:49 ` Ryan Harper
  0 siblings, 1 reply; 4+ messages in thread
From: Paul Larson @ 2006-05-23 19:31 UTC (permalink / raw)
  To: xen-devel


[-- Attachment #1.1.1: Type: text/plain, Size: 334 bytes --]

If 01_enforce_dom0_cpus_basic_pos fails, the vcpu count for dom0 does not get 
restored causing subsequent boots to come up with only a single vcpu on dom0.

 01_enforce_dom0_cpus_basic_pos.py |   29 +++++++++++++++--------------
 1 file changed, 15 insertions(+), 14 deletions(-)

Signed-off-by: Paul Larson <pl@us.ibm.com>


[-- Attachment #1.1.2: 01_enforce.patch --]
[-- Type: text/x-diff, Size: 3374 bytes --]

# HG changeset patch
# User pl@us.ibm.com
# Node ID 654b58e2c44d50ffcb7eaabfbaf41d4c5e9b09d7
# Parent  606db2959bd6dc7fc178e9792f0ef345e48dd35e
Fix a problem where the vcpu count for dom0 doesn't get reset back to the 
original value when 01_enforce_dom0_cpus_basic_pos fails.

diff -r 606db2959bd6 -r 654b58e2c44d 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	Tue May 23 11:05:08 2006
+++ b/tools/xm-test/tests/enforce_dom0_cpus/01_enforce_dom0_cpus_basic_pos.py	Tue May 23 13:13:02 2006
@@ -28,6 +28,12 @@
 check_status = 1
 max_tries = 10
 
+def reset_vcpu_count():
+    status, output = traceCommand("xm vcpu-set 0 %s"%(dom0_online_vcpus))
+    if status != 0:
+        print "WARNING!!! Unable to set vcpus back to %s, please set manually"\
+            %(dom0_online_vcpus)
+
 # 1) Make sure we have a multi cpu system and dom0 has at least 2 vcpus online.
 
 if smpConcurrencyLevel() <= 1:
@@ -57,6 +63,7 @@
 # 4) restart xend with new config
 os.putenv("XEND_CONFIG", "/tmp/xend-config.sxp")
 status = restartXend()
+os.unsetenv("XEND_CONFIG")
 if check_status and status != 0:
     ns, no = restartXend()
     if ns != 0:
@@ -75,7 +82,7 @@
     cmd = "grep \"^processor\" /proc/cpuinfo | wc -l"
     status, output = traceCommand(cmd)
     if check_status and status != 0:
-        os.unsetenv("XEND_CONFIG")
+        reset_vcpu_count()
         restartXend()
         FAIL("\"%s\" returned invalid %i != 0" %(cmd,status))
 # Has it succeeded? If so, we can leave the loop
@@ -84,7 +91,7 @@
 # Sleep for 1 second before trying again
     time.sleep(1)
 if output != str(enforce_dom0_cpus):
-    os.unsetenv("XEND_CONFIG")
+    reset_vcpu_count()
     restartXend()
     FAIL("/proc/cpuinfo says xend didn't enforce dom0_cpus (%s != %s)"%(output, 
                                                              enforce_dom0_cpus))
@@ -92,34 +99,28 @@
 # 6) count number of online cpus and see that it matches enforce value
 num_online = int(getDomInfo("Domain-0", "VCPUs"))
 if num_online != enforce_dom0_cpus:
-    os.unsetenv("XEND_CONFIG")
+    reset_vcpu_count()
     restartXend()
     FAIL("xm says xend didn't enforce dom0_cpus (%s != %s)" %(num_online, 
                                                              enforce_dom0_cpus))
 
 # 7) restore dead processors 
-status, output = traceCommand("xm vcpu-set 0 %s"%(dom0_online_vcpus))
-if check_status and status != 0:
-    os.unsetenv("XEND_CONFIG")
-    restartXend()
-    FAIL("\"%s\" returned invalid %i != 0" %(cmd,status))
+reset_vcpu_count()
 
 # check restore worked
 # 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)
+   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()
     FAIL("failed to restore dom0's VCPUs")
 
 
 # 8) Restart xend with default config
-os.unsetenv("XEND_CONFIG")
 restartXend()
 

[-- Attachment #1.2: Type: application/pgp-signature, Size: 191 bytes --]

[-- Attachment #2: Type: text/plain, Size: 138 bytes --]

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] 01_enforce_dom0_cpus_basic_pos reset vcpu count on failures.
  2006-05-23 19:31 [PATCH] 01_enforce_dom0_cpus_basic_pos reset vcpu count on failures Paul Larson
@ 2006-05-23 19:49 ` Ryan Harper
  2006-05-23 20:40   ` [PATCH] (corrected) " Paul Larson
  0 siblings, 1 reply; 4+ messages in thread
From: Ryan Harper @ 2006-05-23 19:49 UTC (permalink / raw)
  To: Paul Larson; +Cc: xen-devel

* Paul Larson <pl@us.ibm.com> [2006-05-23 14:33]:
> If 01_enforce_dom0_cpus_basic_pos fails, the vcpu count for dom0 does not get 
> restored causing subsequent boots to come up with only a single vcpu on dom0.

Though I've never seen this mentioned on the list, I thought we wanted
to leave the system in the failed state if a test failed?  That's
certainly debatable.  Thoughts?

> -    num_online = int(getDomInfo("Domain-0", "VCPUs"))
> -    if num_online == dom0_online_vcpus:
> -        break
> -    time.sleep(1)
> +   num_online = int(getDomInfo("Domain-0", "VCPUs"))
> +   if num_online == dom0_online_vcpus:
> +       break
> +   time.sleep(1)

White-space damage.



-- 
Ryan Harper
Software Engineer; Linux Technology Center
IBM Corp., Austin, Tx
(512) 838-9253   T/L: 678-9253
ryanh@us.ibm.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] (corrected) 01_enforce_dom0_cpus_basic_pos reset vcpu count on failures.
  2006-05-23 19:49 ` Ryan Harper
@ 2006-05-23 20:40   ` Paul Larson
  2006-06-01 11:12     ` Ewan Mellor
  0 siblings, 1 reply; 4+ messages in thread
From: Paul Larson @ 2006-05-23 20:40 UTC (permalink / raw)
  To: xen-devel


[-- Attachment #1.1.1: Type: text/plain, Size: 1141 bytes --]

On Tuesday 23 May 2006 14:49, Ryan Harper wrote:
> * Paul Larson <pl@us.ibm.com> [2006-05-23 14:33]:
> > If 01_enforce_dom0_cpus_basic_pos fails, the vcpu count for dom0 does not
> > get restored causing subsequent boots to come up with only a single vcpu
> > on dom0.
>
> Though I've never seen this mentioned on the list, I thought we wanted
> to leave the system in the failed state if a test failed?  That's
> certainly debatable.  Thoughts?
Generally, that's probably a good rule but in this case it's better to go with 
the FAIL() output and put it back to a reasonable state because  the altered 
state can persist not only out the end of the test run, but across xend 
restarts and even reboots.  The reason this came up is because a bug was 
filed where a few systems were only showing one cpu in /proc/cpuinfo, but 
they were configured for smp and had previously booted with all their 
processors.

> White-space damage.
Doh! Fixed version attached.
 01_enforce_dom0_cpus_basic_pos.py |   21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)
Signed-off-by: Paul Larson <pl@us.ibm.com>

[-- Attachment #1.1.2: 01_enforce.patch --]
[-- Type: text/x-diff, Size: 3088 bytes --]

# HG changeset patch
# User pl@us.ibm.com
# Node ID 74b14312d90ba444a9e697c64adb10f60233261a
# Parent  606db2959bd6dc7fc178e9792f0ef345e48dd35e
Fix a problem where the vcpu count for dom0 doesn't get reset back to the 
original value when 01_enforce_dom0_cpus_basic_pos fails.

diff -r 606db2959bd6 -r 74b14312d90b 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	Tue May 23 11:05:08 2006
+++ b/tools/xm-test/tests/enforce_dom0_cpus/01_enforce_dom0_cpus_basic_pos.py	Tue May 23 14:19:33 2006
@@ -28,6 +28,12 @@
 check_status = 1
 max_tries = 10
 
+def reset_vcpu_count():
+    status, output = traceCommand("xm vcpu-set 0 %s"%(dom0_online_vcpus))
+    if status != 0:
+        print "WARNING!!! Unable to set vcpus back to %s, please set manually"\
+            %(dom0_online_vcpus)
+
 # 1) Make sure we have a multi cpu system and dom0 has at least 2 vcpus online.
 
 if smpConcurrencyLevel() <= 1:
@@ -57,6 +63,7 @@
 # 4) restart xend with new config
 os.putenv("XEND_CONFIG", "/tmp/xend-config.sxp")
 status = restartXend()
+os.unsetenv("XEND_CONFIG")
 if check_status and status != 0:
     ns, no = restartXend()
     if ns != 0:
@@ -75,7 +82,7 @@
     cmd = "grep \"^processor\" /proc/cpuinfo | wc -l"
     status, output = traceCommand(cmd)
     if check_status and status != 0:
-        os.unsetenv("XEND_CONFIG")
+        reset_vcpu_count()
         restartXend()
         FAIL("\"%s\" returned invalid %i != 0" %(cmd,status))
 # Has it succeeded? If so, we can leave the loop
@@ -84,7 +91,7 @@
 # Sleep for 1 second before trying again
     time.sleep(1)
 if output != str(enforce_dom0_cpus):
-    os.unsetenv("XEND_CONFIG")
+    reset_vcpu_count()
     restartXend()
     FAIL("/proc/cpuinfo says xend didn't enforce dom0_cpus (%s != %s)"%(output, 
                                                              enforce_dom0_cpus))
@@ -92,17 +99,13 @@
 # 6) count number of online cpus and see that it matches enforce value
 num_online = int(getDomInfo("Domain-0", "VCPUs"))
 if num_online != enforce_dom0_cpus:
-    os.unsetenv("XEND_CONFIG")
+    reset_vcpu_count()
     restartXend()
     FAIL("xm says xend didn't enforce dom0_cpus (%s != %s)" %(num_online, 
                                                              enforce_dom0_cpus))
 
 # 7) restore dead processors 
-status, output = traceCommand("xm vcpu-set 0 %s"%(dom0_online_vcpus))
-if check_status and status != 0:
-    os.unsetenv("XEND_CONFIG")
-    restartXend()
-    FAIL("\"%s\" returned invalid %i != 0" %(cmd,status))
+reset_vcpu_count()
 
 # check restore worked
 # Since this also takes time, we will do it in a loop with a 20 second timeout.
@@ -114,12 +117,10 @@
         break
     time.sleep(1)
 if num_online != dom0_online_vcpus:
-    os.unsetenv("XEND_CONFIG")
     restartXend()
     FAIL("failed to restore dom0's VCPUs")
 
 
 # 8) Restart xend with default config
-os.unsetenv("XEND_CONFIG")
 restartXend()
 

[-- Attachment #1.2: Type: application/pgp-signature, Size: 191 bytes --]

[-- Attachment #2: Type: text/plain, Size: 138 bytes --]

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] (corrected) 01_enforce_dom0_cpus_basic_pos reset vcpu count on failures.
  2006-05-23 20:40   ` [PATCH] (corrected) " Paul Larson
@ 2006-06-01 11:12     ` Ewan Mellor
  0 siblings, 0 replies; 4+ messages in thread
From: Ewan Mellor @ 2006-06-01 11:12 UTC (permalink / raw)
  To: Paul Larson; +Cc: xen-devel


[-- Attachment #1.1: Type: text/plain, Size: 1281 bytes --]

On Tue, May 23, 2006 at 03:40:14PM -0500, Paul Larson wrote:

> On Tuesday 23 May 2006 14:49, Ryan Harper wrote:
> > * Paul Larson <pl@us.ibm.com> [2006-05-23 14:33]:
> > > If 01_enforce_dom0_cpus_basic_pos fails, the vcpu count for dom0 does not
> > > get restored causing subsequent boots to come up with only a single vcpu
> > > on dom0.
> >
> > Though I've never seen this mentioned on the list, I thought we wanted
> > to leave the system in the failed state if a test failed?  That's
> > certainly debatable.  Thoughts?
> Generally, that's probably a good rule but in this case it's better to go with 
> the FAIL() output and put it back to a reasonable state because  the altered 
> state can persist not only out the end of the test run, but across xend 
> restarts and even reboots.  The reason this came up is because a bug was 
> filed where a few systems were only showing one cpu in /proc/cpuinfo, but 
> they were configured for smp and had previously booted with all their 
> processors.
> 
> > White-space damage.
> Doh! Fixed version attached.
>  01_enforce_dom0_cpus_basic_pos.py |   21 +++++++++++----------
>  1 file changed, 11 insertions(+), 10 deletions(-)
> Signed-off-by: Paul Larson <pl@us.ibm.com>

Applied, thank you.

Ewan.

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

[-- Attachment #2: Type: text/plain, Size: 138 bytes --]

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2006-06-01 11:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-05-23 19:31 [PATCH] 01_enforce_dom0_cpus_basic_pos reset vcpu count on failures Paul Larson
2006-05-23 19:49 ` Ryan Harper
2006-05-23 20:40   ` [PATCH] (corrected) " Paul Larson
2006-06-01 11:12     ` Ewan Mellor

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.