diff options
author | Peter Stachowski <peter@tesora.com> | 2016-08-15 17:01:43 +0000 |
---|---|---|
committer | Peter Stachowski <peter@tesora.com> | 2016-09-02 15:40:01 +0000 |
commit | a14c5ce2e711c88297b6e6bd3d77295a5d226b87 (patch) | |
tree | 9ea9ef5ab18d662b5fcaad7f0cb7dac7a97d3b81 | |
parent | c637e5ffc2a29dabbf17decb70f6b3a05ab4b8ae (diff) | |
download | trove-integration-a14c5ce2e711c88297b6e6bd3d77295a5d226b87.tar.gz |
Speed up creation of flavors
When creating the flavors necessary for redstack int-tests
'nova flavor-list' is executed for each flavor. This adds
over a minute to the kick-start process, even if all the
flavors already exists.
This change caches the list of flavors and passes it into
the add_flavor routine to avoid the overhead of multiple
flavor-list calls.
Change-Id: Ib70efd4eeb6f6808360d9baaac14edd5a6e84934
-rwxr-xr-x | scripts/redstack | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/scripts/redstack b/scripts/redstack index 7ac423a..0b5dbcc 100755 --- a/scripts/redstack +++ b/scripts/redstack @@ -200,12 +200,15 @@ function ip_chunk() { # Add a flavor and a corresponding flavor.resize # (flavor.resize adds 16 to the memory and one more vcpu) function add_flavor() { - FLAVOR_NAME=$1 - FLAVOR_ID=$2 - FLAVOR_MEMORY_MB=$3 - FLAVOR_ROOT_GB=$4 - FLAVOR_VCPUS=$5 - + local FLAVOR_NAME=$1 + local FLAVOR_ID=$2 + local FLAVOR_MEMORY_MB=$3 + local FLAVOR_ROOT_GB=$4 + local FLAVOR_VCPUS=$5 + + if [[ -z "$FLAVOR_LIST_FOR_ADD" ]]; then + FLAVOR_LIST_FOR_ADD=$(nova $credentials flavor-list | cut -d'|' -f3 | sed -e's/ /,/g') + fi credentials="--os-username=admin --os-password=$ADMIN_PASSWORD --os-tenant-name=admin --os-auth-url=$TROVE_AUTH_ENDPOINT" base_id=${FLAVOR_ID} @@ -238,7 +241,7 @@ function add_flavor() { memory=$((${FLAVOR_MEMORY_MB} + 16)) vcpus=$((${FLAVOR_VCPUS} + 1)) fi - if [[ -z $(nova $credentials flavor-list | grep "| $name[ ]* |") ]]; then + if [[ $FLAVOR_LIST_FOR_ADD != *",$name,"* ]]; then nova $credentials flavor-create $name $id $memory $FLAVOR_ROOT_GB $vcpus --ephemeral $ephemeral fi done |