stores url in URL for next runs - boot from cdrom first - intermediate confif file...
authorThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Mon, 10 Dec 2007 09:14:41 +0000 (09:14 +0000)
committerThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Mon, 10 Dec 2007 09:14:41 +0000 (09:14 +0000)
system/My-Virtual-Machine-model/nvram [new file with mode: 0644]
system/TestMain.py
system/TestPlc.py

diff --git a/system/My-Virtual-Machine-model/nvram b/system/My-Virtual-Machine-model/nvram
new file mode 100644 (file)
index 0000000..cca6c02
Binary files /dev/null and b/system/My-Virtual-Machine-model/nvram differ
index 498cfbb..319716a 100755 (executable)
@@ -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)
index d183e83..fca88da 100644 (file)
@@ -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')