How to assign fixed-ip to an instance while launch

asked 2011-09-23 20:55:22 -0500

gagupta gravatar image

AFAIU In Diablo a new feature got added so that I can specify the fixed IP address at the time I launch an instance. How do I use this feature? I see that in novaclient, there is a command "nova add-fixed-ip <server> <network_id>". Its this related?

I am using FlatDHCPManager

Here is the feature that I am referring to: https://blueprints.launchpad.net/nova/+spec/add-options-network-create-os-apis (https://blueprints.launchpad.net/nova...)

edit retag flag offensive close merge delete

4 answers

Sort by » oldest newest most voted
0

answered 2011-09-26 17:24:34 -0500

islamsh gravatar image

I haven't got a change to test the latest diablo. But could get it work diablo3. In nova.conf, you have to add:

--auto_assign_floating_ip=true

edit flag offensive delete link more
0

answered 2011-09-27 19:57:04 -0500

gagupta gravatar image

@Sharif: Thanks for your help, but I am looking to assign a fixed-ip when I launch an instance not floating-ip.

I got the answer in an email. Posting it here as the answer:

""" Let me explain you a bit about how to use the modified OS Create Server API:

Added new optional parameter "networks" to the Create Server API

"networks" : [ { "uuid": "31fff79e-6405-48e4-bf40-d3334579dc76", "fixed_ip": "10.0.1.3"}, { "uuid": "f6152e91-e7d6-4e9c-a435-e5d910e327bd", "fixed_ip": "10.0.2.3"} ]

uuid: The unique identifier of the network

fixed_ip: IP address to be assigned to the NIC. This IP address should belong to the CIDR range of the specified network. If you don’t specify fixed_ip, then it will assign free available IP address to the Nic from the specified network.

Note: networks parameter is an optional parameter, if you don’t specify networks parameter it will behave similar as you see in Cactus release (i.e. it will create number of nics equal to the number of the networks assigned to the project)

API URL :- POST http://<api address="">/v1.1/<project_id>/os-create-server-ext

XML Request Format: <server xmlns="http://docs.openstack.org/compute/api/v1.1" name="new-server-test" flavorref="1" imageref="46"> <metadata> <meta key="My Server Name">Apache1</meta> </metadata> <personality/> <networks> <network uuid="31fff79e-6405-48e4-bf40-d3334579dc76" fixed_ip="10.0.1.3"> <network uuid="f6152e91-e7d6-4e9c-a435-e5d910e327bd" fixed_ip="10.0.2.3"> </networks> </server>

JSON Request format { "server" : { "name": "new-server-test", "flavorRef": "1", "imageRef": "46", "metadata": { "My Server Name": "Apache1" }, "networks": [ { "uuid":"31fff79e-6405-48e4-bf40-d3334579dc76", "fixed_ip": "10.0.1.3" }, { "uuid": "f6152e91-e7d6-4e9c-a435-e5d910e327bd","fixed_ip": "10.0.2.3" } ] } }

You can find the uuid of the network when you use the network list command.

Thanks and Best Regards, Tushar Patil. """

edit flag offensive delete link more
0

answered 2011-09-27 20:52:41 -0500

vishvananda gravatar image

Assuming you are using the newest ubuntu packages, you may also want to enable the following flag: --force_dhcp_release

This will kill dhcp leases when terminating an instance so that you can immediately reuse the ip.

Vish

On Sep 27, 2011, at 1:01 PM, Gaurav Gupta wrote:

Question #172158 on OpenStack Compute (nova) changed: https://answers.launchpad.net/nova/+q...

Status: Answered => Solved

Gaurav Gupta confirmed that the question is solved: @Sharif: Thanks for your help, but I am looking to assign a fixed-ip when I launch an instance not floating-ip.

I got the answer in an email. Posting it here as the answer:

""" Let me explain you a bit about how to use the modified OS Create Server API:

Added new optional parameter "networks" to the Create Server API

"networks" : [ { "uuid": "31fff79e-6405-48e4-bf40-d3334579dc76", "fixed_ip": "10.0.1.3"}, { "uuid": "f6152e91-e7d6-4e9c-a435-e5d910e327bd", "fixed_ip": "10.0.2.3"} ]

uuid: The unique identifier of the network

fixed_ip: IP address to be assigned to the NIC. This IP address should belong to the CIDR range of the specified network. If you don’t specify fixed_ip, then it will assign free available IP address to the Nic from the specified network.

Note: networks parameter is an optional parameter, if you don’t specify networks parameter it will behave similar as you see in Cactus release (i.e. it will create number of nics equal to the number of the networks assigned to the project)

API URL :- POST http://<api address="">/v1.1/<project_id>/os-create-server- ext

XML Request Format: <server xmlns="http://docs.openstack.org/compute/api/v1.1" name="new-server-test" flavorref="1" imageref="46"> <metadata> <meta key="My Server Name">Apache1</meta> </metadata> <personality/> <networks> <network uuid="31fff79e-6405-48e4-bf40-d3334579dc76" fixed_ip="10.0.1.3"> <network uuid="f6152e91-e7d6-4e9c-a435-e5d910e327bd" fixed_ip="10.0.2.3"> </networks> </server>

JSON Request format { "server" : { "name": "new-server-test", "flavorRef": "1", "imageRef": "46", "metadata": { "My Server Name": "Apache1" }, "networks": [ { "uuid":"31fff79e-6405-48e4-bf40-d3334579dc76", "fixed_ip": "10.0.1.3" }, { "uuid": "f6152e91-e7d6-4e9c-a435-e5d910e327bd","fixed_ip": "10.0.2.3" } ] } }

You can find the uuid of the network when you use the network list command.

Thanks and Best Regards, Tushar Patil. """


You received this question notification because you are a member of Nova Core, which is an answer contact for OpenStack Compute (nova).

edit flag offensive delete link more
0

answered 2011-09-27 22:24:39 -0500

gagupta gravatar image

Thanks for the tip Vish.

edit flag offensive delete link more

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower

Stats

Asked: 2011-09-23 20:55:22 -0500

Seen: 106 times

Last updated: Sep 27 '11