def delete_node_on_ready_ubuntu_bootstrap(self): """Delete node from cluster in HA mode\ with 1 controller on Ubuntu Bootstrap Scenario: 1. Delete node 2. Verify bootstrap on slaves Duration 30m Snapshot: delete_on_ready_ubuntu_bootstrap """ if not self.env.revert_snapshot( 'deploy_stop_on_deploying_ubuntu_bootstrap'): raise SkipTest() cluster_id = self.fuel_web.get_last_created_cluster() # Delete cluster, then verify bootstrap on slaves self.fuel_web.update_nodes(cluster_id, {'slave-03': ['cinder']}, pending_addition=False, pending_deletion=True) self.fuel_web.run_network_verify(cluster_id) self.fuel_web.deploy_cluster_wait(cluster_id, check_services=False) # wait for nodes to appear after bootstrap wait(lambda: len(self.fuel_web.client.list_nodes()) == 3, timeout=10 * 60) node = self.fuel_web.get_nailgun_node_by_name("slave-03") checkers.verify_bootstrap_on_node(node['ip'], os_type="ubuntu")
def activate_centos_bootstrap(self): """Verify than slaves retrieved CentOS bootstrap instead of Ubuntu Scenario: 1. Revert snapshot ready 2. Choose CentOS bootstrap on master node 3. Bootstrap slaves 4. Verify bootstrap on slaves Duration 15m Snapshot: activate_centos_bootstrap """ self.env.revert_snapshot("ready") self.env.fuel_bootstrap_actions.activate_bootstrap_image("centos") nodes = self.env.d_env.get_nodes( name__in=["slave-01", "slave-02", "slave-03"]) self.env.bootstrap_nodes(nodes) for node in nodes: with self.fuel_web.get_ssh_for_node(node.name) as slave_remote: checkers.verify_bootstrap_on_node(slave_remote, os_type="centos") self.env.make_snapshot("activate_centos_bootstrap", is_make=True)
def build_default_bootstrap(self): """Verify than slaves retrieved Default ubuntu bootstrap Scenario: 1. Revert snapshot ready 2. Build and activate Ubuntu bootstrap with default settings 3. Bootstrap slaves 4. Verify Ubuntu bootstrap on slaves Duration: 20m Snapshot: build_default_bootstrap """ self.env.revert_snapshot("ready") uuid, bootstrap_location = \ self.env.fuel_bootstrap_actions.build_bootstrap_image() self.env.fuel_bootstrap_actions.\ import_bootstrap_image(bootstrap_location) self.env.fuel_bootstrap_actions.\ activate_bootstrap_image(uuid) nodes = self.env.d_env.get_nodes( name__in=["slave-01", "slave-02", "slave-03"]) self.env.bootstrap_nodes(nodes) for node in nodes: with self.fuel_web.get_ssh_for_node(node.name) as slave_remote: checkers.verify_bootstrap_on_node(slave_remote, os_type="ubuntu", uuid=uuid) self.env.make_snapshot("build_default_bootstrap", is_make=True)
def delete_on_ready_centos_bootstrap(self): """Delete cluster cluster in HA mode\ with 1 controller on CentOS Bootstrap Scenario: 1. Delete cluster 2. Verify bootstrap on slaves Duration 30m Snapshot: delete_on_ready_centos_bootstrap """ if not self.env.revert_snapshot("deploy_stop_on_deploying_centos_bootstrap"): raise SkipTest() cluster_id = self.fuel_web.get_last_created_cluster() # Delete cluster, then verify bootstrap on slaves self.fuel_web.client.delete_cluster(cluster_id) # wait nodes go to reboot wait(lambda: not self.fuel_web.client.list_nodes(), timeout=10 * 60) # wait for nodes to appear after bootstrap wait(lambda: len(self.fuel_web.client.list_nodes()) == 3, timeout=10 * 60) nodes = self.env.d_env.get_nodes(name__in=["slave-01", "slave-02", "slave-03"]) for node in nodes: with self.fuel_web.get_ssh_for_node(node.name) as slave_remote: checkers.verify_bootstrap_on_node(slave_remote, os_type="centos") self.env.make_snapshot("delete_on_ready_centos_bootstrap", is_make=True)
def delete_node_on_ready_centos_bootstrap(self): """Delete node from cluster in HA mode\ with 1 controller on CentOS Bootstrap Scenario: 1. Delete node 2. Verify bootstrap on slave Duration 30m Snapshot: delete_on_ready_centos_bootstrap """ if not self.env.revert_snapshot("deploy_stop_on_deploying_centos_bootstrap"): raise SkipTest() cluster_id = self.fuel_web.get_last_created_cluster() # Delete cluster, then verify bootstrap on slaves self.fuel_web.update_nodes(cluster_id, {"slave-03": ["cinder"]}, pending_addition=False, pending_deletion=True) self.fuel_web.run_network_verify(cluster_id) self.fuel_web.deploy_cluster_wait(cluster_id, check_services=False) # wait for nodes to appear after bootstrap wait(lambda: len(self.fuel_web.client.list_nodes()) == 3, timeout=10 * 60) node = self.env.d_env.get_node(name="slave-03") with self.fuel_web.get_ssh_for_node(node.name) as slave_remote: checkers.verify_bootstrap_on_node(slave_remote, os_type="centos")
def delete_on_ready_ubuntu_bootstrap(self): """Delete cluster cluster in HA mode\ with 1 controller on Ubuntu Bootstrap Scenario: 1. Delete cluster 2. Verify bootstrap on slaves Duration 30m Snapshot: delete_on_ready_ubuntu_bootstrap """ if not self.env.revert_snapshot( 'deploy_stop_on_deploying_ubuntu_bootstrap'): raise SkipTest() cluster_id = self.fuel_web.get_last_created_cluster() # Delete cluster, then verify bootstrap on slaves self.fuel_web.client.delete_cluster(cluster_id) # wait nodes go to reboot wait(lambda: not self.fuel_web.client.list_nodes(), timeout=10 * 60) # wait for nodes to appear after bootstrap wait(lambda: len(self.fuel_web.client.list_nodes()) == 3, timeout=10 * 60) nodes = self.env.d_env.get_nodes( name__in=["slave-01", "slave-02", "slave-03"]) for node in nodes: _ip = self.fuel_web.get_nailgun_node_by_devops_node(node)['ip'] checkers.verify_bootstrap_on_node(_ip, os_type="ubuntu") self.env.make_snapshot("delete_on_ready_ubuntu_bootstrap", is_make=True)
def build_simple_bootstrap(self): """Verify than slaves retrieved Ubuntu bootstrap with extra package Scenario: 1. Revert snapshot ready 2. Build and activate Ubuntu bootstrap with extra package 3. Bootstrap slaves 4. Verify Ubuntu bootstrap on slaves Duration: 20m """ self.env.revert_snapshot("ready") bootstrap_default_params = \ self.env.fuel_bootstrap_actions.get_bootstrap_default_config() additional_repos = [ self._get_main_repo(bootstrap_default_params["repos"], "ubuntu", "main"), self._get_main_repo(bootstrap_default_params["repos"], "ubuntu", "updates"), self._get_main_repo(bootstrap_default_params["repos"], "mos", "main")] bootstrap_params = { "ubuntu-release": "trusty", "repo": ["'deb {0} {1} {2}'".format(repo['uri'], repo['suite'], repo['section']) for repo in additional_repos], "label": "UbuntuBootstrap", "output-dir": "/tmp", "package": ["ipython"] } uuid, bootstrap_location = \ self.env.fuel_bootstrap_actions.build_bootstrap_image( **bootstrap_params) self.env.fuel_bootstrap_actions.\ import_bootstrap_image(bootstrap_location) self.env.fuel_bootstrap_actions.\ activate_bootstrap_image(uuid) nodes = self.env.d_env.get_nodes( name__in=["slave-01", "slave-02", "slave-03"]) self.env.bootstrap_nodes(nodes) for node in nodes: with self.fuel_web.get_ssh_for_node(node.name) as slave_remote: checkers.verify_bootstrap_on_node(slave_remote, os_type="ubuntu", uuid=uuid) ipython_version = checkers.get_package_versions_from_node( slave_remote, name="ipython", os_type="Ubuntu") assert_not_equal(ipython_version, "")
def reset_on_ready_ubuntu_bootstrap(self): """Stop reset cluster in HA mode with 1 controller on Ubuntu Bootstrap Scenario: 1. Reset cluster 2. Verify bootstrap on slaves 3. Re-deploy cluster 4. Verify network 5. Run OSTF Duration 30m """ if not self.env.revert_snapshot( 'deploy_stop_on_deploying_ubuntu_bootstrap'): raise SkipTest('Required snapshot not found') cluster_id = self.fuel_web.get_last_created_cluster() # Reset environment, # then verify bootstrap on slaves and re-deploy cluster self.fuel_web.stop_reset_env_wait(cluster_id) nodes = self.env.d_env.get_nodes( name__in=["slave-01", "slave-02", "slave-03"]) self.fuel_web.wait_nodes_get_online_state(nodes, timeout=10 * 60) for node in nodes: nailgun_node = self.fuel_web.get_nailgun_node_by_devops_node(node) wait(lambda: tcp_ping(nailgun_node['ip'], 22), timeout=300, timeout_msg=("Node {0} is still unreachable after {1} " "seconds".format(nailgun_node['name'], 300))) checkers.verify_bootstrap_on_node( nailgun_node['ip'], os_type="ubuntu") self.fuel_web.deploy_cluster_wait(cluster_id) # Network verification self.fuel_web.verify_network(cluster_id) # Run ostf self.fuel_web.run_ostf(cluster_id=cluster_id, test_sets=['smoke'])
def reset_on_ready_ubuntu_bootstrap(self): """Stop reset cluster in HA mode with 1 controller on Ubuntu Bootstrap Scenario: 1. Reset cluster 2. Verify bootstrap on slaves 3. Re-deploy cluster 4. Verify network 5. Run OSTF Duration 30m """ if not self.env.revert_snapshot( 'deploy_stop_on_deploying_ubuntu_bootstrap'): raise SkipTest('Required snapshot not found') cluster_id = self.fuel_web.get_last_created_cluster() # Reset environment, # then verify bootstrap on slaves and re-deploy cluster self.fuel_web.stop_reset_env_wait(cluster_id) nodes = self.env.d_env.get_nodes( name__in=["slave-01", "slave-02", "slave-03"]) self.fuel_web.wait_nodes_get_online_state(nodes, timeout=10 * 60) for node in nodes: nailgun_node = self.fuel_web.get_nailgun_node_by_devops_node(node) wait(lambda: tcp_ping(nailgun_node['ip'], 22), timeout=300, timeout_msg=("Node {0} is still unreachable after {1} " "seconds".format(nailgun_node['name'], 300))) checkers.verify_bootstrap_on_node(nailgun_node['ip'], os_type="ubuntu") self.fuel_web.deploy_cluster_wait(cluster_id) # Network verification self.fuel_web.verify_network(cluster_id) # Run ostf self.fuel_web.run_ostf(cluster_id=cluster_id, test_sets=['smoke'])
def build_simple_bootstrap(self): """Verify than slaves retrieved Ubuntu bootstrap with extra package Scenario: 1. Revert snapshot ready 2. Build and activate Ubuntu bootstrap with extra package 3. Bootstrap slaves 4. Verify Ubuntu bootstrap on slaves Duration: 20m """ self.env.revert_snapshot("ready") bootstrap_params = { "ubuntu-release": "xenial", "label": "UbuntuBootstrap", "output-dir": "/tmp", "package": ["ipython"] } uuid, bootstrap_location = \ self.env.fuel_bootstrap_actions.build_bootstrap_image( **bootstrap_params) self.env.fuel_bootstrap_actions.\ import_bootstrap_image(bootstrap_location) self.env.fuel_bootstrap_actions.\ activate_bootstrap_image(uuid) nodes = self.env.d_env.get_nodes( name__in=["slave-01", "slave-02", "slave-03"]) self.env.bootstrap_nodes(nodes) for node in nodes: n_node = self.fuel_web.get_nailgun_node_by_devops_node(node) checkers.verify_bootstrap_on_node(n_node['ip'], os_type="ubuntu", uuid=uuid) ipython_version = utils.get_package_versions_from_node( n_node['ip'], name="ipython", os_type="Ubuntu") assert_not_equal(ipython_version, "")
def reset_on_ready_ubuntu_bootstrap(self): """Stop reset cluster in HA mode with 1 controller on Ubuntu Bootstrap Scenario: 1. Reset cluster 2. Verify bootstrap on slaves 3. Re-deploy cluster 4. Verify network 5. Run OSTF Duration 30m """ if not self.env.revert_snapshot( 'deploy_stop_on_deploying_ubuntu_bootstrap'): raise SkipTest() cluster_id = self.fuel_web.get_last_created_cluster() # Reset environment, # then verify bootstrap on slaves and re-deploy cluster self.fuel_web.stop_reset_env_wait(cluster_id) nodes = self.env.d_env.get_nodes( name__in=["slave-01", "slave-02", "slave-03"]) self.fuel_web.wait_nodes_get_online_state(nodes, timeout=10 * 60) for node in nodes: with self.fuel_web.get_ssh_for_node(node.name) as slave_remote: checkers.verify_bootstrap_on_node(slave_remote, os_type="ubuntu") self.fuel_web.deploy_cluster_wait(cluster_id) # Network verification self.fuel_web.verify_network(cluster_id) # Run ostf self.fuel_web.run_ostf(cluster_id=cluster_id, test_sets=['smoke'])
def delete_on_ready_ubuntu_bootstrap(self): """Delete cluster cluster in HA mode\ with 1 controller on Ubuntu Bootstrap Scenario: 1. Delete cluster 2. Verify bootstrap on slaves Duration 30m Snapshot: delete_on_ready_ubuntu_bootstrap """ if not self.env.revert_snapshot( 'deploy_stop_on_deploying_ubuntu_bootstrap'): raise SkipTest('Required snapshot not found') cluster_id = self.fuel_web.get_last_created_cluster() # Delete cluster, then verify bootstrap on slaves self.fuel_web.client.delete_cluster(cluster_id) # wait nodes go to reboot wait(lambda: not self.fuel_web.client.list_nodes(), timeout=10 * 60, timeout_msg='Timeout while waiting nodes to become offline') # wait for nodes to appear after bootstrap wait(lambda: len(self.fuel_web.client.list_nodes()) == 3, timeout=10 * 60, timeout_msg='Timeout while waiting nodes to become online') nodes = self.env.d_env.get_nodes( name__in=["slave-01", "slave-02", "slave-03"]) for node in nodes: _ip = self.fuel_web.get_nailgun_node_by_devops_node(node)['ip'] checkers.verify_bootstrap_on_node(_ip, os_type="ubuntu") self.env.make_snapshot( "delete_on_ready_ubuntu_bootstrap", is_make=True)
def delete_node_on_ready_ubuntu_bootstrap(self): """Delete node from cluster in HA mode\ with 1 controller on Ubuntu Bootstrap Scenario: 1. Delete node 2. Verify bootstrap on slaves Duration 30m Snapshot: delete_on_ready_ubuntu_bootstrap """ if not self.env.revert_snapshot( 'deploy_stop_on_deploying_ubuntu_bootstrap'): raise SkipTest('Required snapshot not found') cluster_id = self.fuel_web.get_last_created_cluster() # Delete cluster, then verify bootstrap on slaves self.fuel_web.update_nodes( cluster_id, { 'slave-03': ['cinder'] }, pending_addition=False, pending_deletion=True ) self.fuel_web.deploy_cluster_wait(cluster_id, check_services=False) # wait for nodes to appear after bootstrap wait(lambda: len(self.fuel_web.client.list_nodes()) == 3, timeout=10 * 60, timeout_msg='Timeout while waiting nodes to become online') self.fuel_web.verify_network(cluster_id) node = self.fuel_web.get_nailgun_node_by_name("slave-03") checkers.verify_bootstrap_on_node(node['ip'], os_type="ubuntu")
def activate_centos_bootstrap(self): """Verify than slaves retrieved CentOS bootstrap instead of Ubuntu Scenario: 1. Revert snapshot ready 2. Choose CentOS bootstrap on master node 3. Bootstrap slaves 4. Verify bootstrap on slaves Duration 15m Snapshot: activate_centos_bootstrap """ self.env.revert_snapshot("ready") self.env.fuel_bootstrap_actions.activate_bootstrap_image("centos") nodes = self.env.d_env.get_nodes(name__in=["slave-01", "slave-02", "slave-03"]) self.env.bootstrap_nodes(nodes) for node in nodes: with self.fuel_web.get_ssh_for_node(node.name) as slave_remote: checkers.verify_bootstrap_on_node(slave_remote, os_type="centos") self.env.make_snapshot("activate_centos_bootstrap", is_make=True)
def gate_patch_fuel_agent(self): """ Revert snapshot, update fuel-agent, bootstrap from review and provision one node Scenario: 1. Revert snapshot "ready" 2. Update fuel-agent, fuel-bootstrap-cli on master node 3. Update fuel_bootstrap_cli.yaml 4. Rebuild bootstrap 5. Verify fuel-agent version in ubuntu bootstrap image 6. Bootstrap 5 slaves 7. Verify Ubuntu bootstrap on slaves 8. Add 1 node with controller 9. Add 1 node ironic role 10. Deploy the cluster 11. Verify fuel-agent version in ironic-bootstrap 12. Upload image to glance 13. Enroll Ironic nodes 14. Boot nova instance 15. Check Nova instance status Snapshot review_fuel_agent_ironic_deploy """ if not settings.UPDATE_FUEL: raise exceptions.FuelQAVariableNotSet(settings.UPDATE_FUEL, 'true') self.show_step(1, initialize=True) self.env.revert_snapshot("ready") self.show_step(2) replace_rpm_package('fuel-agent') replace_rpm_package('fuel-bootstrap-cli') self.show_step(3) self.update_bootstrap_cli_yaml() self.show_step(4) if settings.UPDATE_FUEL: self.env.admin_actions.upload_packages( local_packages_dir=settings.UPDATE_FUEL_PATH, centos_repo_path=None, ubuntu_repo_path=settings.LOCAL_MIRROR_UBUNTU, clean_target=True) uuid, bootstrap_location = \ self.env.fuel_bootstrap_actions.build_bootstrap_image() self.env.fuel_bootstrap_actions. \ import_bootstrap_image(bootstrap_location) self.env.fuel_bootstrap_actions. \ activate_bootstrap_image(uuid) self.show_step(5) check_package_version_injected_in_bootstraps("fuel-agent") self.show_step(6) self.env.bootstrap_nodes( self.env.d_env.nodes().slaves[:2]) self.show_step(7) for node in self.env.d_env.nodes().slaves[:2]: _ip = self.fuel_web.get_nailgun_node_by_devops_node(node)['ip'] verify_bootstrap_on_node(_ip, os_type="ubuntu", uuid=uuid) data = { "net_provider": 'neutron', "net_segment_type": settings.NEUTRON_SEGMENT['vlan'], "ironic": True} nodes = { 'slave-01': ['controller'], 'slave-02': ['ironic']} self.show_step(8) self.show_step(9) self.show_step(10) cluster_id = self._deploy_ironic_cluster(settings=data, nodes=nodes) ironic_conn = ironic_actions.IronicActions( self.fuel_web.get_public_vip(cluster_id)) self.show_step(11) check_package_version_injected_in_bootstraps("fuel-agent", cluster_id=cluster_id, ironic=True) self.show_step(12) self.show_step(13) self._create_os_resources(ironic_conn) self.show_step(14) self._boot_nova_instances(ironic_conn) self.show_step(15) ironic_conn.wait_for_vms(ironic_conn) ironic_conn.verify_vms_connection(ironic_conn) self.env.make_snapshot("review_fuel_agent_ironic_deploy")
def deploy_stop_on_deploying_ubuntu_bootstrap(self): """Stop reset cluster in HA mode with 1 controller on Ubuntu Bootstrap Scenario: 1. Create cluster in Ha mode with 1 controller 2. Add 1 node with controller role 3. Add 1 node with compute role 4. Verify network 5. Deploy cluster 6. Build and activate new bootstrap image 7. Stop deployment 8. Verify bootstrap on slaves 9. Add 1 node with cinder role 10. Re-deploy cluster 11. Verify network 12. Run OSTF Duration 45m Snapshot: deploy_stop_on_deploying_ubuntu_bootstrap """ if not self.env.revert_snapshot('ready_with_3_slaves'): raise SkipTest() cluster_id = self.fuel_web.create_cluster( name=self.__class__.__name__, mode=settings.DEPLOYMENT_MODE, settings={ 'tenant': 'stop_deploy', 'user': '******', 'password': '******', } ) self.fuel_web.update_nodes( cluster_id, { 'slave-01': ['controller'], 'slave-02': ['compute'] } ) # Network verification self.fuel_web.verify_network(cluster_id) # Deploy cluster and stop deployment, then verify bootstrap on slaves self.fuel_web.provisioning_cluster_wait(cluster_id) # Build another bootstrap image uuid, _ = self.env.\ fuel_bootstrap_actions.build_bootstrap_image(activate=True) self.fuel_web.deploy_task_wait(cluster_id=cluster_id, progress=10) self.fuel_web.stop_deployment_wait(cluster_id) self.fuel_web.wait_nodes_get_online_state( self.env.d_env.get_nodes(name__in=['slave-01', 'slave-02']), timeout=10 * 60) # Verify new bootstrap image on affected nodes nodes = self.env.d_env.get_nodes( name__in=["slave-01", "slave-02"]) for node in nodes: with self.fuel_web.get_ssh_for_node(node.name) as slave_remote: checkers.verify_bootstrap_on_node(slave_remote, os_type="ubuntu", uuid=uuid) # Network verification self.fuel_web.verify_network(cluster_id) self.fuel_web.update_nodes( cluster_id, { 'slave-03': ['cinder'] } ) self.fuel_web.deploy_cluster_wait(cluster_id) assert_equal( 3, len(self.fuel_web.client.list_cluster_nodes(cluster_id))) # Run ostf self.fuel_web.run_ostf(cluster_id=cluster_id, test_sets=['smoke']) self.env.make_snapshot( "deploy_stop_on_deploying_ubuntu_bootstrap", is_make=True)
def deploy_with_two_ubuntu_bootstraps(self): """Deploy cluster with two different bootstrap images Scenario: 1. Boot two nodes 2. Validate bootstrap 3. Build another one bootstrap image 4. Boot additional node 5. Validate new bootstrap 6. Create cluster in Ha mode with 1 controller, 1 compute and 1 cinder node 7. Deploy cluster 8. Verify network 9. Run OSTF Duration 45m """ if not self.env.revert_snapshot('ready'): raise SkipTest() uuid = self.env.fuel_bootstrap_actions.get_active_bootstrap_uuid() nodes = self.env.d_env.get_nodes( name__in=["slave-01", "slave-02"]) self.env.bootstrap_nodes(nodes) for node in nodes: with self.fuel_web.get_ssh_for_node(node.name) as slave_remote: checkers.verify_bootstrap_on_node(slave_remote, os_type="ubuntu", uuid=uuid) new_uuid, _ = \ self.env.fuel_bootstrap_actions.build_bootstrap_image( activate=True) new_node = self.env.d_env.get_node(name="slave-03") self.env.bootstrap_nodes([new_node]) with self.fuel_web.get_ssh_for_node(new_node.name) as slave_remote: checkers.verify_bootstrap_on_node(slave_remote, os_type="ubuntu", uuid=new_uuid) cluster_id = self.fuel_web.create_cluster( name=self.__class__.__name__, mode=settings.DEPLOYMENT_MODE, settings={ 'tenant': 'stop_deploy', 'user': '******', 'password': '******', } ) self.fuel_web.update_nodes( cluster_id, { 'slave-01': ['controller'], 'slave-02': ['compute'], 'slave-03': ['cinder'] } ) self.fuel_web.deploy_cluster_wait(cluster_id) assert_equal( 3, len(self.fuel_web.client.list_cluster_nodes(cluster_id))) # Run ostf self.fuel_web.run_ostf(cluster_id=cluster_id, test_sets=['smoke'])
def build_full_bootstrap(self): """Verify than slaves retrieved Ubuntu bootstrap with extra settings Scenario: 1. Revert snapshot ready 2. Build and activate Ubuntu bootstrap with extra settings 3. Bootstrap slaves 4. Verify Ubuntu bootstrap on slaves Duration: 20m """ self.env.revert_snapshot("ready") with self.env.d_env.get_admin_remote() as remote: bootstrap_script = '''\ #!/bin/bash echo "testdata" > /test_bootstrap_script apt-get install ipython -y ''' with tempfile.NamedTemporaryFile() as temp_file: temp_file.write(textwrap.dedent(bootstrap_script)) temp_file.flush() remote.mkdir("/root/bin") remote.upload(temp_file.name, "/root/bin/bootstrap_script.sh") remote.mkdir("/root/inject/var/lib/testdir") remote.mkdir("/root/inject/var/www/testdir2") kernel_cmdline = ["biosdevname=0", "net.ifnames=1", "debug", "ignore_loglevel", "log_buf_len=10M"] bootstrap_default_params = \ self.env.fuel_bootstrap_actions.get_bootstrap_default_config() additional_repos = [ self._get_main_repo(bootstrap_default_params["repos"], "ubuntu", "main"), self._get_main_repo(bootstrap_default_params["repos"], "ubuntu", "updates"), self._get_main_repo(bootstrap_default_params["repos"], "mos", "main")] bootstrap_params = { "ubuntu-release": "trusty", "repo": ["'deb {0} {1} {2}'".format(repo['uri'], repo['suite'], repo['section']) for repo in additional_repos], "direct-repo-addr": [self.env.admin_node_ip], "script": "/root/bin/bootstrap_script.sh", "label": "UbuntuBootstrap", "extra-dir": ["/root/inject/"], "extend-kopts": "'{0}'".format(" ".join(kernel_cmdline)), "kernel-flavor": "linux-generic-lts-saucy-eol-upgrade", "output-dir": "/tmp", "package": ["fuse", "sshfs"], } uuid, bootstrap_location = \ self.env.fuel_bootstrap_actions.build_bootstrap_image( **bootstrap_params) self.env.fuel_bootstrap_actions.\ import_bootstrap_image(bootstrap_location) self.env.fuel_bootstrap_actions.\ activate_bootstrap_image(uuid) nodes = self.env.d_env.get_nodes( name__in=["slave-01", "slave-02", "slave-03"]) self.env.bootstrap_nodes(nodes) for node in nodes: with self.fuel_web.get_ssh_for_node(node.name) as slave_remote: checkers.verify_bootstrap_on_node(slave_remote, os_type="ubuntu", uuid=uuid) for package in ['ipython', 'fuse', 'sshfs']: package_version = checkers.get_package_versions_from_node( slave_remote, name=package, os_type="Ubuntu") assert_not_equal(package_version, "", "Package {0} is not installed on slave " "{1}".format(package, node.name)) for injected_dir in ["/var/lib/testdir", "/var/www/testdir2"]: checkers.check_file_exists(slave_remote, injected_dir) file_content = \ slave_remote.execute("cat /test_bootstrap_script") assert_equal("".join(file_content["stdout"]).strip(), "testdata") actual_kernel_cmdline = "".join( slave_remote.execute("cat /proc/cmdline")["stdout"]) for kernel_opt in kernel_cmdline: assert_true(kernel_opt in actual_kernel_cmdline, "No {0} option in cmdline: {1}" .format(kernel_opt, actual_kernel_cmdline))
def deploy_stop_on_deploying_centos_bootstrap(self): """Stop reset cluster in HA mode with 1 controller on CentOS Bootstrap Scenario: 1. Create cluster in Ha mode with 1 controller 2. Add 1 node with controller role 3. Add 1 node with compute role 4. Verify network 5. Deploy cluster 6. Stop deployment 7. Verify bootstrap on slaves 8. Add 1 node with cinder role 9. Re-deploy cluster 10. Verify network 11. Run OSTF Duration 45m Snapshot: deploy_stop_on_deploying_centos_bootstrap """ if not self.env.revert_snapshot("activate_centos_bootstrap"): raise SkipTest() cluster_id = self.fuel_web.create_cluster( name=self.__class__.__name__, mode=settings.DEPLOYMENT_MODE, settings={ "tenant": "stop_deploy", "user": "******", "password": "******", "net_provider": "neutron", "net_segment_type": NEUTRON_SEGMENT_TYPE, }, ) self.fuel_web.update_nodes(cluster_id, {"slave-01": ["controller"], "slave-02": ["compute"]}) # Network verification self.fuel_web.verify_network(cluster_id) # Deploy cluster and stop deployment, then verify bootstrap on slaves self.fuel_web.provisioning_cluster_wait(cluster_id) self.fuel_web.deploy_task_wait(cluster_id=cluster_id, progress=10) self.fuel_web.stop_deployment_wait(cluster_id) self.fuel_web.wait_nodes_get_online_state( self.env.d_env.get_nodes(name__in=["slave-01", "slave-02"]), timeout=10 * 60 ) nodes = self.env.d_env.get_nodes(name__in=["slave-01", "slave-02", "slave-03"]) for node in nodes: with self.fuel_web.get_ssh_for_node(node.name) as slave_remote: checkers.verify_bootstrap_on_node(slave_remote, os_type="centos") # Network verification self.fuel_web.verify_network(cluster_id) self.fuel_web.update_nodes(cluster_id, {"slave-03": ["cinder"]}) self.fuel_web.deploy_cluster_wait(cluster_id) assert_equal(3, len(self.fuel_web.client.list_cluster_nodes(cluster_id))) # Run ostf self.fuel_web.run_ostf(cluster_id=cluster_id, test_sets=["smoke"]) self.env.make_snapshot("deploy_stop_on_deploying_centos_bootstrap", is_make=True)
def gate_patch_fuel_agent(self): """ Revert snapshot, update fuel-agent, bootstrap from review and provision one node Scenario: 1. Revert snapshot "ready" 2. Update fuel-agent, fuel-bootstrap-cli on master node 3. Update fuel_bootstrap_cli.yaml 4. Rebuild bootstrap 5. Bootstrap 5 slaves 6. Verify Ubuntu bootstrap on slaves 7. Add 1 node with controller 8. Add 1 node ironic role 9. Deploy the cluster 10. Verify fuel-agent version in ubuntu and ironic-bootstrap 11. Upload image to glance 12. Enroll Ironic nodes 13. Boot nova instance 14. Check Nova instance status Snapshot review_fuel_agent_ironic_deploy """ if not settings.UPDATE_FUEL: raise exceptions.FuelQAVariableNotSet(settings.UPDATE_FUEL, 'true') self.show_step(1, initialize=True) self.env.revert_snapshot("ready") self.show_step(2) replace_rpm_package('fuel-agent') replace_rpm_package('fuel-bootstrap-cli') self.show_step(3) self.update_bootstrap_cli_yaml() self.show_step(4) uuid, bootstrap_location = \ self.env.fuel_bootstrap_actions.build_bootstrap_image() self.env.fuel_bootstrap_actions. \ import_bootstrap_image(bootstrap_location) self.env.fuel_bootstrap_actions. \ activate_bootstrap_image(uuid) self.show_step(5) self.env.bootstrap_nodes(self.env.d_env.nodes().slaves[:2]) self.show_step(6) for node in self.env.d_env.nodes().slaves[:2]: _ip = self.fuel_web.get_nailgun_node_by_devops_node(node)['ip'] verify_bootstrap_on_node(_ip, os_type="ubuntu", uuid=uuid) data = { "net_provider": 'neutron', "net_segment_type": settings.NEUTRON_SEGMENT['vlan'], "ironic": True } nodes = {'slave-01': ['controller'], 'slave-02': ['ironic']} self.show_step(7) self.show_step(8) self.show_step(9) cluster_id = self._deploy_ironic_cluster(settings=data, nodes=nodes) ironic_conn = ironic_actions.IronicActions( self.fuel_web.get_public_vip(cluster_id)) self.show_step(10) check_package_version_injected_in_bootstraps("fuel-agent") check_package_version_injected_in_bootstraps("fuel-agent", cluster_id=cluster_id, ironic=True) self.show_step(11) self.show_step(12) self._create_os_resources(ironic_conn) self.show_step(13) self._boot_nova_instances(ironic_conn) self.show_step(14) ironic_conn.wait_for_vms(ironic_conn) ironic_conn.verify_vms_connection(ironic_conn) self.env.make_snapshot("review_fuel_agent_ironic_deploy")
def upgrade_smoke_scale(self): """Scale already existing Kilo cluster using upgraded to 8.0 Fuel. Scenario: 1. Revert 'upgrade_smoke_restore' snapshot 2. Add to existing cluster 3 nodes with controller role 3. Add to existing cluster 1 node with compute+cinder roles 4. Verify network 5. Deploy changes 6. Run OSTF 7. Remove from the cluster 1 node with controller role 8. Remove from the cluster 1 node with compute+cinder roles 9. Deploy changes 10. Wait until nodes are discovered 11. Verify that bootstrapped nodes are using ubuntu bootstrap 12. Verify network 13. Run OSTF Snapshot: upgrade_smoke_scale Duration: TODO """ self.show_step(1, initialize=True) self.env.revert_snapshot(self.snapshot_name) self.show_step(2) self.show_step(3) cluster_id = self.fuel_web.get_last_created_cluster() self.env.bootstrap_nodes(self.env.d_env.nodes().slaves[3:6]) self.fuel_web.update_nodes( cluster_id, {'slave-04': ['controller'], 'slave-05': ['controller'], 'slave-06': ['controller']}) self.show_step(4) self.fuel_web.verify_network(cluster_id) self.show_step(5) # LP 1562736 get_devops_node_by_nailgun_node is not working self.fuel_web.deploy_cluster_wait(cluster_id) self.show_step(6) self.fuel_web.run_ostf(cluster_id) cluster_id = self.fuel_web.get_last_created_cluster() self.fuel_web.deploy_cluster_wait(cluster_id) self.show_step(7) self.show_step(8) nodes_to_remove = {'slave-06': ['controller']} nailgun_nodes = self.fuel_web.update_nodes( cluster_id, nodes_to_remove, False, True) pending_nodes = [x for x in nailgun_nodes if x["pending_deletion"]] self.show_step(9) self.fuel_web.deploy_cluster_wait(cluster_id, check_services=False) self.show_step(10) self.show_step(11) for node in pending_nodes: wait(lambda: self.fuel_web.is_node_discovered(node), timeout=6 * 60) with self.fuel_web.get_ssh_for_node( self.fuel_web.get_devops_node_by_nailgun_node( node).name) as slave_remote: checkers.verify_bootstrap_on_node(slave_remote, "ubuntu") self.show_step(12) self.fuel_web.verify_network(cluster_id) self.show_step(13) self.fuel_web.run_ostf(cluster_id) self.env.make_snapshot("upgrade_smoke_scale")
def upgrade_smoke_restore(self): """Reinstall Fuel and restore non-HA cluster using fuel-octane. Scenario: 1. Revert "upgrade_smoke" snapshot 2. Reinstall Fuel master using iso given in ISO_PATH 3. Install fuel-octane package 4. Upload the backup back to reinstalled Fuel maser node 5. Restore master node using 'octane fuel-restore' 6. Check that nailgun is available 7. Check cobbler configs for all discovered nodes 8. Check ubuntu bootstrap is available 9. Verify networks 10. Run OSTF Snapshot: upgrade_smoke_restore Duration: TODO """ assert_true(os.path.exists(self.repos_local_path)) assert_true(os.path.exists(self.local_path)) self.check_run(self.snapshot_name) self.show_step(1, initialize=True) assert_true( self.env.revert_snapshot(self.source_snapshot_name), "The test can not use given environment - snapshot " "{!r} does not exists".format(self.source_snapshot_name)) self.show_step(2) self.env.reinstall_master_node() self.show_step(3) self.show_step(4) self.show_step(5) self.do_restore(self.backup_path, self.local_path, self.repos_backup_path, self.repos_local_path) # Check nailgun api is available self.show_step(6) self.fuel_web.change_default_network_settings() cluster_id = self.fuel_web.get_last_created_cluster() self.show_step(7) for node in self.fuel_web.client.list_cluster_nodes(cluster_id): checkers.check_cobbler_node_exists(self.admin_remote, node['id']) # Check non-default parameters of the cluster creds = self.fuel_web.get_cluster_credentials(cluster_id) assert_equal(sorted(creds.values()), sorted(self.cluster_creds.values())) self.show_step(8) slave_03 = self.env.d_env.get_node(name="slave-03") self.env.bootstrap_nodes([slave_03]) with self.fuel_web.get_ssh_for_node(slave_03.name) as slave_remote: checkers.verify_bootstrap_on_node(slave_remote, "ubuntu") self.show_step(9) self.fuel_web.verify_network(cluster_id) self.show_step(10) self.fuel_web.run_ostf(cluster_id) self.env.make_snapshot("upgrade_smoke_restore", is_make=True) self.cleanup()
def deploy_stop_on_deploying_centos_bootstrap(self): """Stop reset cluster in HA mode with 1 controller on CentOS Bootstrap Scenario: 1. Create cluster in Ha mode with 1 controller 2. Add 1 node with controller role 3. Add 1 node with compute role 4. Verify network 5. Deploy cluster 6. Stop deployment 7. Verify bootstrap on slaves 8. Add 1 node with cinder role 9. Re-deploy cluster 10. Verify network 11. Run OSTF Duration 45m Snapshot: deploy_stop_on_deploying_centos_bootstrap """ if not self.env.revert_snapshot('activate_centos_bootstrap'): raise SkipTest() cluster_id = self.fuel_web.create_cluster( name=self.__class__.__name__, mode=settings.DEPLOYMENT_MODE, settings={ 'tenant': 'stop_deploy', 'user': '******', 'password': '******', "net_provider": 'neutron', "net_segment_type": NEUTRON_SEGMENT_TYPE }) self.fuel_web.update_nodes(cluster_id, { 'slave-01': ['controller'], 'slave-02': ['compute'] }) # Network verification self.fuel_web.verify_network(cluster_id) # Deploy cluster and stop deployment, then verify bootstrap on slaves self.fuel_web.provisioning_cluster_wait(cluster_id) self.fuel_web.deploy_task_wait(cluster_id=cluster_id, progress=10) self.fuel_web.stop_deployment_wait(cluster_id) self.fuel_web.wait_nodes_get_online_state( self.env.d_env.get_nodes(name__in=['slave-01', 'slave-02']), timeout=10 * 60) nodes = self.env.d_env.get_nodes( name__in=['slave-01', 'slave-02', 'slave-03']) for node in nodes: with self.fuel_web.get_ssh_for_node(node.name) as slave_remote: checkers.verify_bootstrap_on_node(slave_remote, os_type="centos") # Network verification self.fuel_web.verify_network(cluster_id) self.fuel_web.update_nodes(cluster_id, {'slave-03': ['cinder']}) self.fuel_web.deploy_cluster_wait(cluster_id) assert_equal(3, len(self.fuel_web.client.list_cluster_nodes(cluster_id))) # Run ostf self.fuel_web.run_ostf(cluster_id=cluster_id, test_sets=['smoke']) self.env.make_snapshot("deploy_stop_on_deploying_centos_bootstrap", is_make=True)