former option -i split into -N and -P for setting nodes and plcs IP addresses separat...
authorThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Fri, 23 May 2008 07:10:48 +0000 (07:10 +0000)
committerThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Fri, 23 May 2008 07:10:48 +0000 (07:10 +0000)
system/TestApiserver.py
system/TestMain.py
system/TestPlc.py
system/config_1vnodes.py
system/config_1vservers.py

index e95b94b..1a82408 100644 (file)
@@ -17,6 +17,8 @@ server_methods = [ ('GetNodes' ,  []),
                    ('AddNodeGroup' , True),
                    ('AddNodeToNodeGroup' , True),
                    ('AddInitScript' , True),
+                   ('DeleteInitScript', True),
+                   ('GetInitScripts', True),
                    ('AddSite' , True),
                    ('AddSiteAddress' , True),
                    ('DeleteSite' , True),
index 1960457..e9c14e8 100755 (executable)
@@ -45,7 +45,7 @@ build-url defaults to the last value used, as stored in arg-build-url,
    or %s
 config defaults to the last value used, as stored in arg-config,
    or %r
-ips defaults to the last value used, as stored in arg-ips,
+node-ips and plc-ips defaults to the last value used, as stored in arg-node-ips and arg-plc-ips,
    default is to use IP scanning
 steps refer to a method in TestPlc or to a step_* module
 ===
@@ -66,9 +66,12 @@ steps refer to a method in TestPlc or to a step_* module
                           help="Run all default steps")
         parser.add_option("-l","--list",action="store_true",dest="list_steps", default=False,
                           help="List known steps")
-        parser.add_option("-i","--ip",action="callback", callback=TestMain.optparse_list, dest="ips",
+        parser.add_option("-N","--nodes",action="callback", callback=TestMain.optparse_list, dest="node_ips",
                           nargs=1,type="string",
-                          help="Specify the set of IP addresses to use in vserver mode (disable scanning)")
+                          help="Specify the set of IP addresses to use for nodes (scanning disabled)")
+        parser.add_option("-P","--plcs",action="callback", callback=TestMain.optparse_list, dest="plc_ips",
+                          nargs=1,type="string",
+                          help="Specify the set of IP addresses to use for plcs (scanning disabled)")
         parser.add_option("-1","--small",action="store_true",dest="small_test",default=False,
                           help="run a small test -- typically only one node")
         parser.add_option("-d","--dbname",action="store",dest="dbname",default=None,
@@ -104,7 +107,8 @@ steps refer to a method in TestPlc or to a step_* module
         # handle defaults and option persistence
         for (recname,filename,default) in (
             ('build_url','arg-build-url',TestMain.default_build_url) ,
-            ('ips','arg-ips',[]) , 
+            ('node_ips','arg-node-ips',[]) , 
+            ('plc_ips','arg-plc-ips',[]) , 
             ('config','arg-config',TestMain.default_config) , 
             ('arch_rpms_url','arg-arch-rpms-url',"") , 
             ) :
index 1c3cb7c..6160262 100644 (file)
@@ -72,7 +72,8 @@ class TestPlc:
                      'check_initscripts', 'check_tcp',SEP,
                      'force_gather_logs', 'force_kill_qemus', 'force_record_tracker','force_free_tracker' ]
     other_steps = [ 'stop_all_vservers','fresh_install', 'cache_rpm', 'stop', SEP,
-                    'clean_sites', 'clean_nodes', 'clean_slices', 'clean_keys', SEP,
+                    'clean_initscripts', 'clean_sites', 'clean_nodes', 
+                    'clean_slices', 'clean_keys', SEP,
                     'show_boxes', 'list_all_qemus', 'list_qemus', SEP,
                     'db_dump' , 'db_restore', ' cleanup_tracker',
                     'standby_1 through 20'
@@ -556,6 +557,17 @@ class TestPlc:
             self.apiserver.AddInitScript(self.auth_root(),initscript['initscript_fields'])
         return True
 
+    def clean_initscripts (self):
+        for initscript in self.plc_spec['initscripts']:
+            initscript_name = initscript['initscript_fields']['name']
+            print('Attempting to delete %s in plc %s'%(initscript_name,self.plc_spec['name']))
+            try:
+                self.apiserver.DeleteInitScript(self.auth_root(),initscript_name)
+                print initscript_name,'deleted'
+            except:
+                print 'deletion went wrong - probably did not exist'
+        return True
+
     def slices (self):
         return self.do_slices()
 
index a37ef1f..4fdb5d3 100644 (file)
@@ -22,9 +22,9 @@ def config (plcs, options):
     all_nodenames = test_mapper.node_names()
     maps = []
     for nodename in all_nodenames:
-        if len(options.ips) != 0:
-            ip=options.ips[0]
-            options.ips=options.ips[1:]
+        if len(options.node_ips) != 0:
+            ip=options.node_ips[0]
+            options.node_ips=options.node_ips[1:]
             (hostname,ip,mac)=test_pool.locate(ip)
         else:
             (hostname,ip,mac) = test_pool.next_free()
index 5e515de..98e9de6 100644 (file)
@@ -12,16 +12,16 @@ def config (plcs,options):
 
     test_pool = TestPool (onelab_plcs_pool,options)
 
-    if len(options.ips) != 0:
-        utils.header('Using user-provided IPS:\nips=%r'%options.ips)
-        options.ips.reverse()
+    if len(options.plc_ips) != 0:
+        utils.header('Using user-provided IPS:\nplc_ips=%r'%options.plc_ips)
+        options.plc_ips.reverse()
 
     plc_counter=0
     for plc in plcs:
         try:
-            if len(options.ips) != 0:
-                ip=options.ips[0]
-                options.ips=options.ips[1:]
+            if len(options.plc_ips) != 0:
+                ip=options.plc_ips[0]
+                options.plc_ips=options.plc_ips[1:]
                 (hostname,ip,mac)=test_pool.locate(ip)
                 utils.header("Using user-provided %s %s for plc %s"%(
                         hostname,ip,plc['name']))