[Openstack] Allocate specific floating IP to an instance

Kiall Mac Innes kiall at managedit.ie
Tue Oct 30 11:47:56 UTC 2012


P.S. - That patch is against the current "stable/folsom" branch.. It won't
apply to Grizzly cleanly..

Thanks,
Kiall


On Tue, Oct 30, 2012 at 11:46 AM, Kiall Mac Innes <kiall at managedit.ie>wrote:

> Response inline.
>
> Thanks,
> Kiall
>
>
> On Tue, Oct 30, 2012 at 11:04 AM, Sébastien Han <han.sebastien at gmail.com>wrote:
>
>> Hi Kial,
>>
>> Hold on...
>> You obviously didn't understand my question. So please don't try to
>> teach me anything. I can admit that the initial description of my
>> request was a bit unclear. So I'm gonna try to clarify it.
>>
>
> I apologize, I certainly did not intend any insult.
>
>
>>
>> I use nova-network with the VLAN manager, so I have a network range
>> per projects (fixed ips), per VLAN. Each project uses a specific pool,
>> I use the floating IPs to expose instances to another private network
>> and I don't use the "auto_assign_floating_ip" parameter.
>>
>
> Great - Sounds like a pretty standard setup.
>
>
>>
>> Now, when I perform a "nova floating-ip-create <my-pool>" this gives
>> me the first floating IP available of that pool. What I want to
>> know/achieve is to decide the floating IP address to create. Basically
>> this could lead to a command like:
>>
>> # nova floating-ip-create <my-pool>
>> <floating-ip-that-I-want-create-from-a-pool>
>>
>
> Ah - I understand now.
>
> This is not supported by Nova Network (I can't say if it's supported with
> Quantum).
>
>
>>
>> But as you can see below, it's not available from the CLI:
>>
>> # nova help floating-ip-create
>> usage: nova floating-ip-create [<floating-ip-pool>]
>>
>> Allocate a floating IP for the current tenant.
>>
>> Positional arguments:
>>   <floating-ip-pool>  Name of Floating IP Pool. (Optional)
>>
>> Then I'll associate this floating IP to one of my instances.
>>
>> Let's try to raise the level of this discussion. Now if there is
>> something that I don't know, or something that I missed, feel free to
>> teach/correct me.
>
>
> Again - I apologize. No insult was intended.
>
>
>> I'm looking for a workaround, or code patch.
>> Something that doesn't require huge amount of work. Is that doable?
>>
>
> I believe it is doable without significant changes to the code.
>
> By patching the code to allow an extra parameter to pass through from the
> REST API call, all the way through to the DB's allocation method,
> the allocation method could be made to choose a particular IP by altering
> the SQL query executed.
>
> Some pointers to the relevant parts of the code:
>
> REST API:
>
> https://github.com/openstack/nova/blob/stable/folsom/nova/api/openstack/compute/contrib/floating_ips.py#L162-180
>
> Network Service API:
>
> https://github.com/openstack/nova/blob/stable/folsom/nova/network/api.py#L177-188
>
> Network Service Manager:
>
> https://github.com/openstack/nova/blob/stable/folsom/nova/network/manager.py#L406-443
>
> DB API:
> *
> https://github.com/openstack/nova/blob/stable/folsom/nova/db/api.py#L263-269
> *
>
> DB Implementation:
>
> https://github.com/openstack/nova/blob/stable/folsom/nova/db/sqlalchemy/api.py#L700-718
>
> I hope this helps!
>
> Actually - It looked like it could be done fairly quickly, you can try
> this (untested) patch: http://paste.ubuntu.com/1317723/plain/
>
> Once applied, you should be able to supply an "ip" param as part of the
> REST API call, and you will get that specific IP - if it is available. This
> doesn't update the CLI, I've never looked at it's code so wouldn't know
> where to start :)
>
> Thanks,
> Kiall
>
>
>> Anyone?
>>
>> On Tue, Oct 30, 2012 at 11:03 AM, Kiall Mac Innes <kiall at managedit.ie>
>> wrote:
>> > Hi Sebastian,
>> >
>> > The commands are nearly identical - just replace quantum with nova!
>> >
>> > Although, it sounds like you already have floating IPs being allocated
>> > randomly.
>> >
>> > That could be one of two things - either you have
>> > auto_assign_floatingip=True in your configuration, or you misunderstand
>> the
>> > difference between fixed and floating ips.
>> >
>> > When you boot an instance, does it get a private or public IP? And -
>> when
>> > you ran the network-create command, what IP range did you use?
>> >
>> > Kiall
>> >
>> > On Oct 30, 2012 9:26 AM, "Sébastien Han" <han.sebastien at gmail.com>
>> wrote:
>> >>
>> >> @Kiall, if it does, tell us more about it please.
>> >>
>> >>
>> >> On Tue, Oct 30, 2012 at 10:19 AM, Kiall Mac Innes <kiall at managedit.ie>
>> >> wrote:
>> >> > I'm fairly confident that quantum is not a requirement for this.
>> >> >
>> >> > Nova's in-built networking supports exactly this since as long ago
>> as I
>> >> > can
>> >> > remember.
>> >> >
>> >> > Thanks,
>> >> > Kiall
>> >> >
>> >> > On Oct 30, 2012 9:04 AM, "Emilien Macchi" <emilien at enovance.com>
>> wrote:
>> >> >>
>> >> >> Hello Sebastien,
>> >> >>
>> >> >>
>> >> >> What you can do today is to choose manually which floating IP you
>> need
>> >> >> to
>> >> >> associate with a specific instance.
>> >> >> You need to run OpenStack Folsom + Quantum.
>> >> >>
>> >> >> First, you need to create Floating IP pool(s) from Quantum CLI, and
>> >> >> after
>> >> >> that, the tenant is able to associate this IP to a private instance
>> :
>> >> >>
>> >> >> quantum floatingip-create ext_net
>> >> >>
>> >> >> quantum floatingip-associate $FLOATING_ID $PORT_ID
>> >> >>
>> >> >> More informations about Networking configuration with Quantum CLI
>> here
>> >> >> :
>> >> >>
>> >> >>
>> >> >>
>> http://docs.openstack.org/trunk/openstack-network/admin/content/demo_logical_network_config.html
>> >> >>
>> >> >>
>> >> >> Cheers ;-)
>> >> >>
>> >> >>
>> >> >> Emilien Macchi
>> >> >> ----------------------------------------------------
>> >> >> // eNovance Inc.              http://enovance.com
>> >> >> // ✉ emilien at enovance.com     ☎ +33 (0)1 49 70 99 80
>> >> >> // 10 rue de la Victoire 75009 Paris
>> >> >>
>> >> >> ________________________________
>> >> >> De: "Sébastien Han" <han.sebastien at gmail.com>
>> >> >> À: "Openstack" <openstack at lists.launchpad.net>
>> >> >> Envoyé: Lundi 29 Octobre 2012 17:25:47
>> >> >> Objet: [Openstack] Allocate specific floating IP to an instance
>> >> >>
>> >> >> Hi Stacker,
>> >> >>
>> >> >> I know OpenStack is not designed that way and I don't think it's
>> >> >> possible (or maybe I misses something :)) but I was wondering if
>> there
>> >> >> is any simple workaround to choose a specific floating IP to
>> allocate.
>> >> >> In other words, don't give me a random or N+1 next floating IP
>> >> >> available but let me decide which floating IP I want to assign to my
>> >> >> instance. It doesn't make sense in a public cloud but it does for a
>> >> >> corporate/private cloud. It would be nice to have :)
>> >> >>
>> >> >> Thanks in advance.
>> >> >>
>> >> >> Cheers!
>> >> >>
>> >> >> _______________________________________________
>> >> >> Mailing list: https://launchpad.net/~openstack
>> >> >> Post to     : openstack at lists.launchpad.net
>> >> >> Unsubscribe : https://launchpad.net/~openstack
>> >> >> More help   : https://help.launchpad.net/ListHelp
>> >> >>
>> >> >> _______________________________________________
>> >> >> Mailing list: https://launchpad.net/~openstack
>> >> >> Post to     : openstack at lists.launchpad.net
>> >> >> Unsubscribe : https://launchpad.net/~openstack
>> >> >> More help   : https://help.launchpad.net/ListHelp
>> >> >>
>> >> >
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack/attachments/20121030/0a28602e/attachment.html>


More information about the Openstack mailing list