Comment 7 for bug 1759971

Revision history for this message
Dmitrii Shcherbakov (dmitriis) wrote :

After a gateway port gets created it is marked as unbound:

'binding:vif_type': u'unbound'

https://github.com/openstack/neutron/blob/fbe308bdc12191c187343b5ef103dea9af738380/neutron/db/l3_db.py#L1744-L1778
for port in self._each_port_having_fixed_ips(ports):

And the code path that populates address_scope information does so based on a relation to a particular subnet because there is a check for fixed ip assignment:

https://github.com/openstack/neutron/blob/fbe308bdc12191c187343b5ef103dea9af738380/neutron/db/l3_db.py#L1684
_each_port_having_fixed_ips

* this check is performed after a gateway port is created and persisted to the neutron DB;
* when port has a binding to a host, e.g. 'binding:host_id': u'pillan';
* when vif_type is unbound: 'binding:vif_type': u'unbound'

So, this code path

sync_routers
https://github.com/openstack/neutron/blob/fbe308bdc12191c187343b5ef103dea9af738380/neutron/api/rpc/handlers/l3_rpc.py#L126-L129

    def _ensure_host_set_on_ports(self, context, host, routers):
_ensure_host_set_on_ports
https://github.com/openstack/neutron/blob/fbe308bdc12191c187343b5ef103dea9af738380/neutron/api/rpc/handlers/l3_rpc.py#L131-L147
            if router.get('gw_port') and router.get('distributed'):
...
                self._ensure_host_set_on_port(context,

    def _ensure_host_set_on_port(self, context, host, port, router_id=None,
                                 ha_router_port=False):
https://github.com/openstack/neutron/blob/fbe308bdc12191c187343b5ef103dea9af738380/neutron/api/rpc/handlers/l3_rpc.py#L181-L187
                    self.plugin.update_port(
                        context,
                        port['id'],
                        {'port': {portbindings.HOST_ID: host}})

which calls update_port in ML2 plugin

neutron/plugins/ml2/plugin.py|1295| def update_port(self, context, id, port):

Should take care of binding.