From 3c034fdc118ffebfe6803fdec03adc55d86219e6 Mon Sep 17 00:00:00 2001 From: Lukas Bezdicka Date: Wed, 11 Nov 2015 14:18:43 +0100 Subject: [PATCH] Add posibility to run tempest as one of the steps We add config option CONFIG_RUN_TEMPEST and we'll run tempest smoke test after running puppet in postscript. Change-Id: Iaedf300da50a1eedb11c94686617a0c95c812184 --- docs/packstack.rst | 4 +-- .../{postscript_948.py => postscript_951.py} | 25 +++++++++--------- packstack/plugins/provision_700.py | 26 +++++++++++++++---- packstack/puppet/templates/postscript.pp | 4 --- .../puppet/templates/provision_tempest.pp | 5 ++++ 5 files changed, 41 insertions(+), 23 deletions(-) rename packstack/plugins/{postscript_948.py => postscript_951.py} (70%) delete mode 100644 packstack/puppet/templates/postscript.pp diff --git a/docs/packstack.rst b/docs/packstack.rst index bb7e3379a..30c57b490 100644 --- a/docs/packstack.rst +++ b/docs/packstack.rst @@ -983,8 +983,8 @@ Provisioning tempest config **CONFIG_PROVISION_TEMPEST_REPO_REVISION** Revision (branch) of the Integration Test Suite git repository. -**CONFIG_TEMPEST_HOST** - Host to deploy Tempest on. On multinode installs defaults to first host in CONFIG_NETWORK_HOSTS. +**CONFIG_RUN_TEMPEST** + Specify 'y' to run Tempest smoke test as last step of installation. Provisioning all-in-one ovs bridge config ----------------------------------------- diff --git a/packstack/plugins/postscript_948.py b/packstack/plugins/postscript_951.py similarity index 70% rename from packstack/plugins/postscript_948.py rename to packstack/plugins/postscript_951.py index 7264050e0..732afb42e 100644 --- a/packstack/plugins/postscript_948.py +++ b/packstack/plugins/postscript_951.py @@ -18,9 +18,6 @@ Plugin responsible for post-installation configuration from packstack.installer import utils -from packstack.modules.common import filtered_hosts -from packstack.modules.ospluginutils import appendManifestFile -from packstack.modules.ospluginutils import getManifestTemplate # ------------- Postscript Packstack Plugin Initialization -------------- @@ -39,18 +36,22 @@ def initConfig(controller): def initSequences(controller): - postscript_steps = [ - {'title': 'Adding post install manifest entries', - 'functions': [create_manifest]} - ] + config = controller.CONF + postscript_steps = [] + if (config['CONFIG_PROVISION_TEMPEST'] == "y" and + config['CONFIG_RUN_TEMPEST'] == "y"): + postscript_steps.append( + {'title': 'Running Tempest', + 'functions': [run_tempest]} + ) controller.addSequence("Running post install scripts", [], [], postscript_steps) # -------------------------- step functions -------------------------- -def create_manifest(config, messages): - for hostname in filtered_hosts(config): - manifestfile = "%s_postscript.pp" % hostname - manifestdata = getManifestTemplate("postscript") - appendManifestFile(manifestfile, manifestdata, 'postscript') +def run_tempest(config, messages): + print("Running Tempest on %s" % config['CONFIG_TEMPEST_HOST']) + server = utils.ScriptRunner(config['CONFIG_TEMPEST_HOST']) + server.append('/var/lib/tempest/run_tempest.sh -V -s') + server.execute() diff --git a/packstack/plugins/provision_700.py b/packstack/plugins/provision_700.py index 0fb54dd1b..ab8769052 100644 --- a/packstack/plugins/provision_700.py +++ b/packstack/plugins/provision_700.py @@ -21,7 +21,6 @@ from packstack.installer import utils from packstack.installer import validators from packstack.installer import processors -from packstack.modules.common import is_all_in_one from packstack.modules.documentation import update_params_usage from packstack.modules.ospluginutils import appendManifestFile from packstack.modules.ospluginutils import getManifestTemplate @@ -41,8 +40,12 @@ DEMO_IMAGE_FORMAT = 'qcow2' def initConfig(controller): - def process_provision(param, process_args=None): - return param if is_all_in_one(controller.CONF) else 'n' + def process_tempest(param, param_name, config=None): + if param == "": + # In case of multinode installs by default we deploy + # Tempest on network node + return config['CONFIG_NETWORK_HOSTS'].split(',')[0] + return param conf_params = { "PROVISION_INIT": [ @@ -143,7 +146,8 @@ def initConfig(controller): "PROMPT": "Enter the host where to deploy Tempest", "OPTION_LIST": [], "VALIDATORS": [validators.validate_ssh], - "DEFAULT_VALUE": utils.get_localhost_ip(), + "DEFAULT_VALUE": "", + "PROCESSORS": [process_tempest], "MASK_INPUT": False, "LOOSE_VALIDATION": True, "CONF_NAME": "CONFIG_TEMPEST_HOST", @@ -214,6 +218,18 @@ def initConfig(controller): "USE_DEFAULT": False, "NEED_CONFIRM": False, "CONDITION": False}, + + {"CMD_OPTION": "run-tempest", + "PROMPT": ("Do you wish to run "), + "OPTION_LIST": ["y", "n"], + "VALIDATORS": [validators.validate_options], + "DEFAULT_VALUE": "n", + "MASK_INPUT": False, + "LOOSE_VALIDATION": True, + "CONF_NAME": "CONFIG_RUN_TEMPEST", + "USE_DEFAULT": False, + "NEED_CONFIRM": False, + "CONDITION": False}, ], "PROVISION_OVS_BRIDGE": [ @@ -330,7 +346,7 @@ def create_bridge_manifest(config, messages): for host in utils.split_hosts(config['CONFIG_NETWORK_HOSTS']): manifest_file = '{}_provision_bridge.pp'.format(host) manifest_data = getManifestTemplate("provision_bridge") - appendManifestFile(manifest_file, manifest_data, 'provision') + appendManifestFile(manifest_file, manifest_data, 'bridge') def create_storage_manifest(config, messages): diff --git a/packstack/puppet/templates/postscript.pp b/packstack/puppet/templates/postscript.pp deleted file mode 100644 index c01db7b28..000000000 --- a/packstack/puppet/templates/postscript.pp +++ /dev/null @@ -1,4 +0,0 @@ -exec { 'update-selinux-policy': - path => '/usr/bin/', - command => 'yum update -y selinux-policy-targeted', -} diff --git a/packstack/puppet/templates/provision_tempest.pp b/packstack/puppet/templates/provision_tempest.pp index cc093f399..47f0e2b03 100644 --- a/packstack/puppet/templates/provision_tempest.pp +++ b/packstack/puppet/templates/provision_tempest.pp @@ -67,6 +67,11 @@ $heat_available = str2bool(hiera('CONFIG_HEAT_INSTALL')) $swift_available = str2bool(hiera('CONFIG_SWIFT_INSTALL')) $configure_tempest = str2bool(hiera('CONFIG_PROVISION_TEMPEST')) +# on standalone install we depend on this package +package {'python-openstackclient': + before => Class['::tempest'], +} + class { '::tempest': admin_username => $admin_username, admin_password => $admin_password,