예제 #1
0
    def tearDown(self):

        try:
            if self.container:
                self.container.close()

            # wait a few seconds and then destroy
            time.sleep(5)
            if self.container:
                self.container.destroy()

            # cleanup the pool
            if self.pool:
                self.pool.disconnect()
                self.pool.destroy(1)

            if self.hostfile is not None:
                os.remove(self.hostfile)

        except DaosApiError as excep:
            print(excep)
            print(traceback.format_exc())
            self.fail("Test failed during teardown.\n")

        finally:
            if self.agent_sessions:
                AgentUtils.stop_agent(self.hostlist, self.agent_sessions)
            server_utils.stop_server(hosts=self.hostlist)
예제 #2
0
 def tearDown(self):
     try:
         os.remove(self.hostfile)
     finally:
         if self.agent_sessions:
             AgentUtils.stop_agent(self.hostlist, self.agent_sessions)
         server_utils.stop_server(hosts=self.hostlist)
예제 #3
0
    def test_simple_delete(self):
        """
        Test destroying a pool created on a single server, nobody is using
        the pool, force is not needed.

        :avocado: tags=pool,pooldestroy,quick
        """
        self.hostlist = self.params.get("test_machines1", '/run/hosts/')
        hostfile = write_host_file.write_host_file(self.hostlist, self.tmp)

        self.agent_sessions = AgentUtils.run_agent(self.basepath, self.hostlist)
        server_utils.run_server(hostfile, self.server_group, self.basepath)

        setid = self.params.get("setname",
                                '/run/setnames/validsetname/')

        try:
            # use the uid/gid of the user running the test, these should
            # be perfectly valid
            uid = os.geteuid()
            gid = os.getegid()

            # TODO make these params in the yaml
            daosctl = self.basepath + '/install/bin/daosctl'

            create_cmd = ('{0} create-pool -m {1} -u {2} -g {3} -s {4}'
                          .format(daosctl, 0x731, uid, gid, setid))

            uuid_str = """{0}""".format(process.system_output(create_cmd))
            print ("uuid is {0}\n".format(uuid_str))

            host = self.hostlist[0]
            exists = check_for_pool.check_for_pool(host, uuid_str)
            if exists != 0:
                self.fail("Pool {0} not found on host {1}.\n"
                          .format(uuid_str, host))

            delete_cmd = ('{0} destroy-pool -i {1} -s {2}'
                          .format(daosctl, uuid_str, setid))
            process.system(delete_cmd)

            exists = check_for_pool.check_for_pool(host, uuid_str)
            if exists == 0:
                self.fail("Pool {0} found on host {1} when not expected.\n"
                          .format(uuid_str, host))

        except Exception as excep:
            print(excep)
            print(traceback.format_exc())
            self.fail("Expecting to pass but test has failed.\n")

        # no matter what happens shutdown the server
        finally:
            try:
                os.remove(hostfile)
            finally:
                if self.agent_sessions:
                    AgentUtils.stop_agent(self.hostlist, self.agent_sessions)
                server_utils.stop_server(hosts=self.hostlist)
예제 #4
0
 def tearDown(self):
     try:
         if self.container:
             self.container.close()
     finally:
         if self.agent_sessions:
             AgentUtils.stop_agent(self.hostlist, self.agent_sessions)
         server_utils.stop_server(hosts=self.hostlist)
예제 #5
0
 def tearDown(self):
     try:
         if self.agent_sessions:
             AgentUtils.stop_agent(self.hostlist, self.agent_sessions)
         server_utils.stop_server(hosts=self.hostlist)
     finally:
         # really make sure everything is gone
         check_for_pool.cleanup_pools(self.hostlist)
예제 #6
0
 def tearDown(self):
     try:
         if self.pool is not None and self.pool.attached:
             self.pool.destroy(1)
     finally:
         if self.agent_sessions:
             AgentUtils.stop_agent(self.hostlist, self.agent_sessions)
         server_utils.stop_server(hosts=self.hostlist)
예제 #7
0
 def tearDown(self):
     try:
         if self.pool is not None:
             self.pool.destroy(1)
     finally:
         if self.agent_sessions:
             AgentUtils.stop_agent(self.hostlist_clients,
                                   self.agent_sessions)
     server_utils.stop_server(hosts=self.hostlist_servers)
예제 #8
0
    def test_destroy_connect(self):
        """
        Test destroying a pool that has a connected client with force == false.
        Should fail.

        :avocado: tags=pool,pooldestroy,x
        """
        host = self.hostlist[0]
        try:

            # write out a hostfile and start the servers with it
            self.hostlist = self.params.get("test_machines1", '/run/hosts/')
            hostfile = write_host_file.write_host_file(self.hostlist, self.tmp)

            self.agent_sessions = AgentUtils.run_agent(self.basepath,
                                                       self.hostlist)
            server_utils.run_server(hostfile, self.server_group, self.basepath)

            # parameters used in pool create
            createmode = self.params.get("mode", '/run/poolparams/createmode/')
            createuid = self.params.get("uid", '/run/poolparams/createuid/')
            creategid = self.params.get("gid", '/run/poolparams/creategid/')
            createsetid = self.params.get("setname",
                                          '/run/poolparams/createset/')
            createsize = self.params.get("size", '/run/poolparams/createsize/')

            # initialize a python pool object then create the underlying
            # daos storage
            pool = DaosPool(self.context)
            pool.create(createmode, createuid, creategid,
                        createsize, createsetid, None)

            # need a connection to create container
            pool.connect(1 << 1)

            # destroy pool with connection open
            pool.destroy(0)

            # should throw an exception and not hit this
            self.fail("Shouldn't hit this line.\n")

        except DaosApiError as excep:
            print("got exception which is expected so long as it is BUSY")
            print(excep)
            print(traceback.format_exc())
            # pool should still be there
            exists = check_for_pool.check_for_pool(host, pool.get_uuid_str)
            if exists != 0:
                self.fail("Pool gone, but destroy should have failed.\n")

        # no matter what happens cleanup
        finally:
            if self.agent_sessions:
                AgentUtils.stop_agent(self.hostlist, self.agent_sessions)
            server_utils.stop_server(hosts=self.hostlist)
            os.remove(hostfile)
예제 #9
0
파일: test.py 프로젝트: daos-stack/daos
    def tearDown(self):

        try:
            if self.agent_sessions:
                AgentUtils.stop_agent(self.hostlist_servers,
                                      self.agent_sessions)
        finally:
            server_utils.stop_server(hosts=self.hostlist_servers)

        super(TestWithServers, self).tearDown()
예제 #10
0
 def tearDown(self):
     try:
         self.container.close()
         self.container.destroy()
         self.pool.disconnect()
         self.pool.destroy(1)
     finally:
         if self.agent_sessions:
             AgentUtils.stop_agent(self.hostlist, self.agent_sessions)
         server_utils.stop_server(hosts=self.hostlist)
예제 #11
0
 def tearDown(self):
     try:
         if self.hostfile is not None:
             os.remove(self.hostfile)
         if self.pool:
             self.pool.destroy(1)
     finally:
         if self.agent_sessions:
             AgentUtils.stop_agent(self.hostlist, self.agent_sessions)
         server_utils.stop_server(hosts=self.hostlist)
예제 #12
0
    def tearDown(self):
        """ cleanup after the test """

        try:
            os.remove(self.hostfile)
            if self.pool:
                self.pool.destroy(1)
        finally:
            if self.agent_sessions:
                AgentUtils.stop_agent(self.hostlist, self.agent_sessions)
            server_utils.stop_server(hosts=self.hostlist)
예제 #13
0
파일: metadata.py 프로젝트: daos-stack/daos
 def tearDown(self):
     try:
         if self.pool_connect:
             self.pool.disconnect()
         if self.pool:
             self.pool.destroy(1)
     finally:
         if self.agent_sessions:
             AgentUtils.stop_agent(self.hostlist_clients,
                                   self.agent_sessions)
         server_utils.stop_server(hosts=self.hostlist)
예제 #14
0
 def tearDown(self):
     # shut 'er down
     """
     wrap pool destroy in a try; in case pool create didn't succeed, we
     still need the server to be shut down in any case
     """
     try:
         self.pool.destroy(1)
     finally:
         if self.agent_sessions:
             AgentUtils.stop_agent(self.hostlist, self.agent_sessions)
         server_utils.stop_server(hosts=self.hostlist)
예제 #15
0
 def tearDown(self):
     try:
         if self.hostfile_clients is not None:
             os.remove(self.hostfile_clients)
         if self.hostfile_servers is not None:
             os.remove(self.hostfile_servers)
         if self.pool is not None and self.pool.attached:
             self.pool.destroy(1)
     finally:
         if self.agent_sessions:
             AgentUtils.stop_agent(self.hostlist_clients,
                                   self.agent_sessions)
         server_utils.stop_server(hosts=self.hostlist_servers)
예제 #16
0
파일: open.py 프로젝트: daos-stack/daos
 def tearDown(self):
     try:
         if self.container1 is not None:
             self.container1.destroy()
         if self.container2 is not None:
             self.container2.destroy()
         if self.pool1 is not None and self.pool1.attached:
             self.pool1.destroy(1)
         if self.pool2 is not None and self.pool2.attached:
             self.pool2.destroy(1)
     finally:
         if self.agent_sessions:
             AgentUtils.stop_agent(self.hostlist, self.agent_sessions)
         server_utils.stop_server(hosts=self.hostlist)
예제 #17
0
    def test_many_servers(self):
        """
        Test destroy on a large (relative) number of servers.

        :avocado: tags=pool,pooldestroy,destroybig
        """
        try:
            # write out a hostfile and start the servers with it
            self.hostlist = self.params.get("test_machines6", '/run/hosts/')
            hostfile = write_host_file.write_host_file(self.hostlist, self.tmp)

            self.agent_sessions = AgentUtils.run_agent(self.basepath,
                                                       self.hostlist)
            server_utils.run_server(hostfile, self.server_group, self.basepath)

            # parameters used in pool create
            createmode = self.params.get("mode", '/run/poolparams/createmode/')
            createuid = self.params.get("uid", '/run/poolparams/createuid/')
            creategid = self.params.get("gid", '/run/poolparams/creategid/')
            createsetid = self.params.get("setname",
                                          '/run/poolparams/createset/')
            createsize = self.params.get("size", '/run/poolparams/createsize/')

            # initialize a python pool object then create the underlying
            # daos storage
            pool = DaosPool(self.context)
            pool.create(createmode, createuid, creategid,
                        createsize, createsetid, None)

            time.sleep(1)

            # okay, get rid of it
            pool.destroy(1)

        except DaosApiError as excep:
            print(excep)
            print(traceback.format_exc())
            self.fail("6 server test failed.\n")

        except Exception as excep:
            self.fail("Daos code segfaulted most likely.  Error: %s" % excep)

        # no matter what happens cleanup
        finally:
            if self.agent_sessions:
                AgentUtils.stop_agent(self.hostlist, self.agent_sessions)
            server_utils.stop_server(hosts=self.hostlist)
            os.remove(hostfile)
예제 #18
0
    def test_delete_doesnt_exist(self):
        """
        Test destroying a pool uuid that doesn't exist.

        :avocado: tags=pool,pooldestroy
        """
        self.hostlist = self.params.get("test_machines1", '/run/hosts/')
        hostfile = write_host_file.write_host_file(self.hostlist, self.tmp)

        self.agent_sessions = AgentUtils.run_agent(self.basepath, self.hostlist)
        server_utils.run_server(hostfile, self.server_group, self.basepath)

        setid = self.params.get("setname",
                                '/run/setnames/validsetname/')
        host = self.hostlist[0]
        try:
            # randomly selected uuid, that is exceptionally unlikely to exist
            bogus_uuid = '81ef94d7-a59d-4a5e-935b-abfbd12f2105'

            # TODO make these params in the yaml
            daosctl = self.basepath + '/install/bin/daosctl'

            delete_cmd = ('{0} destroy-pool -i {1} -s {2}'.format(daosctl,
                                                                  bogus_uuid,
                                                                  setid))

            process.system(delete_cmd)

            # the above command should fail resulting in an exception so if
            # we get here the test has failed
            self.fail("Pool {0} found on host {1} when not expected.\n"
                      .format(bogus_uuid, host))

        except Exception as _excep:
            # expecting an exception so catch and pass the test
            pass

        # no matter what happens shutdown the server
        finally:
            if self.agent_sessions:
                AgentUtils.stop_agent(self.hostlist, self.agent_sessions)
            server_utils.stop_server(hosts=self.hostlist)
            os.remove(hostfile)
예제 #19
0
    def tearDown(self):
        if self.agent_sessions:
            AgentUtils.stop_agent(self.hostlist, self.agent_sessions)
        server_utils.stop_server(hosts=self.hostlist)

        # collect up a debug log so that we have a separate one for each
        # subtest
        if self.subtest_name:
            try:
                new_logfile = os.path.join(self.log_dir,
                                           self.subtest_name + "_" + \
                                           self.server_log)
                # rename on each of the servers
                for host in self.hostlist:
                    subprocess.check_call(['ssh', host,
                                           '[ -f \"{0}\" ] && '
                                           ' mv \"{0}\" '
                                           ' \"{1}\"'.format("/tmp/server.log",
                                                             new_logfile)])
            except KeyError:
                pass
예제 #20
0
    def test_delete_wrong_servers(self):
        """
        Test destroying a pool valid pool but use the wrong server group.

        :avocado: tags=pool,pooldestroy
        """

        self.hostlist = self.params.get("test_machines1", '/run/hosts/')
        hostfile = write_host_file.write_host_file(self.hostlist, self.tmp)

        self.agent_sessions = AgentUtils.run_agent(self.basepath, self.hostlist)
        server_utils.run_server(hostfile, self.server_group, self.basepath)

        # need both a good and bad set
        goodsetid = self.params.get("setname",
                                    '/run/setnames/validsetname/')

        badsetid = self.params.get("setname",
                                   '/run/setnames/badsetname/')

        uuid_str = ""
        host = self.hostlist[0]
        # TODO make these params in the yaml
        daosctl = self.basepath + '/install/bin/daosctl'

        try:
            # use the uid/gid of the user running the test, these should
            # be perfectly valid
            uid = os.geteuid()
            gid = os.getegid()

            create_cmd = ('{0} create-pool -m {1} -u {2} -g {3} -s {4}'
                          .format(daosctl, 0x731, uid, gid, goodsetid))
            uuid_str = """{0}""".format(process.system_output(create_cmd))
            print ("uuid is {0}\n".format(uuid_str))

            exists = check_for_pool.check_for_pool(host, uuid_str)
            if exists != 0:
                self.fail("Pool {0} not found on host {1}.\n"
                          .format(uuid_str, host))

            delete_cmd = ('{0} destroy-pool -i {1} -s {2}'.format(daosctl,
                                                                  uuid_str,
                                                                  badsetid))

            process.system(delete_cmd)

            # the above command should fail resulting in an exception so if
            # we get here the test has failed
            self.fail("Pool {0} found on host {1} when not expected.\n"
                      .format(uuid_str, host))

        except Exception as _excep:
            # expecting an exception, but now need to
            # clean up the pool for real
            delete_cmd = ('{0} destroy-pool -i {1} -s {2}'
                          .format(daosctl, uuid_str, goodsetid))
            process.system(delete_cmd)

        # no matter what happens shutdown the server
        finally:
            if self.agent_sessions:
                AgentUtils.stop_agent(self.hostlist, self.agent_sessions)
            server_utils.stop_server(hosts=self.hostlist)
            os.remove(hostfile)
예제 #21
0
    def test_destroy_recreate(self):
        """
        Test destroy and recreate one right after the other multiple times
        Should fail.

        :avocado: tags=pool,pooldestroy,destroyredo
        """

        try:
            # write out a hostfile and start the servers with it
            self.hostlist = self.params.get("test_machines1", '/run/hosts/')
            hostfile = write_host_file.write_host_file(self.hostlist, self.tmp)

            self.agent_sessions = AgentUtils.run_agent(self.basepath,
                                                       self.hostlist)
            server_utils.run_server(hostfile, self.server_group, self.basepath)

            # parameters used in pool create
            createmode = self.params.get("mode", '/run/poolparams/createmode/')
            createuid = self.params.get("uid", '/run/poolparams/createuid/')
            creategid = self.params.get("gid", '/run/poolparams/creategid/')
            createsetid = self.params.get("setname",
                                          '/run/poolparams/createset/')
            createsize = self.params.get("size", '/run/poolparams/createsize/')

            # initialize a python pool object then create the underlying
            # daos storage
            pool = DaosPool(self.context)
            pool.create(createmode, createuid, creategid,
                        createsize, createsetid, None)

            # blow it away immediately
            pool.destroy(1)

            # now recreate
            pool.create(createmode, createuid, creategid,
                        createsize, createsetid, None)

            # blow it away immediately
            pool.destroy(1)

            # now recreate
            pool.create(createmode, createuid, creategid,
                        createsize, createsetid, None)

            # blow it away immediately
            pool.destroy(1)

        except DaosApiError as excep:
            print(excep)
            print(traceback.format_exc())
            self.fail("create/destroy/create/destroy test failed.\n")

        except Exception as excep:
            self.fail("Daos code segfaulted most likely.  Error: %s" % excep)

        # no matter what happens cleanup
        finally:
            if self.agent_sessions:
                AgentUtils.stop_agent(self.hostlist, self.agent_sessions)
            server_utils.stop_server(hosts=self.hostlist)
            os.remove(hostfile)
예제 #22
0
    def test_rebuild_with_io(self):
        """
        Test ID: Rebuild-003

        Test Description: Trigger a rebuild while I/O is ongoing.

        Use Cases:
          -- single pool, single client performing continous read/write/verify
             sequence while failure/rebuild is triggered in another process

        :avocado: tags=pool,rebuild,rebuildwithio
        """

        # the rebuild tests need to redo this stuff each time so not in setup
        # as it usually would be
        server_group = self.params.get("name", '/server_config/',
                                       'daos_server')

        basepath = os.path.normpath(self.build_paths['PREFIX'] + "/../")

        self.hostlist = self.params.get("test_machines", '/run/hosts/')
        hostfile = write_host_file.write_host_file(self.hostlist, self.workdir)

        try:
            self.agent_sessions = AgentUtils.run_agent(basepath, self.hostlist)
            server_utils.run_server(hostfile, server_group, basepath)

            # use the uid/gid of the user running the test, these should
            # be perfectly valid
            createuid = os.geteuid()
            creategid = os.getegid()

            # parameters used in pool create that are in yaml
            createmode = self.params.get("mode", '/run/testparams/createmode/')
            createsetid = self.params.get("setname",
                                          '/run/testparams/createset/')
            createsize = self.params.get("size", '/run/testparams/createsize/')

            # initialize a python pool object then create the underlying
            # daos storage
            pool = DaosPool(self.context)
            pool.create(createmode, createuid, creategid,
                        createsize, createsetid, None)
            pool.connect(1 << 1)
            container = DaosContainer(self.context)
            container.create(pool.handle)
            container.open()

            # get pool status and make sure it all looks good before we start
            pool.pool_query()
            if pool.pool_info.pi_ndisabled != 0:
                self.fail("Number of disabled targets reporting incorrectly.\n")
            if pool.pool_info.pi_rebuild_st.rs_errno != 0:
                self.fail("Rebuild error but rebuild hasn't run.\n")
            if pool.pool_info.pi_rebuild_st.rs_done != 1:
                self.fail("Rebuild is running but device hasn't failed yet.\n")
            if pool.pool_info.pi_rebuild_st.rs_obj_nr != 0:
                self.fail("Rebuilt objs not zero.\n")
            if pool.pool_info.pi_rebuild_st.rs_rec_nr != 0:
                self.fail("Rebuilt recs not zero.\n")
            dummy_pool_version = pool.pool_info.pi_rebuild_st.rs_version

            # do I/O for 30 seconds
            dummy_bw = io_utilities.continuous_io(container, 30)

            # trigger the rebuild
            rank = self.params.get("rank", '/run/testparams/ranks/*')
            server = DaosServer(self.context, server_group, rank)
            server.kill(1)
            pool.exclude([rank])

            # do another 30 seconds of I/O,
            # waiting for some improvements in server bootstrap
            # at which point we can move the I/O to a separate client and
            # really pound it with I/O
            dummy_bw = io_utilities.continuous_io(container, 30)

            # wait for the rebuild to finish
            while True:
                pool.pool_query()
                if pool.pool_info.pi_rebuild_st.rs_done == 1:
                    break
                else:
                    time.sleep(2)

            # check rebuild statistics
            if pool.pool_info.pi_ndisabled != 1:
                self.fail("Number of disabled targets reporting incorrectly: {}"
                          .format(pool.pool_info.pi_ndisabled))
            if pool.pool_info.pi_rebuild_st.rs_errno != 0:
                self.fail("Rebuild error reported: {}".format(
                    pool.pool_info.pi_rebuild_st.rs_errno))
            if pool.pool_info.pi_rebuild_st.rs_obj_nr <= 0:
                self.fail("No objects have been rebuilt.")
            if pool.pool_info.pi_rebuild_st.rs_rec_nr <= 0:
                self.fail("No records have been rebuilt.")

        except (ValueError, DaosApiError) as excep:
            print(excep)
            print(traceback.format_exc())
            self.fail("Expecting to pass but test has failed.\n")

        finally:
            # wait for the I/O process to finish
            try:
                server_utils.stop_server(hosts=self.hostlist)
                os.remove(hostfile)
                # really make sure everything is gone
                check_for_pool.cleanup_pools(self.hostlist)
            finally:
                if self.agent_sessions:
                    AgentUtils.stop_agent(self.hostlist, self.agent_sessions)
                server_utils.kill_server(self.hostlist)
예제 #23
0
 def tearDown(self):
     if self.agent_sessions:
         AgentUtils.stop_agent(self.hostlist, self.agent_sessions)
     server_utils.stop_server(hosts=self.hostlist)
예제 #24
0
    def test_destroy_async(self):
        """
        Performn destroy asynchronously, successful and failed.

        :avocado: tags=pool,pooldestroy,destroyasync
        """

        global GLOB_SIGNAL
        global GLOB_RC

        try:
            # write out a hostfile and start the servers with it
            self.hostlist = self.params.get("test_machines1", '/run/hosts/')
            hostfile = write_host_file.write_host_file(self.hostlist, self.tmp)

            self.agent_sessions = AgentUtils.run_agent(self.basepath,
                                                       self.hostlist)
            server_utils.run_server(hostfile, self.server_group, self.basepath)

            # parameters used in pool create
            createmode = self.params.get("mode", '/run/poolparams/createmode/')
            createuid = self.params.get("uid", '/run/poolparams/createuid/')
            creategid = self.params.get("gid", '/run/poolparams/creategid/')
            createsetid = self.params.get("setname",
                                          '/run/poolparams/createset/')
            createsize = self.params.get("size", '/run/poolparams/createsize/')

            # initialize a python pool object then create the underlying
            # daos storage
            pool = DaosPool(self.context)
            pool.create(createmode, createuid, creategid,
                        createsize, createsetid, None)

            # allow the callback to tell us when its been called
            GLOB_SIGNAL = threading.Event()

            # blow it away but this time get return code via callback function
            pool.destroy(1, cb_func)

            # wait for callback
            GLOB_SIGNAL.wait()
            if GLOB_RC != 0:
                self.fail("RC not as expected in async test")

            # recreate the pool, reset the signal, shutdown the
            # servers so call will fail and then check rc in the callback
            pool.create(createmode, createuid, creategid,
                        createsize, createsetid, None)
            GLOB_SIGNAL = threading.Event()
            GLOB_RC = -9900000
            server_utils.stop_server(hosts=self.hostlist)
            pool.destroy(1, cb_func)

            # wait for callback, expecting a timeout since servers are down
            GLOB_SIGNAL.wait()
            if GLOB_RC != -1011:
                self.fail("RC not as expected in async test")

        except DaosApiError as excep:
            print(excep)
            print(traceback.format_exc())
            self.fail("destroy async test failed.\n")

        except Exception as excep:
            self.fail("Daos code segfaulted most likely. Error: %s" % excep)

        # no matter what happens cleanup
        finally:
            if self.agent_sessions:
                AgentUtils.stop_agent(self.hostlist, self.agent_sessions)
            server_utils.stop_server(hosts=self.hostlist)
            os.remove(hostfile)
예제 #25
0
파일: metadata.py 프로젝트: daos-stack/daos
    def test_metadata_server_restart(self):
        """
        Test ID: DAOS-1512
        Test Description: This test will verify 2000 IOR small size container
                          after server restart. Test will write IOR in 5
                          different threads for faster execution time. Each
                          thread will create 400 (8bytes) containers to the
                          same pool. Restart the servers, read IOR container
                          file written previously and validate data integrity
                          by using IOR option "-R -G 1".
        :avocado: tags=metadata,metadata_ior,nvme,small
        """
        self.pool_connect = False
        files_per_thread = 400
        total_ior_threads = 5
        threads = []
        ior_args = {}

        createsvc = self.params.get("svcn", '/run/pool/createsvc/')
        svc_list = ""
        for i in range(createsvc):
            svc_list += str(int(self.pool.svc.rl_ranks[i])) + ":"
        svc_list = svc_list[:-1]

        ior_args['client_hostfile'] = self.hostfile_clients
        ior_args['pool_uuid'] = self.pool.get_uuid_str()
        ior_args['svc_list'] = svc_list
        ior_args['basepath'] = self.basepath
        ior_args['server_group'] = self.server_group
        ior_args['tmp_dir'] = self.workdir
        ior_args['iorwriteflags'] = self.params.get("F",
                                                    '/run/ior/iorwriteflags/')
        ior_args['iorreadflags'] = self.params.get("F",
                                                   '/run/ior/iorreadflags/')
        ior_args['iteration'] = self.params.get("iter", '/run/ior/iteration/')
        ior_args['stripe_size'] = self.params.get("s", '/run/ior/stripesize/*')
        ior_args['stripe_count'] = self.params.get("c", '/run/ior/stripecount/')
        ior_args['async_io'] = self.params.get("a", '/run/ior/asyncio/')
        ior_args['object_class'] = self.params.get("o", '/run/ior/objectclass/')
        ior_args['slots'] = self.params.get("slots", '/run/ior/clientslots/*')

        ior_args['files_per_thread'] = files_per_thread
        self.out_queue = Queue.Queue()

        #IOR write threads
        for i in range(total_ior_threads):
            threads.append(threading.Thread(target=ior_runner_thread,
                                            args=(self.out_queue,
                                                  "Thread-{}".format(i),
                                                  "write"),
                                            kwargs=ior_args))
        if self.thread_control(threads, "write") == "FAIL":
            self.d_log.error(" IOR write Thread FAIL")
            self.fail(" IOR write Thread FAIL")

        #Server Restart
        if self.agent_sessions:
            AgentUtils.stop_agent(self.hostlist_clients, self.agent_sessions)
        server_utils.stop_server(hosts=self.hostlist)
        self.agent_sessions = AgentUtils.run_agent(self.basepath,
                                                   self.hostlist_clients,
                                                   self.hostlist)
        server_utils.run_server(self.hostfile, self.server_group, self.basepath)

        #Read IOR with verification with same number of threads
        threads = []
        for i in range(total_ior_threads):
            threads.append(threading.Thread(target=ior_runner_thread,
                                            args=(self.out_queue,
                                                  "Thread-{}".format(i),
                                                  "read"),
                                            kwargs=ior_args))
        if self.thread_control(threads, "read") == "FAIL":
            self.d_log.error(" IOR write Thread FAIL")
            self.fail(" IOR read Thread FAIL")
예제 #26
0
    def test_bad_server_group(self):
        """
        Test destroying a pool created on server group A by passing
        in server group B, should fail.

        :avocado: tags=pool,pooldestroy
        """
        setid2 = self.basepath + self.params.get("setname",
                                                 '/run/setnames/othersetname/')

        self.hostlist1 = self.params.get("test_machines1", '/run/hosts/')
        hostfile1 = write_host_file.write_host_file(self.hostlist1, self.tmp)

        self.hostlist2 = self.params.get("test_machines2a", '/run/hosts/')
        hostfile2 = write_host_file.write_host_file(self.hostlist2, self.tmp)


        # TODO make these params in the yaml
        daosctl = self.basepath + '/install/bin/daosctl'

        # start 2 different sets of servers,
        self.agent_sessions = AgentUtils.run_agent(self.basepath,
                                                   self.hostlist1)
        self.agent_sessions2 = AgentUtils.run_agent(self.basepath,
                                                    self.hostlist2)
        server_utils.run_server(hostfile1, self.server_group, self.basepath)
        server_utils.run_server(hostfile2, setid2, self.basepath)

        host = self.hostlist1[0]

        uuid_str = ""

        try:
            # use the uid/gid of the user running the test, these should
            # be perfectly valid
            uid = os.geteuid()
            gid = os.getegid()

            create_cmd = ('{0} create-pool -m {1} -u {2} -g {3} -s {4}'
                          .format(daosctl, 0x731, uid, gid,
                                  self.server_group))
            uuid_str = """{0}""".format(process.system_output(create_cmd))
            print ("uuid is {0}\n".format(uuid_str))

            exists = check_for_pool.check_for_pool(host, uuid_str)
            if exists != 0:
                self.fail("Pool {0} not found on host {1}.\n"
                          .format(uuid_str, host))

            # try and delete it using the wrong group
            delete_cmd = ('{0} destroy-pool -i {1} -s {2}'
                          .format(daosctl, uuid_str, setid2))

            process.system(delete_cmd)

            exists = check_for_pool.check_for_pool(host, uuid_str)
            if exists != 0:
                self.fail("Pool {0} not found on host {1} but delete "
                          "should have failed.\n".format(uuid_str, host))

        except Exception as _excep:
            # now issue a good delete command so we clean-up after this test
            delete_cmd = ('{0} destroy-pool -i {1} -s {2}'
                          .format(daosctl, uuid_str, self.server_group))

            process.system(delete_cmd)

            exists = check_for_pool.check_for_pool(host, uuid_str)
            if exists == 0:
                self.fail("Pool {0} ound on host {1} but delete"
                          "should have removed it.\n"
                          .format(uuid_str, host))

        # no matter what happens shutdown the server
        finally:
            if self.agent_sessions:
                AgentUtils.stop_agent(self.hostlist1, self.agent_sessions)
            if self.agent_sessions2:
                AgentUtils.stop_agent(self.hostlist2, self.agent_sessions2)
            server_utils.stop_server(hosts=self.hostlist)
            os.remove(hostfile1)
            os.remove(hostfile2)
예제 #27
0
    def test_container_basics(self):
        """
        Test basic container create/destroy/open/close/query.  Nothing fancy
        just making sure they work at a rudimentary level

        :avocado: tags=container,containercreate,containerdestroy,basecont
        """

        pool = None
        hostlist = None

        try:
            hostlist = self.params.get("test_machines", '/run/hosts/*')
            hostfile = write_host_file.write_host_file(hostlist,
                                                       self.workdir)

            self.agent_sessions = AgentUtils.run_agent(self.basepath, hostlist)
            server_utils.run_server(hostfile, self.server_group, self.basepath)

            # give it time to start
            time.sleep(2)

            # parameters used in pool create
            createmode = self.params.get("mode", '/run/conttests/createmode/')
            createuid = self.params.get("uid", '/run/conttests/createuid/')
            creategid = self.params.get("gid", '/run/conttests/creategid/')
            createsetid = self.params.get("setname",
                                          '/run/conttests/createset/')
            createsize = self.params.get("size", '/run/conttests/createsize/')

            # initialize a python pool object then create the underlying
            # daos storage
            pool = DaosPool(self.context)
            pool.create(createmode, createuid, creategid,
                        createsize, createsetid, None)

            # need a connection to create container
            pool.connect(1 << 1)

            # create a container
            container = DaosContainer(self.context)
            container.create(pool.handle)

            # now open it
            container.open()

            # do a query and compare the UUID returned from create with
            # that returned by query
            container.query()

            if container.get_uuid_str() != c_uuid_to_str(
                    container.info.ci_uuid):
                self.fail("Container UUID did not match the one in info'n")

            container.close()

            # wait a few seconds and then destroy
            time.sleep(5)
            container.destroy()

        except DaosApiError as excep:
            print(excep)
            print(traceback.format_exc())
            self.fail("Test was expected to pass but it failed.\n")
        except Exception as excep:
            self.fail("Daos code segfaulted most likely, error: %s" % excep)
        finally:
            # cleanup the pool
            if pool is not None:
                pool.disconnect()
                pool.destroy(1)
            if self.agent_sessions:
                AgentUtils.stop_agent(hostlist, self.agent_sessions)
            server_utils.stop_server(hosts=hostlist)
예제 #28
0
    def test_destroy_withdata(self):
        """
        Test destroy and recreate one right after the other multiple times
        Should fail.

        :avocado: tags=pool,pooldestroy,destroydata
        """
        try:
            # write out a hostfile and start the servers with it
            self.hostlist = self.params.get("test_machines1", '/run/hosts/')
            hostfile = write_host_file.write_host_file(self.hostlist, self.tmp)

            self.agent_sessions = AgentUtils.run_agent(self.basepath,
                                                       self.hostlist)
            server_utils.run_server(hostfile, self.server_group, self.basepath)

            # parameters used in pool create
            createmode = self.params.get("mode", '/run/poolparams/createmode/')
            createuid = self.params.get("uid", '/run/poolparams/createuid/')
            creategid = self.params.get("gid", '/run/poolparams/creategid/')
            createsetid = self.params.get("setname",
                                          '/run/poolparams/createset/')
            createsize = self.params.get("size", '/run/poolparams/createsize/')

            # initialize a python pool object then create the underlying
            # daos storage
            pool = DaosPool(self.context)
            pool.create(createmode, createuid, creategid,
                        createsize, createsetid, None)

            # need a connection to create container
            pool.connect(1 << 1)

            # create a container
            container = DaosContainer(self.context)
            container.create(pool.handle)

            pool.disconnect()

            daosctl = self.basepath + '/install/bin/daosctl'

            write_cmd = ('{0} write-pattern -i {1} -l 0 -c {2} -p sequential'.
                         format(daosctl, c_uuid_to_str(pool.uuid),
                                c_uuid_to_str(container.uuid)))

            process.system_output(write_cmd)

            # blow it away
            pool.destroy(1)

        except DaosApiError as excep:
            print(excep)
            print(traceback.format_exc())
            self.fail("create/destroy/create/destroy test failed.\n")

        except Exception as excep:
            self.fail("Daos code segfaulted most likely.  Error: %s" % excep)

        # no matter what happens cleanup
        finally:
            if self.agent_sessions:
                AgentUtils.stop_agent(self.hostlist, self.agent_sessions)
            server_utils.stop_server(hosts=self.hostlist)
            os.remove(hostfile)