Ejemplo n.º 1
0
    def __init__(self, group, bin_dir,
                 svr_cert_dir, svr_config_file, dmg_cert_dir, dmg_config_file,
                 svr_config_temp=None, dmg_config_temp=None, manager="Orterun",
                 namespace="/run/server_manager/*"):
        """Initialize a DaosServerManager object.

        Args:
            group (str): daos_server group name
            binary_dir (str): directory from which to run daos_server/dmg
            svr_cert_dir (str): directory in which to copy server certificates
            svr_config_file (str): daos_server configuration file name and path
            dmg_cert_dir (str): directory in which to copy dmg certificates
            dmg_config_file (str): dmg configuration file name and path
            svr_config_temp (str, optional): file name and path used to generate
                the daos_server configuration file locally and copy it to all
                the hosts using the config_file specification. Defaults to None.
            dmg_config_temp (str, optional): file name and path used to generate
                the dmg command configuration file locally and copy it to all
                the hosts using the config_file specification. Defaults to None.
            manager (str, optional): the name of the JobManager class used to
                manage the YamlCommand defined through the "job" attribute.
                Defaults to "Orterun".
            namespace (str): yaml namespace (path to parameters)
        """
        self.group = group
        server_command = get_server_command(
            group, svr_cert_dir, bin_dir, svr_config_file, svr_config_temp)
        super().__init__(server_command, manager, namespace)
        self.manager.job.sub_command_override = "start"

        # Dmg command to access this group of servers which will be configured
        # to access the daos_servers when they are started
        self.dmg = get_dmg_command(group, dmg_cert_dir, bin_dir, dmg_config_file, dmg_config_temp)

        # Set the correct certificate file ownership
        if manager == "Systemctl":
            self.manager.job.certificate_owner = "daos_server"
            self.dmg.certificate_owner = getuser()

        # Server states
        self._states = {
            "all": [
                "awaitformat", "starting", "ready", "joined", "stopping",
                "stopped", "excluded", "errored", "unresponsive", "unknown"],
            "running": ["ready", "joined"],
            "stopped": [
                "stopping", "stopped", "excluded", "errored", "unresponsive", "unknown"],
            "errored": ["errored"],
        }

        # Storage and network information
        self.information = DaosServerInformation(self.dmg)

        # Flag used to determine which method is used to detect that the server has started
        self.detect_start_via_dmg = False

        # Parameters to set storage prepare and format timeout
        self.storage_prepare_timeout = BasicParameter(None, 40)
        self.storage_format_timeout = BasicParameter(None, 40)
Ejemplo n.º 2
0
    def __init__(self,
                 group,
                 bin_dir,
                 svr_cert_dir,
                 svr_config_file,
                 dmg_cert_dir,
                 dmg_config_file,
                 svr_config_temp=None,
                 dmg_config_temp=None,
                 manager="Orterun"):
        """Initialize a DaosServerManager object.

        Args:
            group (str): daos_server group name
            binary_dir (str): directory from which to run daos_server/dmg
            svr_cert_dir (str): directory in which to copy server certificates
            svr_config_file (str): daos_server configuration file name and path
            dmg_cert_dir (str): directory in which to copy dmg certificates
            dmg_config_file (str): dmg configuration file name and path
            svr_config_temp (str, optional): file name and path used to generate
                the daos_server configuration file locally and copy it to all
                the hosts using the config_file specification. Defaults to None.
            dmg_config_temp (str, optional): file name and path used to generate
                the dmg command configuration file locally and copy it to all
                the hosts using the config_file specification. Defaults to None.
            manager (str, optional): the name of the JobManager class used to
                manage the YamlCommand defined through the "job" attribute.
                Defaults to "Orterun".
        """
        server_command = get_server_command(group, svr_cert_dir, bin_dir,
                                            svr_config_file, svr_config_temp)
        super(DaosServerManager, self).__init__(server_command, manager)
        self.manager.job.sub_command_override = "start"

        # Dmg command to access this group of servers which will be configured
        # to access the daos_servers when they are started
        self.dmg = get_dmg_command(group, dmg_cert_dir, bin_dir,
                                   dmg_config_file, dmg_config_temp)

        # Set the correct certificate file ownership
        if manager == "Systemctl":
            self.manager.job.certificate_owner = "daos_server"
            self.dmg.certificate_owner = getuser()

        # An internal dictionary used to define the expected states of each
        # server rank when checking their states. It will be populated with
        # the dictionary output of DmgCommand.system_query() when any of the
        # following methods are called:
        #   - start()
        #   - verify_expected_states(set_expected=True)
        # Individual rank states may also be updated by calling the
        # update_expected_states() method. This is required to mark any rank
        # stopped by a test with the correct state to avoid errors being raised
        # during tearDown().
        self._expected_states = {}
Ejemplo n.º 3
0
    def __init__(self, group, bin_dir,
                 svr_cert_dir, svr_config_file, dmg_cert_dir, dmg_config_file,
                 svr_config_temp=None, dmg_config_temp=None, manager="Orterun"):
        """Initialize a DaosServerManager object.

        Args:
            group (str): daos_server group name
            binary_dir (str): directory from which to run daos_server/dmg
            svr_cert_dir (str): directory in which to copy server certificates
            svr_config_file (str): daos_server configuration file name and path
            dmg_cert_dir (str): directory in which to copy dmg certificates
            dmg_config_file (str): dmg configuration file name and path
            svr_config_temp (str, optional): file name and path used to generate
                the daos_server configuration file locally and copy it to all
                the hosts using the config_file specification. Defaults to None.
            dmg_config_temp (str, optional): file name and path used to generate
                the dmg command configuration file locally and copy it to all
                the hosts using the config_file specification. Defaults to None.
            manager (str, optional): the name of the JobManager class used to
                manage the YamlCommand defined through the "job" attribute.
                Defaults to "Orterun".
        """
        server_command = get_server_command(
            group, svr_cert_dir, bin_dir, svr_config_file, svr_config_temp)
        super().__init__(server_command, manager)
        self.manager.job.sub_command_override = "start"

        # Dmg command to access this group of servers which will be configured
        # to access the daos_servers when they are started
        self.dmg = get_dmg_command(
            group, dmg_cert_dir, bin_dir, dmg_config_file, dmg_config_temp)

        # Set the correct certificate file ownership
        if manager == "Systemctl":
            self.manager.job.certificate_owner = "daos_server"
            self.dmg.certificate_owner = getuser()

        # Server states
        self._states = {
            "all": [
                "awaitformat", "starting", "ready", "joined", "stopping",
                "stopped", "evicted", "errored", "unresponsive", "unknown"],
            "running": ["ready", "joined"],
            "stopped": [
                "stopping", "stopped", "evicted", "errored", "unresponsive",
                "unknown"],
            "errored": ["errored"],
        }
Ejemplo n.º 4
0
    def test_destroy_wrong_group(self):
        """Test destroying a pool with wrong server group.

        Test Steps:
        Two servers run with different group names, daos_server_a and
        daos_server_b. A pool is created on daos_server_a. Try destroying this
        pool specifying daos_server_b.

        We create a third dmg config file and specify the wrong server name in
        the name field and the right hostlist as below.

        daos_control_a.yml
        hostlist:
        - wolf-a
        name: daos_server_a

        daos_control_b.yml
        hostlist:
        - wolf-b
        name: daos_server_b

        daos_control_c.yml
        hostlist:
        - wolf-a
        name: daos_server_b

        We'll use daos_control_c.yml during dmg pool destroy and verify that it
        fails. It should show something like:
        "request system does not match running system (daos_server_b !=
        daos_server_a)"

        :avocado: tags=all,full_regression
        :avocado: tags=vm
        :avocado: tags=pool,pool_destroy
        :avocado: tags=pool_destroy_wrong_group
        """
        server_group_a = self.server_group + "_a"
        server_group_b = self.server_group + "_b"

        # Prepare and configure dmg config files for a and b.
        dmg_config_file_a = get_default_config_file(name="control_a")
        dmg_config_temp_a = self.get_config_file(name=server_group_a,
                                                 command="dmg",
                                                 path=self.test_dir)
        dmg_config_file_b = get_default_config_file(name="control_b")
        dmg_config_temp_b = self.get_config_file(name=server_group_b,
                                                 command="dmg",
                                                 path=self.test_dir)

        # Prepare server group info with corresponding dmg config file.
        group_info_a = self.get_group_info(hosts=[self.hostlist_servers[0]],
                                           dmg_config_file=dmg_config_file_a,
                                           dmg_config_temp=dmg_config_temp_a)
        group_info_b = self.get_group_info(hosts=[self.hostlist_servers[1]],
                                           dmg_config_file=dmg_config_file_b,
                                           dmg_config_temp=dmg_config_temp_b)

        # Put everything into a dictionary and start server a and b.
        server_groups_a_b = {
            server_group_a: group_info_a,
            server_group_b: group_info_b
        }
        self.start_servers(server_groups=server_groups_a_b)

        self.add_pool(connect=False)

        # Get dmg_c instance that uses daos_control_c.yml. Server group is b.
        cert_dir = os.path.join(os.sep, "etc", "daos", "certs")
        dmg_config_file_c = get_default_config_file(name="control_c")
        dmg_config_temp_c = self.get_config_file(name=server_group_b,
                                                 command="dmg",
                                                 path=self.test_dir)
        dmg_c = get_dmg_command(group=server_group_b,
                                cert_dir=cert_dir,
                                bin_dir=self.bin,
                                config_file=dmg_config_file_c,
                                config_temp=dmg_config_temp_c)

        # Update the third server manager's hostlist from "localhost" to
        # daos_server_a's hostname.
        dmg_c.hostlist = self.hostlist_servers[:1]

        # Try destroying the pool in server a with dmg_c. Should fail because
        # of the group name mismatch.
        case_c = "Pool is in a, hostlist is a, and name is b."
        self.validate_pool_destroy(hosts=[self.hostlist_servers[0]],
                                   case=case_c,
                                   exception_expected=True,
                                   new_dmg=dmg_c)

        # Try destroying the pool in server a with the dmg that uses
        # daos_control_b.yml. Should fail because the pool doesn't exist in b.
        case_b = "Pool is in a, hostlist is b, and name is b."
        self.validate_pool_destroy(hosts=[self.hostlist_servers[0]],
                                   case=case_b,
                                   exception_expected=True,
                                   new_dmg=self.server_managers[1].dmg)

        # Try destroying the pool in server a with the dmg that uses
        # daos_control_a.yml. Should pass.
        case_a = "Pool is in a, hostlist is a, and name is a."
        self.validate_pool_destroy(hosts=[self.hostlist_servers[0]],
                                   case=case_a,
                                   exception_expected=False,
                                   new_dmg=self.server_managers[0].dmg)
Ejemplo n.º 5
0
    def test_destroy_invalid_group(self):
        """Test destroying a pool with invalid server group.

        Test Steps:
        Run a server with group name "daos_server_a" and create a pool on it.
        Try destroying this pool specifying daos_server_i. "i" for invalid.

        We create a second dmg config file and specify the invalid server name
        in the name field and the right hostlist as below.

        daos_control_a.yml
        hostlist:
        - wolf-a
        name: daos_server_a

        daos_control_i.yml
        hostlist:
        - wolf-a
        name: daos_server_i

        We'll use daos_control_i.yml during dmg pool destroy and verify that it
        fails. It should show something like:
        "request system does not match running system (daos_server_i !=
        daos_server_a)"

        :avocado: tags=all,full_regression
        :avocado: tags=pool,destroy,destroy_invalid_group
        """
        server_group_a = self.server_group + "_a"
        server_group_i = self.server_group + "_i"

        # Prepare and configure dmg config files for a.
        dmg_config_file_a = get_default_config_file(name="control_a")
        dmg_config_temp_a = self.get_config_file(name=server_group_a,
                                                 command="dmg",
                                                 path=self.test_dir)

        # Prepare server group info with corresponding dmg config file.
        group_info_a = self.get_group_info(hosts=[self.hostlist_servers[0]],
                                           dmg_config_file=dmg_config_file_a,
                                           dmg_config_temp=dmg_config_temp_a)

        # Put everything into a dictionary and start server a.
        server_groups_a = {
            server_group_a: group_info_a,
        }
        self.start_servers(server_groups=server_groups_a)

        self.add_pool(connect=False)

        # Get dmg_i instance that uses daos_control_i.yml. Server group is i.
        cert_dir = os.path.join(os.sep, "etc", "daos", "certs")
        dmg_config_file_i = get_default_config_file(name="control_i")
        dmg_config_temp_i = self.get_config_file(name=server_group_i,
                                                 command="dmg",
                                                 path=self.test_dir)
        dmg_i = get_dmg_command(group=server_group_i,
                                cert_dir=cert_dir,
                                bin_dir=self.bin,
                                config_file=dmg_config_file_i,
                                config_temp=dmg_config_temp_i)

        # Update the second server manager's hostlist from "localhost" to
        # daos_server_a's hostname.
        dmg_i.hostlist = self.hostlist_servers[0]

        # Try destroying the pool in server a with dmg_i. Should fail because
        # of the group name mismatch.
        case_i = "Pool is in a, hostlist is a, and name is i."
        self.validate_pool_destroy(hosts=[self.hostlist_servers[0]],
                                   case=case_i,
                                   exception_expected=True,
                                   new_dmg=dmg_i)

        # Try destroying the pool in server a with the dmg that uses
        # daos_control_a.yml. Should pass.
        case_a = "Pool is in a, hostlist is a, and name is a."
        self.validate_pool_destroy(hosts=[self.hostlist_servers[0]],
                                   case=case_a,
                                   exception_expected=False,
                                   new_dmg=self.server_managers[0].dmg)