Ask Your Question
0

Is there any way to assign private static ip using heat?

asked 2016-08-22 01:52:04 -0600

anonymous user

Anonymous

updated 2016-08-22 05:29:33 -0600

I want to assign private static ip to the VM using heat. Currently dhcp allocates the ip but i want to give the ip address during launching a vm using heat.

what is going wrong here to assign fixed ip:

resources:
   my_port:
      type: OS::Neutron::Port
      properties:
          name: "port1"
          network_id: { get_param: internal_network }
          fixed_ips:
          - subnet_id: "<subnet_id>"
          - ip_address: 10.10.10.15          
          #fixed_ips: [{"subnet": "my_subnet", "ip_address": "10.10.10.15"}]

   my_vm:
      type: OS::Nova::Server
      properties:
          name: "testvm"
          image: { get_param: var_Image }
          flavor: "m1.tiny"
          networks:
          - port: { get_resource: my_port }

Error message: heatclient.exc.HTTPBadRequest: ERROR: Property error: : resources.my_port.properties.fixed_ips[1].ip_address: : "10.10.10.15" does not validate ip_addr (constraint not found)

edit retag flag offensive close merge delete

Comments

You have to create a neutron port , bind ip address to that port and attach the instance network to that port , I haven't checked possibility of this via heat

Mohit gravatar imageMohit ( 2016-08-22 05:59:00 -0600 )edit

you are telling about this

neutron port-create net1 --fixed-ip ip_address=10.10.10.15 <net-id>
nova boot --image <img> --flavor <flavor> --nic port-id=<port-id> <vm-name>

but i want to create this using heat template

IRSHAD gravatar imageIRSHAD ( 2016-08-22 06:03:48 -0600 )edit

3 answers

Sort by ยป oldest newest most voted
1

answered 2016-08-23 05:26:03 -0600

I have created on template for my own question and its working fine now.

resources:
   my_port:
      type: OS::Neutron::Port
      properties:
          name: "port1"
          network_id: "<net_id>"
          fixed_ips: [{"subnet": "<subnet_name>", "ip_address": 10.10.10.15}]

   my_vm:
      type: OS::Nova::Server
      properties:
          name: "testvm"
          image: { get_param: var_Image }
          flavor: "m1.tiny"
          networks:
          - port: { get_resource: my_port }

Now heat will create a new vm with defined ip i.e. 10.10.10.15

edit flag offensive delete link more

Comments

Hi, Does this require, admin rights or only heat_stack_owner role for the user is sufficient?

annagopa gravatar imageannagopa ( 2017-12-19 09:22:56 -0600 )edit
0

answered 2016-08-22 06:03:10 -0600

NarasimhaSV gravatar image

updated 2016-09-20 12:03:56 -0600

zaneb gravatar image
resources:
  instance_port:
    type: OS::Neutron::Port
    properties:
      network: private
      fixed_ips:
        - subnet_id: "private-subnet"

  instance1:
    type: OS::Nova::Server
    properties:
      flavor: m1.small
      image: ubuntu-trusty-x86_64
      networks:
        - port: { get_resource: instance_port }

  instance2:
    type: OS::Nova::Server
    properties:
      flavor: m1.small
      image: ubuntu-trusty-x86_64
      networks:
        - network: private
edit flag offensive delete link more

Comments

create a port first and then use that port-id for VM creation

NarasimhaSV gravatar imageNarasimhaSV ( 2016-08-22 06:04:03 -0600 )edit
0

answered 2016-08-22 02:43:37 -0600

Zimmer gravatar image

Hi, First of all you should create subnet in Neutron with your private static IP, than you should create your instance and in network tab you should choose your created subnet (IP), you can add more NW's in case if your instance should be connected with public network as well.

edit flag offensive delete link more

Comments

Thanks for reply but you are telling from horizon perspective. I need to create vm using heat with static ip as i have posted above template of the heat.

IRSHAD gravatar imageIRSHAD ( 2016-08-22 05:56:56 -0600 )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: 2016-08-22 01:52:04 -0600

Seen: 3,343 times

Last updated: Sep 20 '16