Hostname and static IP addresses not configured when using Heat and Cinder boot volume

asked 2015-04-21 09:57:42 -0500

Steve R. gravatar image

I'm using a Heat template to configure the following in a Linux VM:

  1. Create ports with static IPs in Neutron.
  2. Create a boot volume in Cinder from an image stored in Glance.
  3. Create an empty data volume in Cinder.
  4. Assign these resources to the newly created VM.

The orchestration itself works but the VM isn't configured with the IP addresses or hostname specified in the template. Before I started using Cinder for the boot volume, I created the VM from an the same image file and the hostname and IP addresses were correctly set up. The ports and IP addresses are set up in Neutron, the volumes are created in Cinder, Nova creates the VM and assigns all the resources to it and Heat marks the stack as complete.

We're using Icehouse in a VMware environment with multiple datastores, networks, etc. and requirements to create the volumes on specific datastores. That's why we're using Cinder volumes (as opposed to just using images) together with the SPBM functionality of VMware.

Here's my template. Any help will be appreciated.

heat_template_version: 2013-05-23
description: Simple HOT to deploy single server

parameters:
  key_name:
    type: string
    label: Key Name
    description: Name of key-pair to be used for compute instance
  image_name:
   type: string
    label: Image ID
    description: Image to be used for compute instance
  instance_type:
    type: string
    label: Instance Type
    description: Type of instance (flavor) to be used
  host_name:
    type: string
    label: Host_name
   description: Hostname of the created VM
  network_id0:
    type: string
    label: Network ID
    description: Network to be used for compute instance
  network_id1:
    type: string
    label: Network ID
    description: Network to be used for compute instance
  vol_name0:
    type: string
    label: Volume Name
    description: Volume name
  vol_type0:
    type: string
    label: Volume Type
    description: Volume type
  vol_name1:
    type: string
    label: Volume Name
    description: Volume name
  vol_type1:
    type: string
    label: Volume Type
    description: Volume type
  cinder_availability_zone:
    type: string
    label: Cinder Availability Zone
    description: Cinder Availability Zone
  ip_0:
    type: string
    label: 0 IP
    description: IP of the created VM
  ip_1:
    type: string
    label: 1 IP
    description: IP of the created VM

resources:
  eth_port0:
    type: OS::Neutron::Port
    properties:
      name: {"Fn::Join": ["-", [{ get_param: "OS::stack_name" } , "port"]]}
      network_id: { get_param: network_id0 }
      fixed_ips:
      - ip_address: { get_param: ip_0 }
  eth_port1:
    type: OS::Neutron::Port
    properties:
      name: {"Fn::Join": ["-", [{ get_param: "OS::stack_name" } , "port"]]}
      network_id: { get_param: network_id1 }
      fixed_ips:
      - ip_address: { get_param: ip_1 }
  vol0:
    type: OS::Cinder::Volume
    properties:
      name: { get_param: vol_name0 }
      size: 40
      availability_zone: { get_param: cinder_availability_zone }
      volume_type: { get_param: vol_type0 }
      image: { get_param: image_name }
  vol1:
    type: OS::Cinder::Volume
    properties:
      name: { get_param: vol_name1 }
      size: 40
      availability_zone: { get_param: cinder_availability_zone }
      volume_type: { get_param: vol_type1 }
  newVM:
    type: OS::Nova::Server
    depends_on: [ vol0, vol1 ]
    properties:
      name: { get_param: host_name }
      block_device_mapping: [ { "volume_size":22 ,"volume_id": { get_resource: vol0 }, "delete_on_termination": true, "device_name": "vda" }, { "volume_size":2 ,"volume_id": { get_resource: vol1 }, "delete_on_termination": true, "device_name": "vdb" } ]
      flavor: { get_param: instance_type }
      key_name: { get_param: key_name }
      networks:
        - port: { get_resource: eth_port0 }
        - port: { get_resource: eth_port1 }
edit retag flag offensive close merge delete