Esempio n. 1
0
    def add_agent_manager(self, config_file=None, common_cfg=None, timeout=15):
        """Add a new daos agent manager object to the agent manager list.

        Args:
            config_file (str, optional): daos agent config file name. Defaults
                to None, which will use a default file name.
            common_cfg (CommonConfig, optional): daos agent config file
                settings shared between the agent and server. Defaults to None,
                which uses the class CommonConfig.
            timeout (int, optional): number of seconds to wait for the daos
                agent to start before reporting an error. Defaults to 60.
        """
        self.log.info("--- ADDING AGENT MANAGER ---")

        # Setup defaults
        if config_file is None:
            config_file = self.get_config_file("daos", "agent")
        if common_cfg is None:
            agent_transport = DaosAgentTransportCredentials(self.workdir)
            common_cfg = CommonConfig(self.server_group, agent_transport)
        # Create an AgentCommand to manage with a new AgentManager object
        agent_cfg = DaosAgentYamlParameters(config_file, common_cfg)
        agent_cmd = DaosAgentCommand(self.bin, agent_cfg, timeout)
        self.agent_managers.append(
            DaosAgentManager(agent_cmd, self.manager_class))
Esempio n. 2
0
def get_agent_command(group, cert_dir, bin_dir, config_file, config_temp=None):
    """Get the daos_agent command object to manage.

    Args:
        group (str): daos_server group name
        cert_dir (str): directory in which to copy certificates
        bin_dir (str): location of the daos_server executable
        config_file (str): configuration file name and path
        config_temp (str, optional): file name and path to use to generate the
            configuration file locally and then copy it to all the hosts using
            the config_file specification. Defaults to None, which creates and
            utilizes the file specified by config_file.

    Returns:
        DaosServerCommand: the daos_server command object

    """
    transport_config = DaosAgentTransportCredentials(cert_dir)
    common_config = CommonConfig(group, transport_config)
    config = DaosAgentYamlParameters(config_file, common_config)
    command = DaosAgentCommand(bin_dir, config)
    if config_temp:
        # Setup the DaosAgentCommand to write the config file data to the
        # temporary file and then copy the file to all the hosts using the
        # assigned filename
        command.temporary_file = config_temp
    return command
Esempio n. 3
0
    def start_agents(self, agent_groups=None, servers=None):
        """Start the daos_agent processes.

        Args:
            agent_groups (dict, optional): dictionary of lists of hosts on
                which to start the daos agent using a unique server group name
                key. Defaults to None which will use the server group name from
                the test's yaml file to start the daos agents on all client
                hosts specified in the test's yaml file.
            servers (list): list of hosts running the daos servers to be used to
                define the access points in the agent yaml config file

        Raises:
            avocado.core.exceptions.TestFail: if there is an error starting the
                agents

        """
        if agent_groups is None:
            # Include running the daos_agent on the test control host for API
            # calls and calling the daos command from this host.
            agent_groups = {
                self.server_group: include_local_host(self.hostlist_clients)}

        self.log.debug("--- STARTING AGENT GROUPS: %s ---", agent_groups)

        if isinstance(agent_groups, dict):
            for group, hosts in agent_groups.items():
                transport = DaosAgentTransportCredentials(self.workdir)
                # Use the unique agent group name to create a unique yaml file
                config_file = self.get_config_file(group, "agent")
                # Setup the access points with the server hosts
                common_cfg = CommonConfig(group, transport)
                self.add_agent_manager(config_file, common_cfg)
                self.configure_manager(
                    "agent",
                    self.agent_managers[-1],
                    hosts,
                    self.hostfile_clients_slots,
                    servers)
            self.start_agent_managers()