[openstack-dev] [nova][neutron][openstackclient] The way to assign floating IPs to VM

Matt Riedemann mriedemos at gmail.com
Mon Mar 5 14:07:35 UTC 2018


On 3/5/2018 6:26 AM, Andrey Kurilin wrote:
> A year ago, Nova team decided to deprecate the addFixedIP, 
> removeFixedIP, addFloatingIP, removeFloatingIP server action APIs and it 
> was done[1].
> 
> It looks like not all the consumers paid attention to this change so 
> after novaclient 10.0.0 release (which includes removal of these 
> interfaces[2]) got in u-c file [3] I found broken code in my repo :(
> 
> I tried to find an alternative way to associate a floating ip with an 
> instance and I faced several new issues:
> 
> - openstackclient
> 
> * command `openstack server add floating ip` calls `add_floating_ip` 
> method of novaclient's server object[4]. This method is missed in the 
> latest novaclient (see [2]).
>    It means that this command is broken now.
> 
> - neutronclient
> 
> * CLI is deprecated
> * the python binding accepts floating ip id (need to list all floating 
> IPs to find the id)  and port id to attach floating to (where should I 
> take port id?!).
> 
> 
> So here we have 2 global issues:
> - openstackclient has a broken command (or I missed something?)
> - there is no easy way to associate a floating ip with a vm using CLI or 
> via python.
> 
> [1] 
> https://github.com/openstack/python-novaclient/blob/master/releasenotes/notes/microversion-v2_44-d60c8834e436ad3d.yaml
> [2] 
> https://github.com/openstack/python-novaclient/blob/master/releasenotes/notes/remove-virt-interfaces-add-rm-fixed-floating-398c905d9c91cca8.yaml
> [3] 
> https://github.com/openstack/requirements/commit/c126685c2007c818e65c53cc9c32885fae16fd34
> [4] 
> https://github.com/openstack/python-openstackclient/blob/b10941ddf6f7f6894b7d87f25c173f227b111e4e/openstackclient/compute/v2/server.py#L266-L267

I mentioned the related issue back in January:

http://lists.openstack.org/pipermail/openstack-dev/2018-January/126741.html

Adding a floating IP to an instance is possible using OSC CLI, it's 
essentially something like:

a) get the server id (openstack server show/list)
b) get the port id using the server id (openstack port list --device-id 
$server_id)
c) assign the floating IP to the port (openstack floating ip set --port 
$port_id)

-- 

Thanks,

Matt



More information about the OpenStack-dev mailing list