I spent much time going back and forth trying to find the smallest impact way to present installer server profiles to autoserv for control file usage. Eventually, I decided that appending it to the hostname makes sense, as it's a parameter of the host selection -- i.e., I want UserW on HostX installed with ProfileY.
'#' is not a valid character in hostnames, afaik, so I think it should be safe to use as a separator. Update the parse_machine to know about this separator. Now, create_host() automatically puts in a profile object, if the host is of type InstallableHost. Signed-off-by: Nishanth Aravamudan <[email protected]> --- scheduler/monitor_db.py | 17 ++++++++++++----- server/base_utils.py | 6 +++++- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/scheduler/monitor_db.py b/scheduler/monitor_db.py index e4d5c20..d3d54a7 100644 --- a/scheduler/monitor_db.py +++ b/scheduler/monitor_db.py @@ -68,7 +68,7 @@ def _get_pidfile_timeout_secs(): return pidfile_timeout_mins * 60 -def _autoserv_command_line(machines, extra_args, job=None, +def _autoserv_command_line(machines, profiles, extra_args, job=None, queue_entry=None, verbose=True): """ @returns The autoserv command line as a list of executable + parameters. @@ -84,7 +84,10 @@ def _autoserv_command_line(machines, extra_args, job=None, autoserv_argv = [_autoserv_path, '-p', '-r', drone_manager.WORKING_DIRECTORY] if machines: - autoserv_argv += ['-m', machines] + if profiles: + autoserv_argv += ['-m', ','.join([machine + '#' + profile for machine,profile in zip(machines,profiles)])] + else: + autoserv_argv += ['-m', ','.join(machines)] if job or queue_entry: if not job: job = queue_entry.job @@ -1450,7 +1453,7 @@ class SpecialAgentTask(AgentTask, TaskWithJobKeyvals): def _command_line(self): - return _autoserv_command_line(self.host.hostname, + return _autoserv_command_line([self.host.hostname], [], self._extra_command_args, queue_entry=self.queue_entry) @@ -1714,13 +1717,17 @@ class AbstractQueueTask(AgentTask, TaskWithJobKeyvals): def _command_line(self): execution_path = self.queue_entries[0].execution_path() control_path = self._write_control_file(execution_path) - hostnames = ','.join(entry.host.hostname + hostnames = [entry.host.hostname + for entry in self.queue_entries + if not entry.is_hostless()] + profiles = [entry.profile for entry in self.queue_entries - if not entry.is_hostless()) + if not entry.is_hostless()] execution_tag = self.queue_entries[0].execution_tag() params = _autoserv_command_line( hostnames, + profiles, ['-P', execution_tag, '-n', _drone_manager.absolute_path(control_path)], job=self.job, verbose=False) diff --git a/server/base_utils.py b/server/base_utils.py index 1c58609..0654468 100644 --- a/server/base_utils.py +++ b/server/base_utils.py @@ -261,10 +261,14 @@ def parse_machine(machine, user='root', password='', port=22): machine, port = machine.split(':', 1) port = int(port) + profile = '' + if '#' in machine: + machine, profile = machine.split('#', 1) + if not machine or not user: raise ValueError - return machine, user, password, port + return machine, user, password, port, profile def get_public_key(): -- 1.7.7.6 -- Nishanth Aravamudan <[email protected]> IBM Linux Technology Center _______________________________________________ Autotest mailing list [email protected] http://test.kernel.org/cgi-bin/mailman/listinfo/autotest
