コード例 #1
0
ファイル: global_handle.py プロジェクト: yiyuanliu/daos
    def check_handle(self, pool_glob_handle, uuidstr, cont_glob_handle, rank):
        """Verify that the global handles can be turned into local handles.

        This gets run in a child process and verifies the global handles can be
        turned into local handles in another process.

        Args:
            pool_glob_handle (sharedctypes.RawValue): pool handle
            uuidstr (sharedctypes.RawArray): pool uuid
            cont_glob_handle (sharedctypes.RawValue): container handle
            rank (int): pool svc rank

        Raises:
            DaosApiError: if there was an error converting the pool handle or
                using the local pool handle to create a container.

        """
        # setup the pool and connect using global handle
        pool = DaosPool(self.context)
        pool.uuid = uuidstr
        pool.set_svc(rank)
        pool.group = "daos_server"
        buf = ctypes.cast(
            pool_glob_handle.iov_buf,
            ctypes.POINTER(ctypes.c_byte * pool_glob_handle.iov_buf_len))
        buf2 = bytearray()
        buf2.extend(buf.contents)
        pool_handle = pool.global2local(self.context, pool_glob_handle.iov_len,
                                        pool_glob_handle.iov_buf_len, buf2)

        # perform an operation that will use the new handle, if it
        # doesn't throw an exception, then all is well.
        pool.pool_query()

        # setup the container and then connect using the global handle
        container = DaosContainer(self.context)
        container.poh = pool_handle
        buf = ctypes.cast(
            cont_glob_handle.iov_buf,
            ctypes.POINTER(ctypes.c_byte * cont_glob_handle.iov_buf_len))
        buf2 = bytearray()
        buf2.extend(buf.contents)
        dummy_cont_handle = container.global2local(
            self.context, cont_glob_handle.iov_len,
            cont_glob_handle.iov_buf_len, buf2)
        # just try one thing to make sure handle is good
        container.query()
コード例 #2
0
ファイル: global_handle.py プロジェクト: yanghaomai/daos
    def check_handle(self, pool_glob_handle, uuidstr, cont_glob_handle, rank):
        """
        This gets run in a child process and verifyes the global
        handles can be turned into local handles in another process.
        """

        # setup the pool and connect using global handle
        pool = DaosPool(self.context)
        pool.uuid = uuidstr
        pool.set_svc(rank)
        pool.group = "daos_server"
        buf = ctypes.cast(pool_glob_handle.iov_buf,
                          ctypes.POINTER(ctypes.c_byte *
                                         pool_glob_handle.iov_buf_len))
        buf2 = bytearray()
        buf2.extend(buf.contents)
        pool_handle = pool.global2local(self.context,
                                        pool_glob_handle.iov_len,
                                        pool_glob_handle.iov_buf_len,
                                        buf2)

        # perform an operation that will use the new handle, if it
        # doesn't throw an exception, then all is well.
        pool.pool_query()

        # setup the container and then connect using the global handle
        container = DaosContainer(self.context)
        container.poh = pool_handle
        buf = ctypes.cast(cont_glob_handle.iov_buf,
                          ctypes.POINTER(ctypes.c_byte *
                                         cont_glob_handle.iov_buf_len))
        buf2 = bytearray()
        buf2.extend(buf.contents)
        dummy_cont_handle = container.global2local(
            self.context, cont_glob_handle.iov_len,
            cont_glob_handle.iov_buf_len, buf2)
        # just try one thing to make sure handle is good
        container.query()