Beispiel #1
0
    def get_dmg_command(self, index=0):
        """Get a DmgCommand setup to interact with server manager index.

        Return a DmgCommand object configured with:
            - the "-l" parameter assigned to the server's access point list
            - the "-i" parameter assigned to the server's interactive mode

        This method is intended to be used by tests that wants to use dmg to
        create and destroy pool. Pass in the object to TestPool constructor.

        Access point should be passed in to -l regardless of the number of
        servers.

        Args:
            index (int, optional): Server index. Defaults to 0.

        Returns:
            DmgCommand: New DmgCommand object.

        """
        if self.server_managers:
            return self.server_managers[index].dmg

        dmg_config_file = self.get_config_file("daos", "dmg")
        dmg_cfg = DmgYamlParameters(dmg_config_file, self.server_group,
                                    DmgTransportCredentials(self.workdir))
        dmg_cfg.hostlist.update(self.hostlist_servers[:1], "dmg.yaml.hostlist")
        return DmgCommand(self.bin, dmg_cfg)
Beispiel #2
0
def get_dmg_command(group, cert_dir, bin_dir, config_file, config_temp=None):
    """Get a dmg command object.

    Args:
        group (str): daos_server group name
        cert_dir (str): directory in which to copy certificates
        bin_dir (str): location of the dmg 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:
        DmgCommand: the dmg command object

    """
    transport_config = DmgTransportCredentials(cert_dir)
    config = DmgYamlParameters(config_file, group, transport_config)
    command = DmgCommand(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
Beispiel #3
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))