I ran this trough pdb, when using segments ip_allocation is DEFERRED instead of IMMEDIATE. Grepping the code I found references in neutron/db/ipam_backend_mixin.py where comments says this happens on routed networks (segments) when host is not known.
No Segment:
-----------
-> self.ipam.allocate_ips_for_port_and_store(
(Pdb) n
> /usr/lib/python2.7/site-packages/neutron/db/db_base_plugin_v2.py(1262)create_port_db()
-> context, port, port_id)
(Pdb) n
> /usr/lib/python2.7/site-packages/neutron/db/db_base_plugin_v2.py(1263)create_port_db()
-> db_port['ip_allocation'] = ipa.IP_ALLOCATION_IMMEDIATE
I ran this trough pdb, when using segments ip_allocation is DEFERRED instead of IMMEDIATE. Grepping the code I found references in neutron/ db/ipam_ backend_ mixin.py where comments says this happens on routed networks (segments) when host is not known.
No Segment: allocate_ ips_for_ port_and_ store( python2. 7/site- packages/ neutron/ db/db_base_ plugin_ v2.py(1262) create_ port_db( ) python2. 7/site- packages/ neutron/ db/db_base_ plugin_ v2.py(1263) create_ port_db( ) 'ip_allocation' ] = ipa.IP_ ALLOCATION_ IMMEDIATE
-----------
-> self.ipam.
(Pdb) n
> /usr/lib/
-> context, port, port_id)
(Pdb) n
> /usr/lib/
-> db_port[
...
-> return db_port 4b8f-478b- 94fa-b4e99abcea 7f', u'ip_address': u'192.168.24.250'}] db.models_ v2.Port[ object at 76b2cd0] {project_ id=u'e6d293744b 534510ae2af1c9b e08666c' , id='e11a7193- bb17-471f- a393-d57c0c338b 6a', name=u' fixed-ip- test', network_ id=u'509106ce- 7e19-4985- aa57-2e71a830d5 20', mac_address= 'fa:16: 3e:dd:51: f5', admin_state_ up=True, status='DOWN', device_id='', device_owner='', ip_allocation= 'immediate' , standard_ attr_id= 12}>
(Pdb) print fixed_ips
[{u'subnet_id': u'64e6df15-
(Pdb) print db_port
<neutron.
With Segment: allocate_ ips_for_ port_and_ store( python2. 7/site- packages/ neutron/ db/db_base_ plugin_ v2.py(1262) create_ port_db( ) ..ferred' ,) python2. 7/site- packages/ neutron/ db/db_base_ plugin_ v2.py(1262) create_ port_db( ) python2. 7/site- packages/ neutron/ db/db_base_ plugin_ v2.py(1264) create_ port_db( ) python2. 7/site- packages/ neutron/ db/db_base_ plugin_ v2.py(1265) create_ port_db( ) 'ip_allocation' ] = ipa.IP_ ALLOCATION_ DEFERRED
-------------
-> self.ipam.
(Pdb) n
> /usr/lib/
-> context, port, port_id)
(Pdb) n
DeferIpam: DeferIpa.
> /usr/lib/
-> context, port, port_id)
(Pdb) n
> /usr/lib/
-> except ipam_exc.DeferIpam:
(Pdb) n
> /usr/lib/
-> db_port[
...
-> return db_port d226-4459- babc-8be614a1ee 61', u'ip_address': u'172.20.0.250'}] db.models_ v2.Port[ object at 635de90] {project_ id=u'6a3e466b1a 7245cf832e717ed c053938' , id='6ff51cca- 0877-4a4b- aad3-a097d4ac2c e4', name=u' fixed-ip- test', network_ id=u'f19d0817- 7394-4f5d- 840f-e440476f05 b2', mac_address= 'fa:16: 3e:00:cd: 13', admin_state_ up=True, status='DOWN', device_id='', device_owner='', ip_allocation= 'deferred' , standard_ attr_id= 29}>
(Pdb) print fixed_ips
[{u'subnet_id': u'86668c2f-
(Pdb) print db_port
<neutron.
https:/ /github. com/openstack/ neutron/ blob/master/ neutron/ db/db_base_ plugin_ v2.py#L1259: L1264
self.ipam. allocate_ ips_for_ port_and_ store(
context, port, port_id)
db_port[ 'ip_allocation' ] = ipa.IP_ ALLOCATION_ IMMEDIATE
db_port[ 'ip_allocation' ] = ipa.IP_ ALLOCATION_ DEFERRED
try:
except ipam_exc.DeferIpam:
https:/ /github. com/openstack/ neutron/ blob/master/ neutron/ db/ipam_ backend_ mixin.py# L695:L696
# No, must be a deferred IP port because there are matching
# subnets. Happens on routed networks when host isn't known.
https:/ /github. com/openstack/ neutron/ blob/master/ neutron/ db/ipam_ backend_ mixin.py# L740:L742
Updates the port's IPs based on any new fixed_ips passed in or if
deferred IP allocation is in effect because allocation requires host
binding information that wasn't provided until port update.