Improves Heat Demo Functionality

Previously, the Heat demo suffered from the following limitations:

1. The number of Nova instances to spawn and the image flavor were
   hard coded in the Heat template.

2. No outputs existed. This required users to run nova-list to
   obtain the IP's of VMs.

3. No documentation existed.

This patch addresses the above limitations.

Change-Id: I495aa9c73a91200c01cecc1719ee5532c1f6c9cb
This commit is contained in:
Daneyon Hansen 2015-05-12 15:24:12 -07:00
parent 57990a94ae
commit e65e059852
4 changed files with 47 additions and 3 deletions

13
demos/heat/README.md Normal file
View File

@ -0,0 +1,13 @@
A Kolla Demo using Heat
=======================
By default, the launch script will spawn 3 Nova instances on a
Neutron network created from the tools/init-runonce script. Edit
the VM_COUNT parameter in the launch script if you would like to
spawn a different amount of Nova instances. Edit the IMAGE_FLAVOR
if you would like to launch images using a flavor other than
m1.tiny.
Then run the script:
$ ./launch

View File

@ -1,3 +1,5 @@
VM_COUNT=3
IMAGE_FLAVOR=m1.small
PUBLIC_NET_ID=$(neutron net-list | grep public | awk '{print $2}') PUBLIC_NET_ID=$(neutron net-list | grep public | awk '{print $2}')
DEMO_NET_ID=$(neutron net-list | grep demo | awk '{print $2}') DEMO_NET_ID=$(neutron net-list | grep demo | awk '{print $2}')
DEMO_SUBNET_ID=$(neutron net-list | grep demo | awk '{print $6}') DEMO_SUBNET_ID=$(neutron net-list | grep demo | awk '{print $6}')
@ -6,4 +8,4 @@ echo Public net id is $PUBLIC_NET_ID
echo Demo net id is $DEMO_NET_ID echo Demo net id is $DEMO_NET_ID
echo Demo subnet id is $DEMO_SUBNET_ID echo Demo subnet id is $DEMO_SUBNET_ID
heat stack-create steak --template-file steak-rg.yaml --parameters="public_net_id=$PUBLIC_NET_ID;demo_net_id=$DEMO_NET_ID;demo_subnet_id=$DEMO_SUBNET_ID" heat stack-create steak --template-file steak-rg.yaml --parameters="vm_count=$VM_COUNT;image_flavor=$IMAGE_FLAVOR;public_net_id=$PUBLIC_NET_ID;demo_net_id=$DEMO_NET_ID;demo_subnet_id=$DEMO_SUBNET_ID"

View File

@ -13,14 +13,31 @@ parameters:
type: string type: string
description: uuid of a subnet on the fixed network to use for creating ports description: uuid of a subnet on the fixed network to use for creating ports
vm_count:
type: string
description: Number of VMs to launch
image_flavor:
type: string
description: Image flavor to use when launching VMs
resources: resources:
steak: steak:
type: OS::Heat::ResourceGroup type: OS::Heat::ResourceGroup
properties: properties:
count: 2 count:
get_param: vm_count
resource_def: resource_def:
type: steak.yaml type: steak.yaml
properties: properties:
image_flavor: {get_param: image_flavor}
public_net_id: {get_param: public_net_id} public_net_id: {get_param: public_net_id}
demo_net_id: {get_param: demo_net_id} demo_net_id: {get_param: demo_net_id}
demo_subnet_id: {get_param: demo_subnet_id} demo_subnet_id: {get_param: demo_subnet_id}
outputs:
eth0:
value: {get_attr: [steak, eth0]}
float:
value: {get_attr: [steak, float]}

View File

@ -13,13 +13,18 @@ parameters:
type: string type: string
description: uuid of a subnet on the fixed network to use for creating ports description: uuid of a subnet on the fixed network to use for creating ports
image_flavor:
type: string
description: Number of VMs to launch
resources: resources:
steak_node: steak_node:
type: "OS::Nova::Server" type: "OS::Nova::Server"
properties: properties:
key_name: mykey key_name: mykey
image: cirros image: cirros
flavor: m1.small flavor:
get_param: image_flavor
networks: networks:
- port: - port:
get_resource: steak_node_eth0 get_resource: steak_node_eth0
@ -40,3 +45,10 @@ resources:
get_param: public_net_id get_param: public_net_id
port_id: port_id:
get_resource: steak_node_eth0 get_resource: steak_node_eth0
outputs:
eth0:
value: {get_attr: [steak_node_eth0, fixed_ips, 0, ip_address]}
float:
value: {get_attr: [steak_node_floating, floating_ip_address]}