[openstack-dev] in which function does neutronv2 assign IP address for instance?

张晨 zhangchen9211 at 126.com
Wed Jan 6 11:28:10 UTC 2016

hi everyone,

i have a question for the neutron code in liberty: how does neutron assign IP address for instance?

in nova.network, it seems that neutron sever gets a feasible ip from the DB pool, which looks like this:
nova.compute.manager.ComputeVirtAPI._allocate_network_async() -> nova.network.api.API.allocate_for_instance() -> nova.network.manager.NetworkManager.allocate_for_instance() -> nova.network..manager.NetworkManager_allocate_fixed_ips()

but in nova.network.neutronv2.0, It looks like this:
nova.compute.manager.ComputeVirtAPI._allocate_network_async() -> neutronv2.api.allocate_for_instance()
and it seems that  in neutronv2.api.allocate_for_instance(), it doesn't fetch IP address from DB if the para "fixed_ip" == none in allocate_for_instance, but directly calls "_create_port" for a REST API.

so my question is whether neutron server will surely assign a fixed IP from DB for instance? Or else, it allows the DHCP agent to take over the IP-MAC selection?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20160106/01e322b5/attachment.html>

More information about the OpenStack-dev mailing list