张晨 wrote:
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?
Neutron will always pre-allocate a specific address for a port. DHCP
service does not work with ranges that it manages, but relies on Neutron to
provide specific mac-to-IP mappings for each port.
Specific IP addresses are allocated for ports by calling to IPAM driver:
https://git.openstack.org/cgit/openstack/neutron/tree/neutron/db/db_base_plugin_v2.py?id=70606fa29a754fba0c1106c6aa722879503fc0a9#n1197
Ihar
__
OpenStack Development Mailing List (not for usage questions)
Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev