Exemple #1
0
    def _set_cont_clone_params(self,
                               src_pool=None,
                               src_cont=None,
                               dst_pool=None,
                               dst_cont=None):
        """Set the params for daos cont clone.

        This only supports DAOS -> DAOS copies.

        Args:
            src_pool (TestPool, optional): the source pool or uuid.
            src_cont (TestContainer, optional): the source cont or uuid.
            dst_pool (TestPool, optional): the destination pool or uuid.
            dst_cont (TestContainer, optional): the destination cont or uuid.

        """
        # First, initialize a new cont copy command
        self.cont_clone_cmd = ContClone(self.daos_cmd, self.log)

        # Set the source params
        if src_pool or src_cont:
            self.cont_clone_cmd.set_cont_clone_params(
                src=format_daos_path(src_pool, src_cont))

        # Set the destination params
        if dst_pool or dst_cont:
            self.cont_clone_cmd.set_cont_clone_params(
                dst=format_daos_path(dst_pool, dst_cont))
Exemple #2
0
    def _set_dserial_params(self, src_pool=None, src_cont=None, dst_pool=None):
        """Set the params for daos-serialize and daos-deserialize.

        This uses a temporary POSIX path as the intermediate step
        between serializing and deserializing.

        Args:
            src_pool (TestPool, optional): the source pool or uuid.
            src_cont (TestContainer, optional): the source cont or uuid.
            dst_pool (TestPool, optional): the destination pool or uuid.

        """
        # First initialize new commands
        self.dserialize_cmd = DserializeCommand(self.hostlist_clients,
                                                self.workdir)
        self.ddeserialize_cmd = DdeserializeCommand(self.hostlist_clients,
                                                    self.workdir)

        # Get an intermediate path for HDF5 file(s)
        tmp_path = self.new_posix_test_path(create=False,
                                            parent=self.serial_tmp_dir)

        # Set the source params for dserialize
        if src_pool or src_cont:
            self.dserialize_cmd.set_params(src_path=format_daos_path(
                src_pool, src_cont),
                                           output_path=tmp_path)

        # Set the destination params for ddeserialize
        if dst_pool:
            self.ddeserialize_cmd.set_params(src_path=tmp_path,
                                             pool=uuid_from_obj(dst_pool))
Exemple #3
0
    def _set_fs_copy_params(self,
                            src_type=None,
                            src_path=None,
                            src_pool=None,
                            src_cont=None,
                            dst_type=None,
                            dst_path=None,
                            dst_pool=None,
                            dst_cont=None):
        """Set the params for fs copy.

        daos fs copy does not support a "prefix" on UNS paths,
        so the param type for DAOS_UNS must have the path "/".

        Args:
            src_type (str): how to interpret the src params.
                Must be in PARAM_TYPES.
            src_path (str): source cont path or posix path.
            src_pool (TestPool, optional): the source pool or uuid.
            src_cont (TestContainer, optional): the source cont or uuid.
            dst_type (str): how to interpret the dst params.
                Must be in PARAM_TYPES.
            dst_path (str): destination cont path or posix path.
            dst_pool (TestPool, optional): the destination pool or uuid.
            dst_cont (TestContainer, optional): the destination cont or uuid.

        """
        if src_type is not None:
            src_type = self._validate_param_type(src_type)
        if dst_type is not None:
            dst_type = self._validate_param_type(dst_type)

        if not src_type and (src_path or src_pool or src_cont):
            self.fail("src params require src_type")
        if not dst_type and (dst_path or dst_pool or dst_cont):
            self.fail("dst params require dst_type")

        # First, initialize a new fs copy command
        self.fs_copy_cmd = FsCopy(self.daos_cmd, self.log)

        # Set the source params
        if src_type == "POSIX":
            self.fs_copy_cmd.set_fs_copy_params(src=str(src_path))
        elif src_type == "DAOS_UUID":
            self.fs_copy_cmd.set_fs_copy_params(
                src=format_daos_path(src_pool, src_cont, src_path))
        elif src_type == "DAOS_UNS":
            path = ""
            if src_cont:
                if src_path == "/":
                    path = str(src_cont.path)
                else:
                    self.fail("daos fs copy does not support a prefix")
            self.fs_copy_cmd.set_fs_copy_params(src=path)

        # Set the destination params
        if dst_type == "POSIX":
            self.fs_copy_cmd.set_fs_copy_params(dst=str(dst_path))
        elif dst_type == "DAOS_UUID":
            self.fs_copy_cmd.set_fs_copy_params(
                dst=format_daos_path(dst_pool, dst_cont, dst_path))
        elif dst_type == "DAOS_UNS":
            path = ""
            if dst_cont:
                if dst_path == "/":
                    path = str(dst_cont.path)
                else:
                    self.fail("daos fs copy does not support a prefix")
            self.fs_copy_cmd.set_fs_copy_params(dst=path)
Exemple #4
0
    def _set_dsync_params(self,
                          src_type=None,
                          src_path=None,
                          src_pool=None,
                          src_cont=None,
                          dst_type=None,
                          dst_path=None,
                          dst_pool=None,
                          dst_cont=None):
        """Set the params for dsync.
        This is a wrapper for DsyncCommand.set_params.

        When both src_type and dst_type are DAOS_UNS, a prefix will
        only work for either the src or the dst, but not both.

        Args:
            src_type (str): how to interpret the src params.
                Must be in PARAM_TYPES.
            src_path (str): source cont path or posix path.
            src_pool (TestPool, optional): the source pool or uuid.
            src_cont (TestContainer, optional): the source cont or uuid.
            dst_type (str): how to interpret the dst params.
                Must be in PARAM_TYPES.
            dst_path (str): destination cont path or posix path.
            dst_pool (TestPool, optional): the destination pool or uuid.
            dst_cont (TestContainer, optional): the destination cont or uuid.

        """
        # First, initialize a new dsync command
        self.dsync_cmd = DsyncCommand(self.hostlist_clients, self.workdir)
        self.dsync_cmd.get_params(self)

        if self.api:
            self.dcp_cmd.set_params(daos_api=self.api)

        # Set the source params
        if src_type == "POSIX":
            self.dsync_cmd.set_params(src_path=str(src_path))
        elif src_type == "DAOS_UUID":
            self.dsync_cmd.set_params(
                src_path=format_daos_path(src_pool, src_cont, src_path))
        elif src_type == "DAOS_UNS":
            if src_cont:
                if src_path == "/":
                    self.dsync_cmd.set_params(src_path=src_cont.path.value)
                else:
                    self.dsync_cmd.set_params(daos_prefix=src_cont.path.value,
                                              src_path=src_cont.path.value +
                                              src_path)

        # Set the destination params
        if dst_type == "POSIX":
            self.dsync_cmd.set_params(dst_path=str(dst_path))
        elif dst_type == "DAOS_UUID":
            self.dsync_cmd.set_params(
                dst_path=format_daos_path(dst_pool, dst_cont, dst_path))
        elif dst_type == "DAOS_UNS":
            if dst_cont:
                if dst_path == "/":
                    self.dsync_cmd.set_params(dst_path=dst_cont.path.value)
                else:
                    self.dsync_cmd.set_params(daos_prefix=dst_cont.path.value,
                                              dst_path=dst_cont.path.value +
                                              dst_path)