Esempio n. 1
0
def get_server_command(group, cert_dir, bin_dir, config_file, config_temp=None):
    """Get the daos_server 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 = DaosServerTransportCredentials(cert_dir)
    common_config = CommonConfig(group, transport_config)
    config = DaosServerYamlParameters(config_file, common_config)
    command = DaosServerCommand(bin_dir, config)
    if config_temp:
        # Setup the DaosServerCommand 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. 2
0
    def start_servers(self, server_groups=None):
        """Start the daos_server processes.

        Args:
            server_groups (dict, optional): dictionary of lists of hosts on
                which to start the daos server 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 server on all server
                hosts specified in the test's yaml file.

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

        """
        if server_groups is None:
            server_groups = {self.server_group: self.hostlist_servers}

        self.log.debug("--- STARTING SERVER GROUPS: %s ---", server_groups)

        if isinstance(server_groups, dict):
            for group, hosts in server_groups.items():
                transport = DaosServerTransportCredentials(self.workdir)
                # Use the unique agent group name to create a unique yaml file
                config_file = self.get_config_file(group, "server")
                dmg_config_file = self.get_config_file(group, "dmg")
                # Setup the access points with the server hosts
                common_cfg = CommonConfig(group, transport)

                self.add_server_manager(config_file, dmg_config_file,
                                        common_cfg)
                self.configure_manager("server", self.server_managers[-1],
                                       hosts, self.hostfile_servers_slots,
                                       hosts)
            self.start_server_managers()
Esempio n. 3
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. 4
0
    def add_server_manager(self,
                           config_file=None,
                           dmg_config_file=None,
                           common_cfg=None,
                           timeout=20):
        """Add a new daos server manager object to the server manager list.

        When adding multiple server managers unique yaml config file names
        and common config setting (due to the server group name) should be used.

        Args:
            config_file (str, optional): daos server config file name. Defaults
                to None, which will use a default file name.
            dmg_config_file (str, optional): dmg config file name. Defaults
                to None, which will use a default file name.
            common_cfg (CommonConfig, optional): daos server 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
                server to start before reporting an error. Defaults to 60.
        """
        self.log.info("--- ADDING SERVER MANAGER ---")

        # Setup defaults
        if config_file is None:
            config_file = self.get_config_file("daos", "server")
        if common_cfg is None:
            common_cfg = CommonConfig(
                self.server_group,
                DaosServerTransportCredentials(self.workdir))

        if dmg_config_file is None:
            dmg_config_file = self.get_config_file("daos", "dmg")
        transport_dmg = DmgTransportCredentials(self.workdir)
        dmg_cfg = DmgYamlParameters(dmg_config_file, self.server_group,
                                    transport_dmg)
        # Create a ServerCommand to manage with a new ServerManager object
        server_cfg = DaosServerYamlParameters(config_file, common_cfg)
        server_cmd = DaosServerCommand(self.bin, server_cfg, timeout)
        self.server_managers.append(
            DaosServerManager(server_cmd, self.manager_class, dmg_cfg))
Esempio n. 5
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()