components/openstack/neutron/files/agent/solaris/dhcp.py
changeset 3524 ad6a9e0880b9
parent 1987 6fa18b7a0af6
child 3998 5bd484384122
equal deleted inserted replaced
3521:958ebf9deed1 3524:ad6a9e0880b9
    31 import netaddr
    31 import netaddr
    32 from oslo.config import cfg
    32 from oslo.config import cfg
    33 
    33 
    34 from neutron.agent.linux import utils
    34 from neutron.agent.linux import utils
    35 from neutron.agent.solaris import net_lib
    35 from neutron.agent.solaris import net_lib
       
    36 from neutron.common import constants
    36 from neutron.common import exceptions
    37 from neutron.common import exceptions
    37 from neutron.openstack.common import importutils
    38 from neutron.openstack.common import importutils
    38 from neutron.openstack.common import jsonutils
    39 from neutron.openstack.common import jsonutils
    39 from neutron.openstack.common import log as logging
    40 from neutron.openstack.common import log as logging
    40 from neutron.openstack.common import uuidutils
    41 from neutron.openstack.common import uuidutils
   571                 subnets[subnet.id] = subnet
   572                 subnets[subnet.id] = subnet
   572 
   573 
   573         dhcp_port = None
   574         dhcp_port = None
   574         for port in network.ports:
   575         for port in network.ports:
   575             port_device_id = getattr(port, 'device_id', None)
   576             port_device_id = getattr(port, 'device_id', None)
   576             if port_device_id == device_id:
   577             port_device_owner = getattr(port, 'device_owner', None)
       
   578 
       
   579             # if the agent is started on a different node, then the
       
   580             # device_ids will be different since they are based off
       
   581             # hostname.
       
   582             if (port_device_id == device_id or
       
   583                     (port_device_owner == constants.DEVICE_OWNER_DHCP and
       
   584                      port_device_id.startswith('dhcp'))):
   577                 port_fixed_ips = []
   585                 port_fixed_ips = []
   578                 for fixed_ip in port.fixed_ips:
   586                 for fixed_ip in port.fixed_ips:
   579                     port_fixed_ips.append({'subnet_id': fixed_ip.subnet_id,
   587                     port_fixed_ips.append({'subnet_id': fixed_ip.subnet_id,
   580                                            'ip_address': fixed_ip.ip_address})
   588                                            'ip_address': fixed_ip.ip_address})
   581                     if fixed_ip.subnet_id in dhcp_enabled_subnet_ids:
   589                     if fixed_ip.subnet_id in dhcp_enabled_subnet_ids: