Merge "Fix error getting segment_id in linux DHCP driver"

This commit is contained in:
Jenkins 2017-05-05 03:36:17 +00:00 committed by Gerrit Code Review
commit 609aacadee
2 changed files with 7 additions and 7 deletions

View File

@ -869,6 +869,7 @@ class Dnsmasq(DhcpLocalProcess):
isolated_subnets = self.get_isolated_subnets(self.network)
for i, subnet in enumerate(self.network.subnets):
addr_mode = getattr(subnet, 'ipv6_address_mode', None)
segment_id = getattr(subnet, 'segment_id', None)
if (not subnet.enable_dhcp or
(subnet.ip_version == 6 and
addr_mode == constants.IPV6_SLAAC)):
@ -914,11 +915,12 @@ class Dnsmasq(DhcpLocalProcess):
)
if subnet.ip_version == 4:
host_routes.extend(["%s,0.0.0.0" % (s.cidr) for s in
self.network.subnets
if (s.ip_version == 4 and
s.cidr != subnet.cidr and
s.segment_id == subnet.segment_id)])
for s in self.network.subnets:
sub_segment_id = getattr(s, 'segment_id', None)
if (s.ip_version == 4 and
s.cidr != subnet.cidr and
sub_segment_id == segment_id):
host_routes.append("%s,0.0.0.0" % s.cidr)
if host_routes:
if gateway:

View File

@ -385,7 +385,6 @@ class FakeV4Subnet(Dictable):
self.enable_dhcp = True
self.host_routes = [FakeV4HostRoute()]
self.dns_nameservers = ['8.8.8.8']
self.segment_id = None
class FakeV4Subnet2(FakeV4Subnet):
@ -499,7 +498,6 @@ class FakeV4SubnetNoDHCP(object):
self.enable_dhcp = False
self.host_routes = []
self.dns_nameservers = []
self.segment_id = None
class FakeV6SubnetDHCPStateful(Dictable):