Add support to autoserv for a --control-filename parameter, to allow users to
control where in the results directory autoserv will store the server control
file.

This also changes the archving stage in the scheduler to make use of this
argument, so that the control file from the archving stage is written to
control.archive and does not overwrite the control.srv from the job itself.

Signed-off-by: John Admanski <[email protected]>

--- autotest/scheduler/monitor_db.py    2010-03-08 15:45:53.000000000 -0800
+++ autotest/scheduler/monitor_db.py    2010-03-08 15:45:53.000000000 -0800
@@ -2498,7 +2498,7 @@
     def _generate_command(self, results_dir):
         return [_autoserv_path , '-p',
                 '--pidfile-label=%s' % self._pidfile_label(), '-r', 
results_dir,
-                '--use-existing-results',
+                '--use-existing-results', '--control-filename=control.archive',
                 os.path.join(drones.AUTOTEST_INSTALL_DIR, 'scheduler',
                              'archive_results.control.srv')]
 
--- autotest/server/autoserv    2010-03-08 15:45:53.000000000 -0800
+++ autotest/server/autoserv    2010-03-08 15:45:53.000000000 -0800
@@ -82,6 +82,7 @@
     ssh_port = parser.options.ssh_port
     ssh_pass = parser.options.ssh_pass
     collect_crashinfo = parser.options.collect_crashinfo
+    control_filename = parser.options.control_filename
 
     # can't be both a client and a server side test
     if client and server:
@@ -122,10 +123,12 @@
                % group_name)
         sys.exit(1)
 
+    kwargs = {'group_name': group_name, 'tag': execution_tag}
+    if control_filename:
+        kwargs['control_filename'] = control_filename
     job = server_job.server_job(control, parser.args[1:], results, label,
                                 user, machines, client, parse_job,
-                                ssh_user, ssh_port, ssh_pass,
-                                group_name=group_name, tag=execution_tag)
+                                ssh_user, ssh_port, ssh_pass, **kwargs)
     job.logging.start_logging()
     job.init_parser()
 
--- autotest/server/autoserv_parser.py  2010-03-08 15:45:53.000000000 -0800
+++ autotest/server/autoserv_parser.py  2010-03-08 15:45:53.000000000 -0800
@@ -128,6 +128,10 @@
         self.parser.add_option("--collect-crashinfo", action="store_true",
                                dest="collect_crashinfo", default=False,
                                help="just run crashinfo collection")
+        self.parser.add_option("--control-filename", action="store",
+                               type="string", default=None,
+                               help=("filename to use for the server control "
+                                     "file in the results directory"))
 
 
     def parse_args(self):
--- autotest/server/server_job.py       2010-03-08 15:45:53.000000000 -0800
+++ autotest/server/server_job.py       2010-03-08 15:45:53.000000000 -0800
@@ -66,7 +66,8 @@
     def __init__(self, control, args, resultdir, label, user, machines,
                  client=False, parse_job='',
                  ssh_user='root', ssh_port=22, ssh_pass='',
-                 group_name='', tag=''):
+                 group_name='', tag='',
+                 control_filename=SERVER_CONTROL_FILENAME):
         """
         Create a server side job object.
 
@@ -84,6 +85,8 @@
         @param group_name: If supplied, this will be written out as
                 host_group_name in the keyvals file for the parser.
         @param tag: The job execution tag from the scheduler.  [optional]
+        @param control_filename: The filename where the server control file
+                should be written in the results directory.
         """
         super(base_server_job, self).__init__(resultdir=resultdir)
 
@@ -114,6 +117,7 @@
         self.hosts = set()
         self.drop_caches = False
         self.drop_caches_between_iterations = False
+        self._control_filename = control_filename
 
         self.logging = logging_manager.get_logging_manager(
                 manage_stdout_and_stderr=True, redirect_fds=True)
@@ -433,7 +437,7 @@
                         suffix='temp_control_file_dir')
                     control_file_dir = temp_control_file_dir
                 server_control_file = os.path.join(control_file_dir,
-                                                   SERVER_CONTROL_FILENAME)
+                                                   self._control_filename)
                 client_control_file = os.path.join(control_file_dir,
                                                    CLIENT_CONTROL_FILENAME)
                 if self._client:
_______________________________________________
Autotest mailing list
[email protected]
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest

Reply via email to