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
This commit is contained in:
parent
d6de3cf4f0
commit
aaed97875c
|
@ -996,7 +996,7 @@ class Service(service.RPCService):
|
|||
)
|
||||
|
||||
# Fire off a XFR
|
||||
if 'masters' in changes:
|
||||
if zone.type == 'SECONDARY' and 'masters' in changes:
|
||||
self.worker_api.perform_zone_xfr(context, zone)
|
||||
|
||||
return zone
|
||||
|
|
|
@ -924,6 +924,44 @@ class CentralServiceTest(designate.tests.TestCase):
|
|||
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')
|
||||
self.assertFalse(zone.increment_serial)
|
||||
|
||||
# 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)
|
||||
self.assertFalse(zone.increment_serial)
|
||||
|
||||
# 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_do_not_allow_tenant_id_update(self):
|
||||
zone = self.create_zone(email='info@example.org')
|
||||
zone.tenant_id = '1'
|
||||
|
|
Loading…
Reference in New Issue