def setup_environment(self, custom=settings.CUSTOM_ENV, build_images=settings.BUILD_IMAGES, iso_connect_as=settings.ADMIN_BOOT_DEVICE, security=settings.SECURITY_TEST): # Create environment and start the Fuel master node admin = self.d_env.nodes().admin self.d_env.start([admin]) logger.info("Waiting for admin node to start up") wait(lambda: admin.driver.node_active(admin), 60) logger.info("Proceed with installation") # update network parameters at boot screen admin.send_keys(self.get_keys(admin, custom=custom, build_images=build_images, iso_connect_as=iso_connect_as)) if settings.SHOW_FUELMENU: self.wait_for_fuelmenu() else: self.wait_for_provisioning() self.set_admin_ssh_password() self.wait_for_external_config() if custom: self.setup_customisation() if security: nessus_node = NessusActions(self.d_env) nessus_node.add_nessus_node() # wait while installation complete self.admin_actions.modify_configs(self.d_env.router()) self.kill_wait_for_external_config() self.wait_bootstrap() self.admin_actions.wait_for_fuel_ready()
def setup_environment(self, custom=settings.CUSTOM_ENV, build_images=settings.BUILD_IMAGES, iso_connect_as=settings.ADMIN_BOOT_DEVICE, security=settings.SECURITY_TEST): # Create environment and start the Fuel master node admin = self.d_env.nodes().admin self.d_env.start([admin]) def provision_admin(admin_node): logger.info("Waiting for admin node to start up") wait(lambda: admin.driver.node_active(admin_node), 60, timeout_msg='Admin node startup timeout') logger.info("Proceed with installation") # update network parameters at boot screen admin_node.send_keys(self.get_keys( admin_node, custom=custom, build_images=build_images, iso_connect_as=iso_connect_as)) if settings.SHOW_FUELMENU: self.wait_for_fuelmenu() else: self.wait_for_provisioning() try: provision_admin(admin) except Exception as e: logger.info('Master node restart: LP1587411') logger.info('Exception is: {e}'.format(e=e)) admin.reset() provision_admin(admin) self.set_admin_ssh_password() self.wait_for_external_config() if custom: self.setup_customisation() if security: nessus_node = NessusActions(self.d_env) nessus_node.add_nessus_node() # wait while installation complete self.admin_actions.modify_configs(self.d_env.router()) if CUSTOM_FUEL_SETTING_YAML: self.admin_actions.update_fuel_setting_yaml( CUSTOM_FUEL_SETTING_YAML) self.kill_wait_for_external_config() self.wait_bootstrap() self.admin_actions.wait_for_fuel_ready()
def setup_environment(self, custom=settings.CUSTOM_ENV, build_images=settings.BUILD_IMAGES, iso_connect_as=settings.ADMIN_BOOT_DEVICE, security=settings.SECURITY_TEST): # Create environment and start the Fuel master node admin = self.d_env.nodes().admin self.d_env.start([admin]) logger.info("Waiting for admin node to start up") wait(lambda: admin.driver.node_active(admin), 60) logger.info("Proceed with installation") # update network parameters at boot screen admin.send_keys( self.get_keys(admin, custom=custom, build_images=build_images, iso_connect_as=iso_connect_as)) if settings.SHOW_FUELMENU: self.wait_for_fuelmenu() else: self.wait_for_provisioning() self.set_admin_ssh_password() self.wait_for_external_config() if custom: self.setup_customisation() if security: nessus_node = NessusActions(self.d_env) nessus_node.add_nessus_node() # wait while installation complete self.admin_actions.modify_configs(self.d_env.router()) self.kill_wait_for_external_config() self.wait_bootstrap() self.admin_actions.wait_for_fuel_ready()
def setup_environment(self, custom=settings.CUSTOM_ENV, build_images=settings.BUILD_IMAGES, iso_connect_as=settings.ADMIN_BOOT_DEVICE, security=settings.SECURITY_TEST, force_ssl=settings.FORCE_HTTPS_MASTER_NODE): # Create environment and start the Fuel master node admin = self.d_env.nodes().admin self.d_env.start([admin]) logger.info("Waiting for admin node to start up") wait(lambda: admin.driver.node_active(admin), 60) logger.info("Proceed with installation") # update network parameters at boot screen admin.send_keys( self.get_keys(admin, custom=custom, build_images=build_images, iso_connect_as=iso_connect_as)) if settings.SHOW_FUELMENU: self.wait_for_fuelmenu() else: self.wait_for_provisioning() self.set_admin_ssh_password() self.wait_for_external_config() if custom: self.setup_customisation() if security: nessus_node = NessusActions(self.d_env) nessus_node.add_nessus_node() # wait while installation complete self.admin_actions.modify_configs(self.d_env.router()) self.kill_wait_for_external_config() self.wait_bootstrap() if settings.UPDATE_FUEL: # Update Ubuntu packages self.admin_actions.upload_packages( local_packages_dir=settings.UPDATE_FUEL_PATH, centos_repo_path=None, ubuntu_repo_path=settings.LOCAL_MIRROR_UBUNTU) self.admin_actions.wait_for_fuel_ready() time.sleep(10) self.set_admin_keystone_password() self.sync_time(['admin']) if settings.UPDATE_MASTER: if settings.UPDATE_FUEL_MIRROR: for i, url in enumerate(settings.UPDATE_FUEL_MIRROR): conf_file = '/etc/yum.repos.d/temporary-{}.repo'.format(i) cmd = ("echo -e" " '[temporary-{0}]\nname=" "temporary-{0}\nbaseurl={1}/" "\ngpgcheck=0\npriority=" "1' > {2}").format(i, url, conf_file) self.ssh_manager.execute(ip=self.ssh_manager.admin_ip, cmd=cmd) self.admin_install_updates() if settings.MULTIPLE_NETWORKS: self.describe_other_admin_interfaces(admin) self.nailgun_actions.set_collector_address(settings.FUEL_STATS_HOST, settings.FUEL_STATS_PORT, settings.FUEL_STATS_SSL) # Restart statsenderd to apply settings(Collector address) self.nailgun_actions.force_fuel_stats_sending() if settings.FUEL_STATS_ENABLED: self.fuel_web.client.send_fuel_stats(enabled=True) logger.info('Enabled sending of statistics to {0}:{1}'.format( settings.FUEL_STATS_HOST, settings.FUEL_STATS_PORT)) if settings.PATCHING_DISABLE_UPDATES: cmd = "find /etc/yum.repos.d/ -type f -regextype posix-egrep" \ " -regex '.*/mos[0-9,\.]+\-(updates|security).repo' | " \ "xargs -n1 -i sed '$aenabled=0' -i {}" self.ssh_manager.execute_on_remote(ip=self.ssh_manager.admin_ip, cmd=cmd) if settings.DISABLE_OFFLOADING: logger.info('========================================' 'Applying workaround for bug #1526544' '========================================') # Disable TSO offloading for every network interface # that is not virtual (loopback, bridges, etc) ifup_local = ( """#!/bin/bash\n""" """if [[ -z "${1}" ]]; then\n""" """ exit\n""" """fi\n""" """devpath=$(readlink -m /sys/class/net/${1})\n""" """if [[ "${devpath}" == /sys/devices/virtual/* ]]; then\n""" """ exit\n""" """fi\n""" """ethtool -K ${1} tso off\n""") cmd = ("echo -e '{0}' | sudo tee /sbin/ifup-local;" "sudo chmod +x /sbin/ifup-local;").format(ifup_local) self.ssh_manager.execute_on_remote(ip=self.ssh_manager.admin_ip, cmd=cmd) cmd = ('for ifname in $(ls /sys/class/net); do ' 'sudo /sbin/ifup-local ${ifname}; done') self.ssh_manager.execute_on_remote(ip=self.ssh_manager.admin_ip, cmd=cmd) # Log interface settings cmd = ('for ifname in $(ls /sys/class/net); do ' '([[ $(readlink -e /sys/class/net/${ifname}) == ' '/sys/devices/virtual/* ]] ' '|| ethtool -k ${ifname}); done') result = self.ssh_manager.execute_on_remote( ip=self.ssh_manager.admin_ip, cmd=cmd) logger.debug('Offloading settings:\n{0}\n'.format(''.join( result['stdout']))) if force_ssl: self.enable_force_https(self.ssh_manager.admin_ip)
def setup_environment( self, custom=settings.CUSTOM_ENV, build_images=settings.BUILD_IMAGES, iso_connect_as=settings.ADMIN_BOOT_DEVICE, security=settings.SECURITY_TEST, ): # start admin node admin = self.d_env.nodes().admin if iso_connect_as == "usb": admin.disk_devices.get(device="disk", bus="usb").volume.upload(settings.ISO_PATH) else: # cdrom is default admin.disk_devices.get(device="cdrom").volume.upload(settings.ISO_PATH) self.d_env.start(self.d_env.nodes().admins) logger.info("Waiting for admin node to start up") wait(lambda: admin.driver.node_active(admin), 60) logger.info("Proceed with installation") # update network parameters at boot screen admin.send_keys(self.get_keys(admin, custom=custom, build_images=build_images, iso_connect_as=iso_connect_as)) self.wait_for_provisioning() self.set_admin_ssh_password() self.wait_for_external_config() if custom: self.setup_customisation() if security: nessus_node = NessusActions(self.d_env) nessus_node.add_nessus_node() # wait while installation complete self.admin_actions.modify_configs(self.d_env.router()) self.kill_wait_for_external_config() self.wait_bootstrap() if settings.UPDATE_FUEL: # Update Ubuntu packages self.admin_actions.upload_packages( local_packages_dir=settings.UPDATE_FUEL_PATH, centos_repo_path=None, ubuntu_repo_path=settings.LOCAL_MIRROR_UBUNTU, ) self.admin_actions.wait_for_fuel_ready() time.sleep(10) self.set_admin_keystone_password() self.sync_time(["admin"]) if settings.UPDATE_MASTER: if settings.UPDATE_FUEL_MIRROR: for i, url in enumerate(settings.UPDATE_FUEL_MIRROR): conf_file = "/etc/yum.repos.d/temporary-{}.repo".format(i) cmd = ( "echo -e" " '[temporary-{0}]\nname=" "temporary-{0}\nbaseurl={1}/" "\ngpgcheck=0\npriority=" "1' > {2}" ).format(i, url, conf_file) self.ssh_manager.execute(ip=self.ssh_manager.admin_ip, cmd=cmd) self.admin_install_updates() if settings.MULTIPLE_NETWORKS: self.describe_other_admin_interfaces(admin) if not MASTER_IS_CENTOS7: self.nailgun_actions.set_collector_address( settings.FUEL_STATS_HOST, settings.FUEL_STATS_PORT, settings.FUEL_STATS_SSL ) # Restart statsenderd to apply settings(Collector address) self.nailgun_actions.force_fuel_stats_sending() if settings.FUEL_STATS_ENABLED and not MASTER_IS_CENTOS7: self.fuel_web.client.send_fuel_stats(enabled=True) logger.info( "Enabled sending of statistics to {0}:{1}".format(settings.FUEL_STATS_HOST, settings.FUEL_STATS_PORT) ) if settings.PATCHING_DISABLE_UPDATES: cmd = ( "find /etc/yum.repos.d/ -type f -regextype posix-egrep" " -regex '.*/mos[0-9,\.]+\-(updates|security).repo' | " "xargs -n1 -i sed '$aenabled=0' -i {}" ) self.ssh_manager.execute_on_remote(ip=self.ssh_manager.admin_ip, cmd=cmd)
def setup_environment(self, custom=settings.CUSTOM_ENV, build_images=settings.BUILD_IMAGES, iso_connect_as=settings.ADMIN_BOOT_DEVICE, security=settings.SECURITY_TEST, force_ssl=settings.FORCE_HTTPS_MASTER_NODE): # Create environment and start the Fuel master node admin = self.d_env.nodes().admin self.d_env.start([admin]) logger.info("Waiting for admin node to start up") wait(lambda: admin.driver.node_active(admin), 60) logger.info("Proceed with installation") # update network parameters at boot screen admin.send_keys(self.get_keys(admin, custom=custom, build_images=build_images, iso_connect_as=iso_connect_as)) if settings.SHOW_FUELMENU: self.wait_for_fuelmenu() else: self.wait_for_provisioning() self.set_admin_ssh_password() self.wait_for_external_config() if custom: self.setup_customisation() if security: nessus_node = NessusActions(self.d_env) nessus_node.add_nessus_node() # wait while installation complete self.admin_actions.modify_configs(self.d_env.router()) self.kill_wait_for_external_config() self.wait_bootstrap() if settings.UPDATE_FUEL: # Update Ubuntu packages self.admin_actions.upload_packages( local_packages_dir=settings.UPDATE_FUEL_PATH, centos_repo_path=None, ubuntu_repo_path=settings.LOCAL_MIRROR_UBUNTU) self.admin_actions.wait_for_fuel_ready() time.sleep(10) self.set_admin_keystone_password() self.sync_time(['admin']) if settings.UPDATE_MASTER: if settings.UPDATE_FUEL_MIRROR: for i, url in enumerate(settings.UPDATE_FUEL_MIRROR): conf_file = '/etc/yum.repos.d/temporary-{}.repo'.format(i) cmd = ("echo -e" " '[temporary-{0}]\nname=" "temporary-{0}\nbaseurl={1}/" "\ngpgcheck=0\npriority=" "1' > {2}").format(i, url, conf_file) self.ssh_manager.execute( ip=self.ssh_manager.admin_ip, cmd=cmd ) self.admin_install_updates() if settings.MULTIPLE_NETWORKS: self.describe_other_admin_interfaces(admin) self.nailgun_actions.set_collector_address( settings.FUEL_STATS_HOST, settings.FUEL_STATS_PORT, settings.FUEL_STATS_SSL) # Restart statsenderd to apply settings(Collector address) self.nailgun_actions.force_fuel_stats_sending() if settings.FUEL_STATS_ENABLED: self.fuel_web.client.send_fuel_stats(enabled=True) logger.info('Enabled sending of statistics to {0}:{1}'.format( settings.FUEL_STATS_HOST, settings.FUEL_STATS_PORT )) if settings.PATCHING_DISABLE_UPDATES: cmd = "find /etc/yum.repos.d/ -type f -regextype posix-egrep" \ " -regex '.*/mos[0-9,\.]+\-(updates|security).repo' | " \ "xargs -n1 -i sed '$aenabled=0' -i {}" self.ssh_manager.execute_on_remote( ip=self.ssh_manager.admin_ip, cmd=cmd ) if settings.DISABLE_OFFLOADING: logger.info( '========================================' 'Applying workaround for bug #1526544' '========================================' ) # Disable TSO offloading for every network interface # that is not virtual (loopback, bridges, etc) ifup_local = ( """#!/bin/bash\n""" """if [[ -z "${1}" ]]; then\n""" """ exit\n""" """fi\n""" """devpath=$(readlink -m /sys/class/net/${1})\n""" """if [[ "${devpath}" == /sys/devices/virtual/* ]]; then\n""" """ exit\n""" """fi\n""" """ethtool -K ${1} tso off\n""" ) cmd = ( "echo -e '{0}' | sudo tee /sbin/ifup-local;" "sudo chmod +x /sbin/ifup-local;" ).format(ifup_local) self.ssh_manager.execute_on_remote( ip=self.ssh_manager.admin_ip, cmd=cmd ) cmd = ( 'for ifname in $(ls /sys/class/net); do ' 'sudo /sbin/ifup-local ${ifname}; done' ) self.ssh_manager.execute_on_remote( ip=self.ssh_manager.admin_ip, cmd=cmd ) # Log interface settings cmd = ( 'for ifname in $(ls /sys/class/net); do ' '([[ $(readlink -e /sys/class/net/${ifname}) == ' '/sys/devices/virtual/* ]] ' '|| ethtool -k ${ifname}); done' ) result = self.ssh_manager.execute_on_remote( ip=self.ssh_manager.admin_ip, cmd=cmd ) logger.debug('Offloading settings:\n{0}\n'.format( ''.join(result['stdout']))) if force_ssl: self.enable_force_https(self.ssh_manager.admin_ip)
def setup_environment(self, custom=settings.CUSTOM_ENV, build_images=settings.BUILD_IMAGES, iso_connect_as=settings.ADMIN_BOOT_DEVICE, security=settings.SECURITY_TEST): # start admin node admin = self.d_env.nodes().admin if(iso_connect_as == 'usb'): admin.disk_devices.get(device='disk', bus='usb').volume.upload(settings.ISO_PATH) else: # cdrom is default admin.disk_devices.get( device='cdrom').volume.upload(settings.ISO_PATH) self.d_env.start(self.d_env.nodes().admins) logger.info("Waiting for admin node to start up") wait(lambda: admin.driver.node_active(admin), 60) logger.info("Proceed with installation") # update network parameters at boot screen admin.send_keys(self.get_keys(admin, custom=custom, build_images=build_images, iso_connect_as=iso_connect_as)) self.wait_for_provisioning() self.wait_for_external_config() if custom: self.setup_customisation() if security: nessus_node = NessusActions(self.d_env) nessus_node.add_nessus_node() # wait while installation complete self.set_admin_ssh_password() self.admin_actions.modify_configs(self.d_env.router()) self.kill_wait_for_external_config() self.wait_bootstrap() self.docker_actions.wait_for_ready_containers() time.sleep(10) self.set_admin_keystone_password() self.sync_time() if settings.UPDATE_MASTER: if settings.UPDATE_FUEL_MIRROR: for i, url in enumerate(settings.UPDATE_FUEL_MIRROR): conf_file = '/etc/yum.repos.d/temporary-{}.repo'.format(i) cmd = ("echo -e" " '[temporary-{0}]\nname=" "temporary-{0}\nbaseurl={1}/" "\ngpgcheck=0\npriority=" "1' > {2}").format(i, url, conf_file) with self.d_env.get_admin_remote() as remote: remote.execute(cmd) self.admin_install_updates() if settings.MULTIPLE_NETWORKS: self.describe_second_admin_interface() multiple_networks_hacks.configure_second_admin_cobbler(self) self.nailgun_actions.set_collector_address( settings.FUEL_STATS_HOST, settings.FUEL_STATS_PORT, settings.FUEL_STATS_SSL) # Restart statsenderd in order to apply new settings(Collector address) self.nailgun_actions.force_fuel_stats_sending() if settings.FUEL_STATS_ENABLED: self.fuel_web.client.send_fuel_stats(enabled=True) logger.info('Enabled sending of statistics to {0}:{1}'.format( settings.FUEL_STATS_HOST, settings.FUEL_STATS_PORT )) if settings.PATCHING_DISABLE_UPDATES: with self.d_env.get_admin_remote() as remote: cmd = "find /etc/yum.repos.d/ -type f -regextype posix-egrep" \ " -regex '.*/mos[0-9,\.]+\-(updates|security).repo' | " \ "xargs -n1 -i sed '$aenabled=0' -i {}" self.execute_remote_cmd(remote, cmd)
def setup_environment(self, custom=settings.CUSTOM_ENV, build_images=settings.BUILD_IMAGES, iso_connect_as=settings.ADMIN_BOOT_DEVICE, security=settings.SECURITY_TEST): # Create environment and start the Fuel master node admin = self.d_env.nodes().admin self.d_env.start([admin]) logger.info("Waiting for admin node to start up") wait(lambda: admin.driver.node_active(admin), 60) logger.info("Proceed with installation") # update network parameters at boot screen admin.send_keys( self.get_keys(admin, custom=custom, build_images=build_images, iso_connect_as=iso_connect_as)) self.wait_for_provisioning() self.set_admin_ssh_password() self.wait_for_external_config() if custom: self.setup_customisation() if security: nessus_node = NessusActions(self.d_env) nessus_node.add_nessus_node() # wait while installation complete self.admin_actions.modify_configs(self.d_env.router()) self.kill_wait_for_external_config() self.wait_bootstrap() if settings.UPDATE_FUEL: # Update Ubuntu packages self.admin_actions.upload_packages( local_packages_dir=settings.UPDATE_FUEL_PATH, centos_repo_path=None, ubuntu_repo_path=settings.LOCAL_MIRROR_UBUNTU) self.admin_actions.wait_for_fuel_ready() time.sleep(10) self.set_admin_keystone_password() self.sync_time(['admin']) if settings.UPDATE_MASTER: if settings.UPDATE_FUEL_MIRROR: for i, url in enumerate(settings.UPDATE_FUEL_MIRROR): conf_file = '/etc/yum.repos.d/temporary-{}.repo'.format(i) cmd = ("echo -e" " '[temporary-{0}]\nname=" "temporary-{0}\nbaseurl={1}/" "\ngpgcheck=0\npriority=" "1' > {2}").format(i, url, conf_file) self.ssh_manager.execute(ip=self.ssh_manager.admin_ip, cmd=cmd) self.admin_install_updates() if settings.MULTIPLE_NETWORKS: self.describe_other_admin_interfaces(admin) self.nailgun_actions.set_collector_address(settings.FUEL_STATS_HOST, settings.FUEL_STATS_PORT, settings.FUEL_STATS_SSL) # Restart statsenderd to apply settings(Collector address) self.nailgun_actions.force_fuel_stats_sending() if settings.FUEL_STATS_ENABLED: self.fuel_web.client.send_fuel_stats(enabled=True) logger.info('Enabled sending of statistics to {0}:{1}'.format( settings.FUEL_STATS_HOST, settings.FUEL_STATS_PORT)) if settings.PATCHING_DISABLE_UPDATES: cmd = "find /etc/yum.repos.d/ -type f -regextype posix-egrep" \ " -regex '.*/mos[0-9,\.]+\-(updates|security).repo' | " \ "xargs -n1 -i sed '$aenabled=0' -i {}" self.ssh_manager.execute_on_remote(ip=self.ssh_manager.admin_ip, cmd=cmd)
def setup_environment(self, custom=settings.CUSTOM_ENV, build_images=settings.BUILD_IMAGES, iso_connect_as=settings.ADMIN_BOOT_DEVICE, security=settings.SECURITY_TEST): # start admin node admin = self.d_env.nodes().admin if (iso_connect_as == 'usb'): admin.disk_devices.get(device='disk', bus='usb').volume.upload(settings.ISO_PATH) else: # cdrom is default admin.disk_devices.get(device='cdrom').volume.upload( settings.ISO_PATH) self.d_env.start(self.d_env.nodes().admins) logger.info("Waiting for admin node to start up") wait(lambda: admin.driver.node_active(admin), 60) logger.info("Proceed with installation") # update network parameters at boot screen admin.send_keys( self.get_keys(admin, custom=custom, build_images=build_images, iso_connect_as=iso_connect_as)) if custom: self.setup_customisation() if security: nessus_node = NessusActions(self.d_env) nessus_node.add_nessus_node() # wait while installation complete admin. await (self.d_env.admin_net, timeout=10 * 60) self.set_admin_ssh_password() self.admin_actions.modify_configs(self.d_env.router()) self.wait_bootstrap() self.docker_actions.wait_for_ready_containers() time.sleep(10) self.set_admin_keystone_password() self.sync_time() if settings.UPDATE_MASTER: if settings.UPDATE_FUEL_MIRROR: for i, url in enumerate(settings.UPDATE_FUEL_MIRROR): conf_file = '/etc/yum.repos.d/temporary-{}.repo'.format(i) cmd = ("echo -e" " '[temporary-{0}]\nname=" "temporary-{0}\nbaseurl={1}/" "\ngpgcheck=0\npriority=" "1' > {2}").format(i, url, conf_file) with self.d_env.get_admin_remote() as remote: remote.execute(cmd) self.admin_install_updates() if settings.MULTIPLE_NETWORKS: self.describe_second_admin_interface() multiple_networks_hacks.configure_second_admin_cobbler(self) self.nailgun_actions.set_collector_address(settings.FUEL_STATS_HOST, settings.FUEL_STATS_PORT, settings.FUEL_STATS_SSL) # Restart statsenderd in order to apply new settings(Collector address) self.nailgun_actions.force_fuel_stats_sending() if settings.FUEL_STATS_ENABLED: self.fuel_web.client.send_fuel_stats(enabled=True) logger.info('Enabled sending of statistics to {0}:{1}'.format( settings.FUEL_STATS_HOST, settings.FUEL_STATS_PORT)) if settings.PATCHING_DISABLE_UPDATES: with self.d_env.get_admin_remote() as remote: cmd = "find /etc/yum.repos.d/ -type f -regextype posix-egrep" \ " -regex '.*/mos[0-9,\.]+\-(updates|security).repo' | " \ "xargs -n1 -i sed '$aenabled=0' -i {}" self.execute_remote_cmd(remote, cmd)