Make DHCP agent use 'revision_number'
Change I445974b0e0dabb762807c6f318b1b44f51b3fe15 updated the 'revision' field to 'revision_number' but it missed the DHCP agent and subsequently broke it's ability to detect stale updates. This fixes the name in the agent. This is marked as a partial for 1622616 because one of the reasons the agent was frequently updating the DHCP port was in reaction to stale port update messages for its own port. Partial-Bug: #1622616 Closes-Bug: #1625867 Change-Id: Id41000127e1084f7ff243f8dc9c399999fbdaab4
This commit is contained in:
parent
673abd56c9
commit
9019ff2f74
|
@ -561,8 +561,8 @@ class NetworkCache(object):
|
|||
self.deleted_ports = set()
|
||||
|
||||
def is_port_message_stale(self, payload):
|
||||
orig = self.get_port_by_id(payload['id'])
|
||||
if orig and orig.get('revision', 0) > payload.get('revision', 0):
|
||||
orig = self.get_port_by_id(payload['id']) or {}
|
||||
if orig.get('revision_number', 0) > payload.get('revision_number', 0):
|
||||
return True
|
||||
if payload['id'] in self.deleted_ports:
|
||||
return True
|
||||
|
|
|
@ -115,7 +115,7 @@ fake_port2 = dhcp.DictModel(dict(id='12345678-1234-aaaa-123456789000',
|
|||
device_owner='',
|
||||
mac_address='aa:bb:cc:dd:ee:99',
|
||||
network_id='12345678-1234-5678-1234567890ab',
|
||||
revision=77,
|
||||
revision_number=77,
|
||||
fixed_ips=[fake_fixed_ip2]))
|
||||
|
||||
fake_ipv6_port = dhcp.DictModel(dict(id='12345678-1234-aaaa-123456789000',
|
||||
|
@ -1174,7 +1174,7 @@ class TestNetworkCache(base.BaseTestCase):
|
|||
nc.put(fake_network)
|
||||
nc.put_port(fake_port2)
|
||||
stale = copy.copy(fake_port2)
|
||||
stale['revision'] = 2
|
||||
stale['revision_number'] = 2
|
||||
self.assertTrue(nc.is_port_message_stale(stale))
|
||||
|
||||
def test_put_network(self):
|
||||
|
|
Loading…
Reference in New Issue