Hi All!
There is a limitation in neutron/db/l3_db.py code, that not allows associating floatingip on a subnet where the subnet gateway ip in the database is not set, but the router has a port and ip on that subnet. This limitation excludes usecases where the user do not want to set default gateway on the subnet where the floating ip is associated, but use special host routes instead.
A real life use case:
An instance got two networks, one customer facing provider vlan with public internet address, and one GRE based tenant network for operations and maintenance. The the external network providing floating ips is from the company's intranet (like 10.0.0.0/8). The default gateway obviously should be pointing towards the public interface and special host routes used for private address ranges, for example 10.0.0.0/8 used for the intranet communication. In this usecase the user need to assign floating ips on a network where the default gateway is not set to reach the instance from the company's network.
Code part causing the problem:
def _get_router_for_floatingip(self, context, internal_port,internal_subnet_id,external_network_id):
subnet = self._core_plugin.get_subnet(context, internal_subnet_id)
if not subnet['gateway_ip']:
msg = (_('Cannot add floating IP to port on subnet %s '
'which has no gateway_ip') % internal_subnet_id)
raise n_exc.BadRequest(resource='floatingip', msg=msg)
Simply commenting out the validation on subnet['gateway_ip'] allows the user to associate floating ip on networks where no default gateway is set, and use without any kind of problem. Of course the virtual router still has to have port on that subnet.
If a subnet don't provide a gateway ip, it can't plug to a virtual router. This subnet will not have L3 service, so forbiding floatingip to be associated with subnet without gateway ip, looks reasonable for me.