From fda9444ea63ec436e7598ebb4ce221db0dd5d97d Mon Sep 17 00:00:00 2001
From: Dave McCowan <dmccowan@cisco.com>
Date: Wed, 6 Apr 2016 23:31:10 -0700
Subject: [PATCH] Add default flavors during init-runonce

The nova team is removing the default flavors from a standard
deployment.  This is great for operators, who have to delete
the defaults anyways.  This patch adds the original default
flavors back during init-runonce so kolla users can be ready
to launch instances.

Closes-Bug: #1567964
Change-Id: I17daec98997a6e412a99f34d3f8a4324460d8c60
---
 tools/init-runonce | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/tools/init-runonce b/tools/init-runonce
index a0f2dc891c..303669f15e 100755
--- a/tools/init-runonce
+++ b/tools/init-runonce
@@ -89,3 +89,12 @@ nova quota-update --user $ADMIN_USER_ID --cores 40 $ADMIN_PROJECT_ID
 # 96GB ram
 nova quota-update --ram 96000 $ADMIN_PROJECT_ID
 nova quota-update --user $ADMIN_USER_ID --ram 96000 $ADMIN_PROJECT_ID
+
+# add default flavors, if they don't already exist
+if ! openstack flavor list | grep -q m1.tiny; then
+        openstack flavor create --id 1 --ram 512 --disk 1 --vcpus 1 m1.tiny
+        openstack flavor create --id 2 --ram 2048 --disk 20 --vcpus 1 m1.small
+        openstack flavor create --id 3 --ram 4096 --disk 40 --vcpus 2 m1.medium
+        openstack flavor create --id 4 --ram 8192 --disk 80 --vcpus 4 m1.large
+        openstack flavor create --id 5 --ram 16384 --disk 160 --vcpus 8 m1.xlarge
+fi