From: Thierry Parmentelat Date: Mon, 10 Dec 2007 09:14:41 +0000 (+0000) Subject: stores url in URL for next runs - boot from cdrom first - intermediate confif file... X-Git-Tag: 2008-02-11-last-vmware-support~223 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=a982337b0a4e4e2f5c7eb91b29f654983b11cdf2;p=tests.git stores url in URL for next runs - boot from cdrom first - intermediate confif file in /tmp --- diff --git a/system/My-Virtual-Machine-model/nvram b/system/My-Virtual-Machine-model/nvram new file mode 100644 index 0000000..cca6c02 Binary files /dev/null and b/system/My-Virtual-Machine-model/nvram differ 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')