From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paul Larson Subject: [PATCH] (corrected) 01_enforce_dom0_cpus_basic_pos reset vcpu count on failures. Date: Tue, 23 May 2006 15:40:14 -0500 Message-ID: <200605231540.17890.pl@us.ibm.com> References: <200605231432.05451.pl@us.ibm.com> <20060523194904.GS16876@us.ibm.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1874794700==" Return-path: In-Reply-To: <20060523194904.GS16876@us.ibm.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Mime-version: 1.0 Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org --===============1874794700== Content-Type: multipart/signed; boundary="nextPart2708415.3rHxkv9rWS"; protocol="application/pgp-signature"; micalg=pgp-sha1 Content-Transfer-Encoding: 7bit --nextPart2708415.3rHxkv9rWS Content-Type: multipart/mixed; boundary="Boundary-01=_uM3cEDtyoiBbx92" Content-Transfer-Encoding: 7bit Content-Disposition: inline --Boundary-01=_uM3cEDtyoiBbx92 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On Tuesday 23 May 2006 14:49, Ryan Harper wrote: > * Paul Larson [2006-05-23 14:33]: > > If 01_enforce_dom0_cpus_basic_pos fails, the vcpu count for dom0 does n= ot > > 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 w= ith=20 the FAIL() output and put it back to a reasonable state because the altere= d=20 state can persist not only out the end of the test run, but across xend=20 restarts and even reboots. The reason this came up is because a bug was=20 filed where a few systems were only showing one cpu in /proc/cpuinfo, but=20 they were configured for smp and had previously booted with all their=20 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 --Boundary-01=_uM3cEDtyoiBbx92 Content-Type: text/x-diff; charset="iso-8859-1"; name="01_enforce.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="01_enforce.patch" # HG changeset patch # User pl@us.ibm.com # Node ID 74b14312d90ba444a9e697c64adb10f60233261a # Parent 606db2959bd6dc7fc178e9792f0ef345e48dd35e =46ix a problem where the vcpu count for dom0 doesn't get reset back to the= =20 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 =2D-- a/tools/xm-test/tests/enforce_dom0_cpus/01_enforce_dom0_cpus_basic_po= s.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 =3D 1 max_tries =3D 10 =20 +def reset_vcpu_count(): + status, output =3D traceCommand("xm vcpu-set 0 %s"%(dom0_online_vcpus)) + if status !=3D 0: + print "WARNING!!! Unable to set vcpus back to %s, please set manua= lly"\ + %(dom0_online_vcpus) + # 1) Make sure we have a multi cpu system and dom0 has at least 2 vcpus on= line. =20 if smpConcurrencyLevel() <=3D 1: @@ -57,6 +63,7 @@ # 4) restart xend with new config os.putenv("XEND_CONFIG", "/tmp/xend-config.sxp") status =3D restartXend() +os.unsetenv("XEND_CONFIG") if check_status and status !=3D 0: ns, no =3D restartXend() if ns !=3D 0: @@ -75,7 +82,7 @@ cmd =3D "grep \"^processor\" /proc/cpuinfo | wc -l" status, output =3D traceCommand(cmd) if check_status and status !=3D 0: =2D os.unsetenv("XEND_CONFIG") + reset_vcpu_count() restartXend() FAIL("\"%s\" returned invalid %i !=3D 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 !=3D str(enforce_dom0_cpus): =2D os.unsetenv("XEND_CONFIG") + reset_vcpu_count() restartXend() FAIL("/proc/cpuinfo says xend didn't enforce dom0_cpus (%s !=3D %s)"%(= output,=20 enforce_dom0_= cpus)) @@ -92,17 +99,13 @@ # 6) count number of online cpus and see that it matches enforce value num_online =3D int(getDomInfo("Domain-0", "VCPUs")) if num_online !=3D enforce_dom0_cpus: =2D os.unsetenv("XEND_CONFIG") + reset_vcpu_count() restartXend() FAIL("xm says xend didn't enforce dom0_cpus (%s !=3D %s)" %(num_online= ,=20 enforce_dom0_= cpus)) =20 # 7) restore dead processors=20 =2Dstatus, output =3D traceCommand("xm vcpu-set 0 %s"%(dom0_online_vcpus)) =2Dif check_status and status !=3D 0: =2D os.unsetenv("XEND_CONFIG") =2D restartXend() =2D FAIL("\"%s\" returned invalid %i !=3D 0" %(cmd,status)) +reset_vcpu_count() =20 # check restore worked # Since this also takes time, we will do it in a loop with a 20 second tim= eout. @@ -114,12 +117,10 @@ break time.sleep(1) if num_online !=3D dom0_online_vcpus: =2D os.unsetenv("XEND_CONFIG") restartXend() FAIL("failed to restore dom0's VCPUs") =20 =20 # 8) Restart xend with default config =2Dos.unsetenv("XEND_CONFIG") restartXend() =20 --Boundary-01=_uM3cEDtyoiBbx92-- --nextPart2708415.3rHxkv9rWS Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2.2 (GNU/Linux) iD8DBQBEc3MxBwrpIrndMlIRAhi5AKCYN74PV+YHQz33PGjNHvpzKbfoLwCfR2kg ixT6yWBOp61LPjqve9jiS+Q= =6q26 -----END PGP SIGNATURE----- --nextPart2708415.3rHxkv9rWS-- --===============1874794700== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --===============1874794700==--