Exemplo n.º 1
0
    def run_batch(self, tasks, *args, **kwargs):
        LOG.info('Threshold is %s Mb/s\n' % CONF.speed.threshold)
        LOG.info("Time start: %s UTC\n" % str(datetime.datetime.utcnow()))

        tasks, missing = self.discovery.match(tasks)
        self.test_not_found.extend(missing)

        flavor = CONF.speed.flavor_req
        avail_zone = CONF.speed.availability_zone
        tool_vm_image = CONF.speed.speed_image_path
        network = CONF.networking.network_name
        floating_net = CONF.networking.network_ext_name
        nodes_limit = CONF.speed.compute_nodes_limit

        with resources.Allocator(
                self.ctx, flavor, avail_zone, tool_vm_image,
                network, floating_net,
                nodes_limit=nodes_limit) as allocator:
            if allocator.error_during_allocation:
                # do not run tests if error appeared during resource allocation
                results = {
                    "test_failures": [],
                    "test_success": [],
                    "test_not_found": [],
                    "test_skipped": tasks,
                    "time_of_tests": {},
                    "test_without_report": []}
            else:
                context.add(self.ctx, 'allocator', allocator)
                results = super(SpeedTestRunner, self).run_batch(
                    tasks, *args, **kwargs)
        results['threshold'] = '{} Mb/s'.format(CONF.speed.threshold)
        LOG.info("\nTime end: %s UTC" % str(datetime.datetime.utcnow()))
        return results
Exemplo n.º 2
0
    def populate_cluster_nodes_info(self):
        cluster = CONF.fuel.cluster_id

        node_set = self.ctx.fuel.node.get_all(environment_id=cluster)
        node_set = self.ctx.fuel.filter_nodes_by_status(node_set)

        context.add(self.ctx, 'nodes', node_set)

        nodes_by_role = {}
        for node in node_set:
            for role in node['roles']:
                nodes_by_role.setdefault(role, []).append(node)
        if not nodes_by_role.get(mcv_config.FUEL_ROLE_CONTROLLER):
            raise mcv_consoler.exceptions.AccessError(
                'There is no any controller node')
        context.add(self.ctx, 'nodes_by_role', nodes_by_role)
Exemplo n.º 3
0
    def _do_test_plan(self, test_plan, **kwargs):
        self.results_dir = self.get_results_dir('/tmp')
        os.mkdir(self.results_dir)

        context.add(
            self.ctx, 'work_dir_global', utils.WorkDir(self.results_dir))
        context.add(self.ctx, 'work_dir', self.ctx.work_dir_global)

        self._collect_predefined_data()

        clean_up_wrapper = utils.DummyContextWrapper
        if CONF.cleanup.show_trash:
            clean_up_wrapper = cleanup.CleanUpWrapper

        with self._make_access_helper() as access_helper:
            self._update_ctx_with_access_data(access_helper)
            with clean_up_wrapper(self.ctx):
                return self._exec_tests(test_plan, **kwargs)
Exemplo n.º 4
0
    def __init__(self, ctx):
        super(Runner, self).__init__()
        self.ctx = ctx
        context.add(self.ctx, 'runner', self)

        self.current_task = 1
        self.test_failures = []
        self.test_without_report = []
        self.test_success = []
        self.test_not_found = []
        self.test_skipped = []
        self.time_of_tests = {}

        self.homedir = '/home/mcv/toolbox'

        # store mcv.conf
        for conf_path in CONF.default_config_files:
            self.store_config(os.path.abspath(conf_path))
Exemplo n.º 5
0
    def setup_connections(self):
        self.get_fuelclient_credentials()
        context.add(
            self.ctx, 'fuel', clients.FuelClientProxy(self.ctx, self.os_data))

        try:
            self.populate_cluster_nodes_info()
            self.get_os_ssh_key()
            self.setup_sshuttle_tunnel()
            self.get_openrc()
            self.populate_etc_hosts()
            self.make_sure_controller_name_could_be_resolved()
        finally:
            self.ctx.fuel.release_instance()

        LOG.debug('Connections have been set successfully.')
        # TODO(dbogun): remove return value
        return True
Exemplo n.º 6
0
 def __init__(self, ctx):
     super(SpeedTestRunner, self).__init__(ctx)
     work_dir = SpeedWorkDir.new_as_replacement(self.ctx.work_dir)
     context.add(self.ctx, 'work_dir', work_dir)
Exemplo n.º 7
0
 def _update_ctx_with_access_data(self, access_helper):
     access_data = access_helper.access_data()
     context.add(self.ctx, 'access_data', access_data)
     context.add(
         self.ctx, 'access', clients.OSClientsProxy(
             self.ctx, access_data))