예제 #1
0
    def bootstrap_nodes(self, devops_nodes, timeout=settings.BOOTSTRAP_TIMEOUT,
                        skip_timesync=False):
        """Lists registered nailgun nodes
        Start vms and wait until they are registered on nailgun.
        :rtype : List of registered nailgun nodes
        """
        # self.dhcrelay_check()

        for node in devops_nodes:
            logger.info("Bootstrapping node: {}".format(node.name))
            node.start()
            # TODO(aglarendil): LP#1317213 temporary sleep
            # remove after better fix is applied
            time.sleep(5)

        with TimeStat("wait_for_nodes_to_start_and_register_in_nailgun"):
            wait(lambda: all(self.nailgun_nodes(devops_nodes)), 15, timeout,
                 timeout_msg='Bootstrap timeout for nodes: {}'
                             ''.format([node.name for node in devops_nodes]))

        wait_pass(
            lambda: checkers.validate_minimal_amount_nodes(
                nodes=self.nailgun_nodes(devops_nodes),
                expected_amount=len(devops_nodes)
            ),
            timeout=30)

        if not skip_timesync:
            self.sync_time()

        return self.nailgun_nodes(devops_nodes)
예제 #2
0
    def setup_master(self):
        """Setup master node"""
        self.check_run("empty")
        with TimeStat("setup_environment", is_uniq=True):
            self.env.setup_environment()

        self.env.make_snapshot("empty", is_make=True)
예제 #3
0
    def get_ready_setup(self):
        """Create virtual environment and install Fuel master node.
        """

        logger.info("Getting ready setup")
        if self.check_run("empty"):
            self.env.revert_snapshot("empty")
            return True
        else:
            with TimeStat("setup_environment", is_uniq=True):
                if list(self.env.d_env.get_nodes(role='fuel_master')):
                    self.env.setup_environment()
                    self.fuel_post_install_actions()

                elif list(self.env.d_env.get_nodes(role='centos_master')):
                    # need to use centos_master.yaml devops template
                    hostname = ''.join(
                        (settings.FUEL_MASTER_HOSTNAME, settings.DNS_SUFFIX))
                    self.centos_setup_fuel(hostname)
                else:
                    raise RuntimeError("No Fuel master nodes found!")

                self.env.make_snapshot("empty", is_make=True)
                self.env.resume_environment()
                return True
예제 #4
0
    def bootstrap_nodes(self, devops_nodes, timeout=900, skip_timesync=False):
        """Lists registered nailgun nodes
        Start vms and wait until they are registered on nailgun.
        :rtype : List of registered nailgun nodes
        """
        # self.dhcrelay_check()

        for node in devops_nodes:
            logger.info("Bootstrapping node: {}".format(node.name))
            node.start()
            # TODO(aglarendil): LP#1317213 temporary sleep
            # remove after better fix is applied
            time.sleep(5)

        if not MASTER_IS_CENTOS7:
            with TimeStat("wait_for_nodes_to_start_and_register_in_nailgun"):
                wait(lambda: all(self.nailgun_nodes(devops_nodes)), 15,
                     timeout)
        else:
            wait(lambda: all(self.nailgun_nodes(devops_nodes)), 15, timeout)

        if not skip_timesync:
            self.sync_time([node for node in self.nailgun_nodes(devops_nodes)])

        return self.nailgun_nodes(devops_nodes)
예제 #5
0
    def setup_master(self):
        """Create environment and set up master node

        Snapshot: empty

        """
        self.check_run("empty")
        with TimeStat("setup_environment", is_uniq=True):
            self.env.setup_environment()
        self.env.make_snapshot("empty", is_make=True)
        self.current_log_step = 0
예제 #6
0
파일: base.py 프로젝트: dtsapikov/fuel-qa
    def setup_centos_master(self):
        """Create environment, bootstrap centos_master
        and install fuel services

        Snapshot "empty_centos"

            1. bootstrap_centos_master
            2. Download fuel_release from remote repository
            3. install fuel_setup package
            4. Install Fuel services by executing bootstrap_admin_node.sh
            5. check Fuel services


        """
        self.check_run("empty_centos")
        self.show_step(1, initialize=True)
        cloud_image_settings_path = os.path.join(
            os.path.dirname(fuelweb_test.__file__),
            'cloud_image_settings/cloud_settings.iso')

        admin_net_object = self.env.d_env.get_network(
            name=self.env.d_env.admin_net)
        admin_network = admin_net_object.ip.network
        admin_netmask = admin_net_object.ip.netmask
        admin_ip = str(self.env.d_env.nodes(
        ).admin.get_ip_address_by_network_name(self.env.d_env.admin_net))
        interface_name = settings.iface_alias("eth0")
        gateway = self.env.d_env.router()
        dns = settings.DNS
        dns_ext = ''.join(settings.EXTERNAL_DNS)
        hostname = ''.join((settings.FUEL_MASTER_HOSTNAME,
                            settings.DNS_SUFFIX))
        user = settings.SSH_FUEL_CREDENTIALS['login']
        password = settings.SSH_FUEL_CREDENTIALS['password']
        generate_cloud_image_settings(cloud_image_settings_path, admin_network,
                                      interface_name, admin_ip, admin_netmask,
                                      gateway, dns, dns_ext,
                                      hostname, user, password)

        with TimeStat("bootstrap_centos_node", is_uniq=True):
            admin = self.env.d_env.nodes().admin
            logger.info(cloud_image_settings_path)
            admin.disk_devices.get(
                device='cdrom').volume.upload(cloud_image_settings_path)
            self.env.d_env.start([admin])
            logger.info("Waiting for Centos node to start up")
            wait(lambda: admin.driver.node_active(admin), 60)
            logger.info("Waiting for Centos node ssh ready")
            self.env.wait_for_provisioning()

        self.centos_setup_fuel(hostname)

        self.env.make_snapshot("empty", is_make=True)
예제 #7
0
파일: decorators.py 프로젝트: ehles/fuel-qa
 def wrapper(*args, **kwargs):
     with TimeStat(func) as timer:
         step_name = getattr(func, '_step_name')
         start_step = '[ START {} ]'.format(step_name)
         header = "<<< {:-^142} >>>".format(start_step)
         logger.info("\n{header}\n".format(header=header))
         result = func(*args, **kwargs)
         spent_time = timer.spent_time
         minutes = int(round(spent_time)) / 60
         seconds = int(round(spent_time)) % 60
         finish_step = "[ FINISH {} STEP TOOK {} min {} sec ]".format(
             step_name, minutes, seconds)
         footer = "<<< {:-^142} >>>".format(finish_step)
         logger.info("\n{footer}\n".format(footer=footer))
     return result
예제 #8
0
    def get_ready_setup(self):
        """Create virtual environment and install Fuel master node."""

        logger.info("Getting ready setup")
        if self.check_run("empty"):
            self.env.revert_snapshot("empty")
            return True
        else:
            with TimeStat("setup_environment", is_uniq=True):
                self.env.setup_environment()
                self.fuel_post_install_actions()

            self.env.make_snapshot("empty", is_make=True)
            self.env.resume_environment()
            return True
예제 #9
0
 def wait_bootstrap(self):
     logger.info("Waiting while bootstrapping is in progress")
     log_path = "/var/log/puppet/bootstrap_admin_node.log"
     logger.info("Running bootstrap (timeout: {0})".format(
         float(settings.ADMIN_NODE_BOOTSTRAP_TIMEOUT)))
     with TimeStat("admin_node_bootsrap_time", is_uniq=True):
         wait(lambda: self.ssh_manager.execute(
             ip=self.ssh_manager.admin_ip,
             cmd="grep 'Fuel node deployment' '{:s}'".format(log_path))[
                 'exit_code'] == 0,
              timeout=(float(settings.ADMIN_NODE_BOOTSTRAP_TIMEOUT)))
     result = self.ssh_manager.execute(
         ip=self.ssh_manager.admin_ip,
         cmd="grep 'Fuel node deployment "
         "complete' '{:s}'".format(log_path))['exit_code']
     if result != 0:
         raise Exception('Fuel node deployment failed.')
     self.bootstrap_image_check()
예제 #10
0
파일: base.py 프로젝트: dwong-zh/fuel-qa
    def setup_master(self):
        """Setup master node"""
        self.check_run("empty")
        with TimeStat("setup_environment", is_uniq=True):
            if list(self.env.d_env.get_nodes(role='fuel_master')):
                self.env.setup_environment()
                self.fuel_post_install_actions()

            elif list(self.env.d_env.get_nodes(role='centos_master')):
                # need to use centos_master.yaml devops template
                hostname = ''.join(
                    (settings.FUEL_MASTER_HOSTNAME, settings.DNS_SUFFIX))
                self.centos_setup_fuel(hostname)

            else:
                raise SkipTest("No Fuel master nodes found!")

        self.env.make_snapshot("empty", is_make=True)
예제 #11
0
    def setup_master(self):
        """Create environment and set up master node

        Snapshot: empty

        """
        # TODO: remove this code when fuel-devops will be ready to
        # describe all required network parameters (gateway, CIDR, IP range)
        # inside 'address_pool', so we can use 'network_pools' section
        # for L3 configuration in tests for multi racks
        if MULTIPLE_NETWORKS:
            from system_test.helpers.utils import load_yaml
            self._devops_config = load_yaml(MULTIPLE_NETWORKS_TEMPLATE)

        self.check_run("empty")

        with TimeStat("setup_environment", is_uniq=True):
            self.env.setup_environment()
        self.env.make_snapshot("empty", is_make=True)
        self.current_log_step = 0
예제 #12
0
    def bootstrap_multipath(self):
        """Bootstrap node with multipath devices

        Scenario:
            1. Setup environment
            2. Bootstrap slave nodes
            3. Verify multipath devices on the nodes

        Duration 30m

        """
        if not MULTIPATH:
            raise exceptions.FuelQAVariableNotSet('MULTIPATH', 'true')
        if not MULTIPATH_TEMPLATE:
            raise exceptions.FuelQAVariableNotSet(
                'MULTIPATH_TEMPLATE',
                'system_test/tests_templates/tests_configs/'
                'multipath_3_nodes.yaml')
        if int(SLAVE_MULTIPATH_DISKS_COUNT) < 1:
            raise exceptions.FuelQAVariableNotSet(
                'SLAVE_MULTIPATH_DISKS_COUNT', '2')

        self.show_step(1)
        self._devops_config = load_yaml(MULTIPATH_TEMPLATE)
        with TimeStat("setup_environment", is_uniq=True):
            self.env.setup_environment()
            self.fuel_post_install_actions()
            if REPLACE_DEFAULT_REPOS and REPLACE_DEFAULT_REPOS_ONLY_ONCE:
                self.fuel_web.replace_default_repos()
        self.fuel_web.get_nailgun_version()
        self.fuel_web.change_default_network_settings()

        self.show_step(2)
        self.env.bootstrap_nodes(self.env.d_env.nodes().slaves[:3],
                                 skip_timesync=True)

        self.show_step(3)
        for ip in [node['ip'] for node in self.fuel_web.client.list_nodes()]:
            self.check_multipath_devices(ip, SLAVE_MULTIPATH_DISKS_COUNT)
예제 #13
0
 def wrapper(*args, **kwargs):
     with TimeStat(func.__name__):
         return func(*args, **kwargs)
예제 #14
0
 def wrapper(*args, **kwargs):
     if MASTER_IS_CENTOS7:
         return func(*args, **kwargs)
     else:
         with TimeStat(func.__name__):
             return func(*args, **kwargs)