Ask Your Question
0

What is the proper format to pass allocation_pools to a nested stack?

asked 2014-10-13 10:29:54 -0500

Heather gravatar image

updated 2014-10-13 14:10:10 -0500

I have tried numerous combinations trying to get this to work. I have tried both comma_delimited_list and json types.

When I hardcode this into the nested stack:

allocation_pools: [ { "start": "192.168.20.2", "end": "192.168.20.254" } ]

it works.

When I try to pass it in as a parameter I get an error that says it is not a list.

This is a section of the resource def where it is passed in:

 NestZone2:
    type: zone_network.template
    properties:
      zone_name: nzone2
      cidr: 192.168.21.0/24
      allocation_pools: [ { "start": "192.168.21.2", "end": "192.168.21.254"
} ]
      gateway_ip: 192.168.21.1
      shared_network: 'False's
      enable_dhcp: 'True'

In the nested template the parameter is defined as:

  allocation_pools:
    type: json
    description: Network Allocation Pools

And the resource snippet in the nested template is

  shared_network:
    properties:
      name: |
        str_replace:
          template: |
            $subnet
          params:
            $subnet: { get_param: zone_name }-subnet
      network_id:
        get_resource: zone_network
      allocation_pools:
        get_param: allocation_pools
      cidr:
        get_param: cidr

I've tried various yaml formats for a map in a list without success. I either get the error that it is not a list or that it is not a map. I figure this is a duh question, but I'm tired of beating my head against it.

edit retag flag offensive close merge delete

Comments

Can you show us how you've tried passing in the parameter?

larsks gravatar imagelarsks ( 2014-10-13 13:51:28 -0500 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2014-10-13 14:18:11 -0500

larsks gravatar image

updated 2014-10-13 14:22:27 -0500

It looks like parameters cannot be a list. If you only need a single allocation pool (or N allocation pools, where you know N in advance and you following this model for allocation_pool_0, allocation_pool_1, etc), this worked for me:

In "master.yaml":

resources:
  server:
    type: server.yaml
    properties:
      image:
        get_param: server_image
      flavor:
        get_param: server_flavor
      key_name:
        get_param: ssh_key_name
      external_network_id:
        get_param: external_network_id
      allocation_pool:
        start: 10.1.0.100
        end: 10.1.0.150

And in "server.yaml":

parameters:

  image:
    type: string
  flavor:
    type: string
  key_name:
    type: string
  external_network_id:
    type: string
  allocation_pool:
    type: json

resources:
  fixed_network:
    type: "OS::Neutron::Net"

  fixed_subnet:
    type: "OS::Neutron::Subnet"
    properties:
      cidr: 10.1.0.0/24
      network_id: {get_resource: fixed_network}
      allocation_pools:
        - {get_param: allocation_pool}

I've put the complete templates on github.

Also, note that this:

allocation_pool:
  start: 10.1.0.100
  end: 10.1.0.150

Is completely identical to:

allocation_pool: {start: 10.1.0.100, end: 10.1.0.150}
edit flag offensive delete link more

Comments

I see, so you make it a list in the server.yaml and just pass in a map to put in the list. I never considered that. Thanks.

Heather gravatar imageHeather ( 2014-10-13 15:05:35 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower

Stats

Asked: 2014-10-13 10:29:54 -0500

Seen: 1,191 times

Last updated: Oct 13 '14