Fix bug with designate-manage pool update losing existing record data
When designate-manage pool update is used we trigger an AFXR and
use that information to rebuild the zone. This is however only valid
for secondary zones, as the AXFR does not contain all the internal
information required for a primary zone and that causes designate to
lose important internal record data.
Closes-Bug: #2036750
Change-Id: I77a5d05cd8f55e975a16cb386221d53b63131886
(cherry picked from commit aaed97875c
)
This commit is contained in:
parent
bc2b54bc75
commit
f2624f73cf
@ -1143,7 +1143,7 @@ class Service(service.RPCService):
|
||||
context, zone, increment_serial=increment_serial)
|
||||
|
||||
# Fire off a XFR
|
||||
if 'masters' in changes:
|
||||
if zone.type == 'SECONDARY' and 'masters' in changes:
|
||||
self.mdns_api.perform_zone_xfr(context, zone)
|
||||
|
||||
self.zone_api.update_zone(context, zone)
|
||||
|
@ -890,6 +890,42 @@ class CentralServiceTest(CentralTestCase):
|
||||
self.assertIsInstance(notified_zone, objects.Zone)
|
||||
self.assertEqual(zone.id, notified_zone.id)
|
||||
|
||||
def test_update_zone_master_for_primary_zone(self):
|
||||
# Create a zone
|
||||
zone = self.create_zone(email='info@example.org')
|
||||
|
||||
# Update the masters
|
||||
zone.masters = objects.ZoneMasterList()
|
||||
|
||||
worker = mock.Mock()
|
||||
with mock.patch.object(worker_api.WorkerAPI,
|
||||
'get_instance') as get_worker:
|
||||
get_worker.return_value = worker
|
||||
self.central_service.update_zone(self.admin_context, zone)
|
||||
|
||||
# Make sure we don't try to trigger an axfr for a primary zone.
|
||||
self.assertFalse(worker.perform_zone_xfr.called)
|
||||
|
||||
def test_update_zone_master_for_secondary_zone(self):
|
||||
fixture = self.get_zone_fixture('SECONDARY', 0)
|
||||
fixture['email'] = cfg.CONF['service:central'].managed_resource_email
|
||||
fixture['masters'] = [{'host': '192.0.2.10', 'port': 53}]
|
||||
|
||||
# Create a zone
|
||||
zone = self.create_zone(**fixture)
|
||||
|
||||
# Update the masters
|
||||
zone.masters = objects.ZoneMasterList()
|
||||
|
||||
worker = mock.Mock()
|
||||
with mock.patch.object(worker_api.WorkerAPI,
|
||||
'get_instance') as get_worker:
|
||||
get_worker.return_value = worker
|
||||
self.central_service.update_zone(self.admin_context, zone)
|
||||
|
||||
# Make sure we trigger an axfr for a secondary zone.
|
||||
self.assertTrue(worker.perform_zone_xfr.called)
|
||||
|
||||
def test_update_zone_without_id(self):
|
||||
# Create a zone
|
||||
zone = self.create_zone(email='info@example.org')
|
||||
|
Loading…
Reference in New Issue
Block a user