コード例 #1
0
    def setUp(self):
        """Define test setup to be done."""
        self.log.info("<<setUp Started>> at %s", time.ctime())
        super(SoakTestBase, self).setUp()
        self.username = getuser()
        # Initialize loop param for all tests
        self.loop = 1
        self.exclude_slurm_nodes = []
        # Setup logging directories for soak logfiles
        # self.output dir is an avocado directory .../data/
        self.log_dir = get_log_file("soak")
        self.outputsoakdir = self.outputdir + "/soak"
        # Fail if slurm partition daos_client is not defined
        if not self.client_partition:
            raise SoakTestError(
                "<<FAILED: Partition is not correctly setup for daos "
                "slurm partition>>")
        # Check if the server nodes are in the client list;
        # this will happen when only one partition is specified
        for host_server in self.hostlist_servers:
            if host_server in self.hostlist_clients:
                self.hostlist_clients.remove(host_server)
                self.exclude_slurm_nodes.append(host_server)

        # Include test node for log cleanup; remove from client list
        local_host_list = include_local_host(None)
        self.exclude_slurm_nodes.extend(local_host_list)
        if local_host_list[0] in self.hostlist_clients:
            self.hostlist_clients.remove((local_host_list[0]))
        self.log.info("<<Updated hostlist_clients %s >>",
                      self.hostlist_clients)
        if not self.hostlist_clients:
            self.fail("There are no nodes that are client only;"
                      "check if the partition also contains server nodes")
コード例 #2
0
ファイル: soak_test_base.py プロジェクト: zzh-wisdom/daos
 def setUp(self):
     """Define test setup to be done."""
     self.log.info("<<setUp Started>> at %s", time.ctime())
     super().setUp()
     # Log the version of rpms being used for this test
     cmd = "sudo dnf list daos-client"
     try:
         _ = run_command(cmd, timeout=30)
     except DaosTestError as error:
         self.log.info("No daos rpm package info available %s", error)
     self.username = getuser()
     # Initialize loop param for all tests
     self.loop = 1
     self.exclude_slurm_nodes = []
     # Setup logging directories for soak logfiles
     # self.output dir is an avocado directory .../data/
     self.log_dir = get_log_file("soak")
     self.outputsoakdir = self.outputdir + "/soak"
     # Create the remote log directories on all client nodes
     self.test_log_dir = self.log_dir + "/pass" + str(self.loop)
     self.local_pass_dir = self.outputsoakdir + "/pass" + str(self.loop)
     self.sharedlog_dir = self.tmp + "/soak"
     self.sharedsoakdir = self.sharedlog_dir + "/pass" + str(self.loop)
     # Initialize dmg cmd
     self.dmg_command = self.get_dmg_command()
     # Fail if slurm partition is not defined
     # NOTE: Slurm reservation and partition are created before soak runs.
     # CI uses partition=daos_client and no reservation.
     # A21 uses partition=normal/default and reservation=daos-test.
     # Partition and reservation names are updated in the yaml file.
     # It is assumed that if there is no reservation (CI only), then all
     # the nodes in the partition will be used for soak.
     if not self.client_partition:
         raise SoakTestError(
             "<<FAILED: Partition is not correctly setup for daos "
             "slurm partition>>")
     self.srun_params = {"partition": self.client_partition}
     if self.client_reservation:
         self.srun_params["reservation"] = self.client_reservation
     # Check if the server nodes are in the client list;
     # this will happen when only one partition is specified
     for host_server in self.hostlist_servers:
         if host_server in self.hostlist_clients:
             self.hostlist_clients.remove(host_server)
             self.exclude_slurm_nodes.append(host_server)
     # Include test node for log cleanup; remove from client list
     local_host_list = include_local_host(None)
     self.exclude_slurm_nodes.extend(local_host_list)
     if local_host_list[0] in self.hostlist_clients:
         self.hostlist_clients.remove((local_host_list[0]))
     if not self.hostlist_clients:
         self.fail(
             "There are no valid nodes in this partition to run "
             "soak. Check partition {} for valid nodes".format(
                 self.client_partition))
コード例 #3
0
ファイル: daos_agent_config.py プロジェクト: zzh-wisdom/daos
    def test_daos_agent_config_basic(self):
        """
        JIRA ID: DAOS-1508

        Test Description: Test daos_agent start/stops properly.
        on the system.

        :avocado: tags=all,daily_regression
        :avocado: tags=small,agent_start,basic
        :avocado: tags=control,daos_agent_config_test
        :avocado: tags=test_daos_agent_config_basic
        """
        # Setup the agents
        self.add_agent_manager()
        self.configure_manager("agent", self.agent_managers[-1],
                               include_local_host(self.hostlist_clients),
                               self.hostfile_clients_slots)

        # Get the input to verify
        c_val = self.params.get("config_val", "/run/agent_config_val/*/")

        # Identify the attribute and modify its value to test value
        self.assertTrue(
            self.agent_managers[-1].set_config_value(c_val[0], c_val[1]),
            "Error setting the '{}' config file parameter to '{}'".format(
                c_val[0], c_val[1]))

        # Setup the access points with the server hosts
        self.log.info("Starting agent with %s = %s, expecting it to %s",
                      c_val[0], c_val[1], c_val[2])

        try:
            self.agent_managers[-1].start()
            exception = None
        except CommandFailure as err:
            exception = err

        # Verify
        if c_val[2] == "FAIL" and exception is None:
            self.log.error("Agent was expected to fail")
            self.fail(
                "Starting agent completed successfully when it was expected to "
                "fail with {} = {}".format(c_val[0], c_val[1]))
        elif c_val[2] == "PASS" and exception is not None:
            self.log.error("Agent was expected to start")
            self.fail("Starting agent failed when it was expected to complete "
                      "successfully with {} = {}: {}".format(
                          c_val[0], c_val[1], exception))

        self.log.info("Test passed - starting the agent with %s = %s %sed",
                      c_val[0], c_val[1], c_val[2].lower())
コード例 #4
0
ファイル: daos_core_base.py プロジェクト: yiyuanliu/daos
    def setUp(self):
        """Set up before each test."""
        self.subtest_name = self.get_test_param("test_name")
        self.subtest_name = self.subtest_name.replace(" ", "_")

        # obtain separate logs
        self.update_log_file_names(self.subtest_name)

        super(DaosCoreBase, self).setUp()

        # if no client specified update self.hostlist_clients to local host
        # and create a new self.hostfile_clients.
        if self.hostlist_clients is None:
            self.hostlist_clients = include_local_host(self.hostlist_clients)
            self.hostfile_clients = write_host_file.write_host_file(
                self.hostlist_clients, self.workdir, None)
コード例 #5
0
ファイル: soak.py プロジェクト: marcelarosalesj/daos
    def setUp(self):
        """Define test setup to be done."""
        self.log.info("<<setUp Started>> at %s", time.ctime())
        # Start the daos_agents in the job scripts
        self.setup_start_servers = True
        self.setup_start_agents = False
        super(SoakTestBase, self).setUp()
        self.username = getuser()
        # Initialize loop param for all tests
        self.loop = 1
        self.exclude_slurm_nodes = []
        # Setup logging directories for soak logfiles
        # self.output dir is an avocado directory .../data/
        self.log_dir = self.params.get("logdir", "/run/*")
        self.outputsoakdir = self.outputdir + "/soak"
        # Create the remote log directories on all client nodes
        self.test_log_dir = self.log_dir + "/pass" + str(self.loop)
        self.local_pass_dir = self.outputsoakdir + "/pass" + str(self.loop)
        # Fail if slurm partition daos_client is not defined
        if not self.client_partition:
            raise SoakTestError(
                "<<FAILED: Partition is not correctly setup for daos "
                "slurm partition>>")
        # Check if the server nodes are in the client list;
        # this will happen when only one partition is specified
        for host_server in self.hostlist_servers:
            if host_server in self.hostlist_clients:
                self.hostlist_clients.remove(host_server)
                self.exclude_slurm_nodes.append(host_server)
        self.log.info("<<Updated hostlist_clients %s >>",
                      self.hostlist_clients)
        if not self.hostlist_clients:
            self.fail("There are no nodes that are client only;"
                      "check if the partition also contains server nodes")

        # Include test node for log cleanup; remove from client list
        local_host_list = include_local_host(None)
        self.exclude_slurm_nodes.extend(local_host_list)

        # Start an agent on the test control host to enable API calls for
        # reserved pool and containers.  The test control host should be the
        # last host in the hostlist_clients list.
        agent_groups = {self.server_group: local_host_list}
        self.start_agents(agent_groups)
コード例 #6
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()
コード例 #7
0
    def pool_acl_verification(self,
                              current_user_acl,
                              read,
                              write,
                              secondary_grp_test=False):
        """Verify the daos pool security with an acl file.

        Steps:
            (1)Setup dmg tool for creating a pool
            (2)Generate acl file with permissions
            (3)Create a pool with acl
            (4)Verify the pool create status
            (5)Get the pool's acl list
            (6)Verify pool's ace entry update and delete
            (7)Verify pool read operation
            (8)Verify pool write operation
            (9)Cleanup user and destroy pool

        Args:
            current_user_acl (str): acl with read write access credential.
            read (str): expecting read permission.
            write (str): expecting write permission.

        Return:
            None: pass to continue; fail to report the testlog and stop.

        """
        # (1)Create dmg command
        scm_size = self.params.get("scm_size", "/run/pool_acl/*")
        get_acl_file = self.params.get("acl_file", "/run/pool_acl/*",
                                       "acl_test.txt")
        acl_file = os.path.join(self.tmp, get_acl_file)
        num_user = self.params.get("num_user", "/run/pool_acl/*")
        num_group = self.params.get("num_group", "/run/pool_acl/*")
        self.hostlist_clients = agu.include_local_host(self.hostlist_clients)

        # (2)Generate acl file with permissions
        self.log.info("  (1)Generate acl file with user/group permissions")
        permission_list = self.create_pool_acl(num_user, num_group,
                                               current_user_acl, acl_file)

        # (3)Create a pool with acl
        self.dmg.exit_status_exception = False
        data = self.dmg.pool_create(scm_size, acl_file=acl_file)
        self.dmg.exit_status_exception = True
        self.log.info("  (2)dmg= %s", self.dmg)
        self.log.info("  (3)Create a pool with acl")

        # (4)Verify the pool create status
        self.log.info("  (4)dmg.run() result=\n%s", self.dmg.result)
        if "ERR" in self.dmg.result.stderr:
            self.fail("##(4)Unable to parse pool uuid and svc.")

        # (5)Get the pool's acl list
        #    dmg pool get-acl --pool <UUID>
        self.log.info("  (5)Get a pool's acl list by: "
                      "dmg pool get-acl --pool --hostlist")
        pool_acl_list = self.get_pool_acl_list(data["uuid"])
        self.log.info("   pool original permission_list: %s", permission_list)
        self.log.info("   pool get_acl  permission_list: %s", pool_acl_list)

        # (6)Verify pool acl ace update and delete
        self.log.info("  (6)Verify update and delete of pool's acl entry.")
        tmp_ace = "daos_ci_test_new"
        new_entries = [
            secTestBase.acl_entry("user", tmp_ace, "", PERMISSIONS),
            secTestBase.acl_entry("group", tmp_ace, "", PERMISSIONS)
        ]
        acl_principals = [
            secTestBase.acl_principal("user", tmp_ace),
            secTestBase.acl_principal("group", tmp_ace)
        ]
        for new_entry in new_entries:
            self.update_pool_acl_entry(data["uuid"], "update", new_entry)
        for principal in acl_principals:
            self.update_pool_acl_entry(data["uuid"], "delete", principal)

        # (7)Verify pool read operation
        #    daos pool query --pool <uuid>
        self.log.info("  (7)Verify pool read by: daos pool query --pool")
        self.verify_pool_readwrite(data["svc"],
                                   data["uuid"],
                                   "read",
                                   expect=read)

        # (8)Verify pool write operation
        #    daos container create --pool <uuid>
        self.log.info(
            "  (8)Verify pool write by: daos container create --pool")
        self.verify_pool_readwrite(data["svc"],
                                   data["uuid"],
                                   "write",
                                   expect=write)
        if secondary_grp_test:
            self.log.info("  (8-0)Verifying verify_pool_acl_prim_sec_groups")
            self.verify_pool_acl_prim_sec_groups(pool_acl_list, acl_file,
                                                 data["uuid"], data["svc"])

        # (9)Cleanup user and destroy pool
        self.log.info("  (9)Cleanup users and groups")
        self.cleanup_user_group(num_user, num_group)
コード例 #8
0
 def setUp(self):
     """Define test setup to be done."""
     self.log.info("<<setUp Started>> at %s", time.ctime())
     super(SoakTestBase, self).setUp()
     self.username = getuser()
     # Initialize loop param for all tests
     self.loop = 1
     self.exclude_slurm_nodes = []
     # Setup logging directories for soak logfiles
     # self.output dir is an avocado directory .../data/
     self.log_dir = get_log_file("soak")
     self.outputsoakdir = self.outputdir + "/soak"
     # Create the remote log directories on all client nodes
     self.test_log_dir = self.log_dir + "/pass" + str(self.loop)
     self.local_pass_dir = self.outputsoakdir + "/pass" + str(self.loop)
     self.sharedlog_dir = self.tmp + "/soak"
     self.sharedsoakdir = self.sharedlog_dir + "/pass" + str(self.loop)
     # Fail if slurm partition is not defined
     if not self.client_partition:
         raise SoakTestError(
             "<<FAILED: Partition is not correctly setup for daos "
             "slurm partition>>")
     # Check if the server nodes are in the client list;
     # this will happen when only one partition is specified
     for host_server in self.hostlist_servers:
         if host_server in self.hostlist_clients:
             self.hostlist_clients.remove(host_server)
             self.exclude_slurm_nodes.append(host_server)
     # Include test node for log cleanup; remove from client list
     local_host_list = include_local_host(None)
     self.exclude_slurm_nodes.extend(local_host_list)
     if local_host_list[0] in self.hostlist_clients:
         self.hostlist_clients.remove((local_host_list[0]))
     # Check if requested reservation is allowed in partition
     # NOTE: Slurm reservation and partition are created before soak runs.
     # CI uses partition=daos_client and no reservation.
     # A21 uses partition=normal/default and reservation=daos-test.
     # Partition and reservation names are updated in the yaml file.
     # It is assumed that if there is no reservation (CI only), then all
     # the nodes in the partition will be used for soak.
     self.srun_params = {"partition": self.client_partition}
     slurm_reservation = self.params.get(
         "reservation", "/run/srun_params/*")
     if slurm_reservation is not None:
         # verify that the reservation is valid
         reserved_nodes = slurm_utils.get_reserved_nodes(
             slurm_reservation, self.client_partition)
         if not reserved_nodes:
             # client nodes are invalid for requested reservation
             self.hostlist_clients = []
             raise SoakTestError(
                 "<<FAILED: Reservation {} is invalid "
                 "in partition {}>>".format(
                     slurm_reservation, self.client_partition))
         # update srun params
         self.srun_params["reservation"] = slurm_reservation
     self.log.info(
         "<<Updated hostlist_clients %s >>", self.hostlist_clients)
     if not self.hostlist_clients:
         self.fail(
             "There are no valid nodes in this partition to run "
             "soak. Check partition {} for valid nodes".format(
                 self.client_partition))
コード例 #9
0
ファイル: dfuse_test_base.py プロジェクト: kjacque/daos
 def setUp(self):
     """Setup Test Case"""
     super().setUp()
     # using localhost as client if client list is empty
     if self.hostlist_clients is None:
         self.hostlist_clients = agu.include_local_host(None)