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
diff --git a/lib/tempest b/lib/tempest
index ec1fc90..cbf6a76 100644
--- a/lib/tempest
+++ b/lib/tempest
@@ -73,6 +73,7 @@
     local password
     local line
     local flavors
+    local available_flavors
     local flavors_ref
     local flavor_lines
     local public_network_id
@@ -142,10 +143,15 @@
     # 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