From b1870cde748e51aaf8d32c9649aeaed9d45650f6 Mon Sep 17 00:00:00 2001 From: Evgeny Antyshev Date: Fri, 20 Jan 2017 10:52:13 +0000 Subject: [PATCH] Ability to customize flavors in Tempest We need custom flavors, since we run Tempest on Virtuozzo in CentOs 7 containers, they require more resources. Change-Id: I83187e103e4bb80ad87afcf1c0a7583149f98828 --- docs/packstack.rst | 24 +++++ packstack/plugins/provision_700.py | 98 +++++++++++++++++++ .../packstack/manifests/provision/tempest.pp | 34 ++++--- ...stom-tempest-flavors-baa5cf02235f78dd.yaml | 5 + 4 files changed, 148 insertions(+), 13 deletions(-) create mode 100644 releasenotes/notes/custom-tempest-flavors-baa5cf02235f78dd.yaml diff --git a/docs/packstack.rst b/docs/packstack.rst index b536579fd..f09fd9597 100755 --- a/docs/packstack.rst +++ b/docs/packstack.rst @@ -1016,6 +1016,30 @@ Provisioning tempest config **CONFIG_PROVISION_TEMPEST_FLOATRANGE** CIDR network address for the floating IP subnet. +**CONFIG_PROVISION_TEMPEST_FLAVOR_NAME** + Primary flavor name to use in Tempest. + +**CONFIG_PROVISION_TEMPEST_FLAVOR_DISK** + Primary flavor's disk quota in Gb. + +**CONFIG_PROVISION_TEMPEST_FLAVOR_RAM** + Primary flavor's ram in Mb. + +**CONFIG_PROVISION_TEMPEST_FLAVOR_VCPUS** + Primary flavor's vcpus number. + +**CONFIG_PROVISION_TEMPEST_FLAVOR_ALT_NAME** + Alternative flavor name to use in Tempest. + +**CONFIG_PROVISION_TEMPEST_FLAVOR_ALT_DISK** + Alternative flavor's disk quota in Gb. + +**CONFIG_PROVISION_TEMPEST_FLAVOR_ALT_RAM** + Alternative flavor's ram in Mb. + +**CONFIG_PROVISION_TEMPEST_FLAVOR_ALT_VCPUS** + Alternative flavor's vcpus number. + **CONFIG_RUN_TEMPEST** Specify 'y' to run Tempest smoke test as last step of installation. diff --git a/packstack/plugins/provision_700.py b/packstack/plugins/provision_700.py index f5005b26f..50c0aef8b 100644 --- a/packstack/plugins/provision_700.py +++ b/packstack/plugins/provision_700.py @@ -285,6 +285,104 @@ def initConfig(controller): "NEED_CONFIRM": False, "CONDITION": False}, + {"CMD_OPTION": "provision-tempest-flavor-name", + "PROMPT": "What is the name of the primary Tempest flavor?", + "OPTION_LIST": False, + "VALIDATORS": [validators.validate_not_empty], + "DEFAULT_VALUE": "m1.nano", + "MASK_INPUT": False, + "LOOSE_VALIDATION": True, + "CONF_NAME": "CONFIG_PROVISION_TEMPEST_FLAVOR_NAME", + "USE_DEFAULT": False, + "NEED_CONFIRM": False, + "CONDITION": False}, + + {"CMD_OPTION": "provision-tempest-flavor-disk", + "PROMPT": ("How much of disk space has " + "the primary Tempest flavor (Gb)?"), + "OPTION_LIST": False, + "VALIDATORS": [validators.validate_integer], + "DEFAULT_VALUE": "0", + "MASK_INPUT": False, + "LOOSE_VALIDATION": True, + "CONF_NAME": "CONFIG_PROVISION_TEMPEST_FLAVOR_DISK", + "USE_DEFAULT": False, + "NEED_CONFIRM": False, + "CONDITION": False}, + + {"CMD_OPTION": "provision-tempest-flavor-ram", + "PROMPT": "How much is the primary Tempest flavor's ram (Mb)?", + "OPTION_LIST": False, + "VALIDATORS": [validators.validate_integer], + "DEFAULT_VALUE": "128", + "MASK_INPUT": False, + "LOOSE_VALIDATION": True, + "CONF_NAME": "CONFIG_PROVISION_TEMPEST_FLAVOR_RAM", + "USE_DEFAULT": False, + "NEED_CONFIRM": False, + "CONDITION": False}, + + {"CMD_OPTION": "provision-tempest-flavor-vcpus", + "PROMPT": "How many vcpus is in the primary Tempest flavor?", + "OPTION_LIST": False, + "VALIDATORS": [validators.validate_integer], + "DEFAULT_VALUE": "1", + "MASK_INPUT": False, + "LOOSE_VALIDATION": True, + "CONF_NAME": "CONFIG_PROVISION_TEMPEST_FLAVOR_VCPUS", + "USE_DEFAULT": False, + "NEED_CONFIRM": False, + "CONDITION": False}, + + {"CMD_OPTION": "provision-tempest-flavor-alt-name", + "PROMPT": "What is the name of the alternative Tempest flavor?", + "OPTION_LIST": False, + "VALIDATORS": [validators.validate_not_empty], + "DEFAULT_VALUE": "m1.micro", + "MASK_INPUT": False, + "LOOSE_VALIDATION": True, + "CONF_NAME": "CONFIG_PROVISION_TEMPEST_FLAVOR_ALT_NAME", + "USE_DEFAULT": False, + "NEED_CONFIRM": False, + "CONDITION": False}, + + {"CMD_OPTION": "provision-tempest-flavor-alt-disk", + "PROMPT": ("How much of disk space has " + "the alternative Tempest flavor (Gb)?"), + "OPTION_LIST": False, + "VALIDATORS": [validators.validate_integer], + "DEFAULT_VALUE": "0", + "MASK_INPUT": False, + "LOOSE_VALIDATION": True, + "CONF_NAME": "CONFIG_PROVISION_TEMPEST_FLAVOR_ALT_DISK", + "USE_DEFAULT": False, + "NEED_CONFIRM": False, + "CONDITION": False}, + + {"CMD_OPTION": "provision-tempest-flavor-alt-ram", + "PROMPT": "How much is the alternative Tempest flavor's ram?", + "OPTION_LIST": False, + "VALIDATORS": [validators.validate_integer], + "DEFAULT_VALUE": "128", + "MASK_INPUT": False, + "LOOSE_VALIDATION": True, + "CONF_NAME": "CONFIG_PROVISION_TEMPEST_FLAVOR_ALT_RAM", + "USE_DEFAULT": False, + "NEED_CONFIRM": False, + "CONDITION": False}, + + {"CMD_OPTION": "provision-tempest-flavor-alt-vcpus", + "PROMPT": "How many vcpus has the alternative Tempest flavor?", + "OPTION_LIST": False, + "VALIDATORS": [validators.validate_integer], + "DEFAULT_VALUE": "1", + "MASK_INPUT": False, + "LOOSE_VALIDATION": True, + "CONF_NAME": "CONFIG_PROVISION_TEMPEST_FLAVOR_ALT_VCPUS", + "USE_DEFAULT": False, + "NEED_CONFIRM": False, + "CONDITION": False}, + {"CMD_OPTION": "run-tempest", "PROMPT": ("Do you wish to run tempest?"), "OPTION_LIST": ["y", "n"], diff --git a/packstack/puppet/modules/packstack/manifests/provision/tempest.pp b/packstack/puppet/modules/packstack/manifests/provision/tempest.pp index 2680f404f..a19128b0d 100644 --- a/packstack/puppet/modules/packstack/manifests/provision/tempest.pp +++ b/packstack/puppet/modules/packstack/manifests/provision/tempest.pp @@ -53,24 +53,32 @@ class packstack::provision::tempest () $tempest_user = hiera('CONFIG_PROVISION_TEMPEST_USER') $tempest_password = hiera('CONFIG_PROVISION_TEMPEST_USER_PW') - # Nano and Micro flavors are used, otherwise flavors used by default too much resources for nothing - $tempest_flavor_ref = "42" - $tempest_flavor_ref_alt = "84" + $tempest_flavor_name = hiera('CONFIG_PROVISION_TEMPEST_FLAVOR_NAME') + $tempest_flavor_ref = "42" + $tempest_flavor_ram = hiera('CONFIG_PROVISION_TEMPEST_FLAVOR_RAM') + $tempest_flavor_disk = hiera('CONFIG_PROVISION_TEMPEST_FLAVOR_DISK') + $tempest_flavor_vcpus= hiera('CONFIG_PROVISION_TEMPEST_FLAVOR_VCPUS') - nova_flavor { 'm1.nano': + $tempest_flavor_alt_name = hiera('CONFIG_PROVISION_TEMPEST_FLAVOR_ALT_NAME') + $tempest_flavor_alt_ref = "84" + $tempest_flavor_alt_ram = hiera('CONFIG_PROVISION_TEMPEST_FLAVOR_ALT_RAM') + $tempest_flavor_alt_disk = hiera('CONFIG_PROVISION_TEMPEST_FLAVOR_ALT_DISK') + $tempest_flavor_alt_vcpus= hiera('CONFIG_PROVISION_TEMPEST_FLAVOR_ALT_VCPUS') + + nova_flavor { $tempest_flavor_name : ensure => present, id => $tempest_flavor_ref, - ram => '128', - disk => '0', - vcpus => '1', + ram => $tempest_flavor_ram, + disk => $tempest_flavor_disk, + vcpus => $tempest_flavor_vcpus, require => [ Class['::nova::api'], Class['::nova::keystone::auth'] ], } - nova_flavor { 'm1.micro': + nova_flavor { $tempest_flavor_alt_name : ensure => present, - id => $tempest_flavor_ref_alt, - ram => '128', - disk => '0', - vcpus => '1', + id => $tempest_flavor_alt_ref, + ram => $tempest_flavor_alt_ram, + disk => $tempest_flavor_alt_disk, + vcpus => $tempest_flavor_alt_vcpus, require => [ Class['::nova::api'], Class['::nova::keystone::auth'] ], } @@ -122,7 +130,7 @@ class packstack::provision::tempest () configure_networks => $configure_networks, debug => $debug, flavor_ref => $tempest_flavor_ref, - flavor_ref_alt => $tempest_flavor_ref_alt, + flavor_ref_alt => $tempest_flavor_alt_ref, glance_available => $glance_available, heat_available => $heat_available, horizon_available => $horizon_available, diff --git a/releasenotes/notes/custom-tempest-flavors-baa5cf02235f78dd.yaml b/releasenotes/notes/custom-tempest-flavors-baa5cf02235f78dd.yaml new file mode 100644 index 000000000..ce9b92bb9 --- /dev/null +++ b/releasenotes/notes/custom-tempest-flavors-baa5cf02235f78dd.yaml @@ -0,0 +1,5 @@ +--- +features: + - | + Added new set of variables CONFIG_PROVISION_TEMPEST_FLAVOR_*, + enabling the customization of created flavors.