From a982337b0a4e4e2f5c7eb91b29f654983b11cdf2 Mon Sep 17 00:00:00 2001 From: Thierry Parmentelat Date: Mon, 10 Dec 2007 09:14:41 +0000 Subject: [PATCH] stores url in URL for next runs - boot from cdrom first - intermediate confif file in /tmp --- system/My-Virtual-Machine-model/nvram | Bin 0 -> 8684 bytes system/TestMain.py | 27 +++++++++++++++++++++----- system/TestPlc.py | 9 ++++++--- 3 files changed, 28 insertions(+), 8 deletions(-) create mode 100644 system/My-Virtual-Machine-model/nvram diff --git a/system/My-Virtual-Machine-model/nvram b/system/My-Virtual-Machine-model/nvram new file mode 100644 index 0000000000000000000000000000000000000000..cca6c027a105d2c3c1259f8add64546c24b1e2b4 GIT binary patch literal 8684 zcmeI0!D}2<9LGOzX0p3XH>!*=$0ko-~)d4-CKe ze)D_3_x=6mF^6|??9zw;iWf)6Kf3zCpar;H?Rg>9nk!U{vND?O@}i*}{!$}vN`qO! z`r?&!$FeNTNHoq^p#YicW7ezva2vMka-inzu3c~%!}*_H+MPnD2OiYFU5b65KR>$n zaz9E-KA+pCMJaD-xxc?3qF8Y&HG`&~>SZCsk6v>T44Ox;N-^Uz5*L+qO4 zx_@>d$XMw`_%t9};|PLYgTO)n?eRe(EO5w=fezjlbAN$R8Sl>Jq z?>$OSJAW3zXDhZ;J?OKMn-=d=m2P#-t=8OZ-F-qjnWNPL-sEUIT}GvQ)?QP+eUB== zRj;?|_hu_klC^+$EN&%Z>hP%YeehKgXX7IL$Q!d1HL2{vVjR2~hT&EihT*=THeSSm%8qHzgVE?xojYgx< m{HN$E4t>R;uQ>D-hrZ%?9DT*1(P$1YkN*)h8ja?#;QkHU{e9~I literal 0 HcmV?d00001 diff --git a/system/TestMain.py b/system/TestMain.py index 498cfbb..319716a 100755 --- a/system/TestMain.py +++ b/system/TestMain.py @@ -1,4 +1,5 @@ #!/usr/bin/env python +# $Id$ import os, sys, time from optparse import OptionParser @@ -17,7 +18,8 @@ class TestMain: def main (self): try: - usage = """usage: %prog [options] MyplcURL""" + usage = """usage: %prog [options] [myplc-url] +myplc-url defaults to the last value used, as stored in URL""" parser=OptionParser(usage=usage,version=self.subversion_id) # verbosity parser.add_option("-v","--verbose", action="store_true", dest="verbose", default=False, @@ -38,12 +40,21 @@ class TestMain: pids=[] timset=time.strftime("%H:%M:%S", time.localtime()) #test the existence of the URL - if (len (self.args)): + if (len (self.args) > 2): + parser.print_help() + sys.exit(1) + else if (len (self.args) == 1): url=self.args[0] - print 'the myplc url is ',url else: - print "PLease introduce a right URL for the myplc instal" - sys.exit(1) + try: + url=open("%s/URL"%self.path) + url=url_file.read().strip() + url_file.close() + except: + print "Cannot determine myplc url" + parser.print_help() + sys.exit(1) + print '* Using myplc url:',url #check where to display Virtual machines if (self.options.Xterm): display=self.options.Xterm @@ -60,6 +71,12 @@ class TestMain: print "no way to find the virtual file" sys.exit(1) + print 'Saving myplc url into URL' + fsave=open('%s/URL'%self.path,"w") + fsave.write(url) + fsave.write('\n') + fsave.close() + for plc_spec in TestConfig.plc_specs: print '========>Creating plc at '+timset+':',plc_spec test_plc = TestPlc(plc_spec) diff --git a/system/TestPlc.py b/system/TestPlc.py index d183e83..fca88da 100644 --- a/system/TestPlc.py +++ b/system/TestPlc.py @@ -1,3 +1,4 @@ +# $Id$ import os import sys import xmlrpclib @@ -36,7 +37,8 @@ class TestPlc: # now plc-config-tty silently creates needed directories # os.system('mkdir -p /etc/planetlab/configs') - fileconf=open('tty_conf','w') + tmpname='/tmp/plc-config-tty-%d'%os.getpid() + fileconf=open(tmpname,'w') for var in [ 'PLC_NAME', 'PLC_ROOT_PASSWORD', 'PLC_ROOT_USER', @@ -52,11 +54,12 @@ class TestPlc: fileconf.write('w\n') fileconf.write('q\n') fileconf.close() - os.system('set -x ; cat tty_conf') - os.system('set -x ; chroot /plc/root plc-config-tty < tty_conf') + os.system('set -x ; cat %s'%tmpname) + os.system('set -x ; chroot /plc/root plc-config-tty < %s'%tmpname) os.system('set -x ; service plc start') os.system('set -x; service sendmail stop') os.system('set -x; chroot /plc/root service sendmail restart') + os.system('set -x; rm %s'%tmpname) def cleanup_plc(self): os.system('service plc safestop') -- 2.47.0