From 3b80bde8c7345a5e8c217b6c5c256c2f83aa7900 Mon Sep 17 00:00:00 2001 From: Clark Boylan Date: Wed, 20 Nov 2013 17:51:50 -0800 Subject: [PATCH] Check if flavors exist before creating them. * lib/tempest: When creating the m1.tiny and m1.nano flavors ensure that they don't exist first. This is important for Grenade where code may be run multiple times and should expect that some things preexist. Change-Id: I1772d4334f39d612f8a187eb5311a1b2caee3953 --- lib/tempest | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/tempest b/lib/tempest index ec1fc90b76..cbf6a76610 100644 --- a/lib/tempest +++ b/lib/tempest @@ -73,6 +73,7 @@ function configure_tempest() { local password local line local flavors + local available_flavors local flavors_ref local flavor_lines local public_network_id @@ -142,10 +143,15 @@ function configure_tempest() { # If the ``DEFAULT_INSTANCE_TYPE`` not declared, use the new behavior # Tempest creates instane types for himself if [[ -z "$DEFAULT_INSTANCE_TYPE" ]]; then - nova flavor-create m1.nano 42 64 0 1 + available_flavors=$(nova flavor-list) + if [[ ! ( $available_flavors =~ 'm1.nano' ) ]]; then + nova flavor-create m1.nano 42 64 0 1 + fi flavor_ref=42 boto_instance_type=m1.nano - nova flavor-create m1.micro 84 128 0 1 + if [[ ! ( $available_flavors =~ 'm1.micro' ) ]]; then + nova flavor-create m1.micro 84 128 0 1 + fi flavor_ref_alt=84 else # Check Nova for existing flavors and, if set, look for the