Merge "Handle NO_DOMAIN status"
This commit is contained in:
commit
e84810500f
designate
@ -2357,6 +2357,15 @@ class Service(service.RPCService, service.Service):
|
||||
and (serial >= domain_or_record.serial or serial == 0):
|
||||
domain_or_record.status = 'ERROR'
|
||||
|
||||
elif status == 'NO_DOMAIN':
|
||||
if domain_or_record.action in ['CREATE', 'UPDATE']:
|
||||
domain_or_record.action = 'CREATE'
|
||||
domain_or_record.status = 'ERROR'
|
||||
elif domain_or_record.action == 'DELETE':
|
||||
domain_or_record.action = 'NONE'
|
||||
domain_or_record.status = 'DELETED'
|
||||
deleted = True
|
||||
|
||||
return domain_or_record, deleted
|
||||
|
||||
# Zone Transfers
|
||||
|
@ -519,6 +519,12 @@ class Service(service.RPCService, coordination.CoordinationMixin,
|
||||
self.central_api.update_status(
|
||||
context, domain.id, ERROR_STATUS, error_serial)
|
||||
|
||||
if status == NO_DOMAIN_STATUS and action != DELETE_ACTION:
|
||||
LOG.warn(_LW('Domain %(domain)s is not present in some '
|
||||
'targets') % {'domain': domain.name})
|
||||
self.central_api.update_status(
|
||||
context, domain.id, NO_DOMAIN_STATUS, 0)
|
||||
|
||||
if consensus_serial == domain.serial and self._is_consensus(
|
||||
context, domain, action, SUCCESS_STATUS,
|
||||
MAXIMUM_THRESHOLD):
|
||||
@ -658,8 +664,8 @@ class Service(service.RPCService, coordination.CoordinationMixin,
|
||||
pool_manager_status.status = 'ERROR'
|
||||
elif action == DELETE_ACTION:
|
||||
pool_manager_status.status = 'SUCCESS'
|
||||
# TODO(Ron): Handle this case properly.
|
||||
elif action == UPDATE_ACTION:
|
||||
pool_manager_status.action = 'CREATE'
|
||||
pool_manager_status.status = 'ERROR'
|
||||
else:
|
||||
pool_manager_status.status = status
|
||||
|
@ -1905,3 +1905,19 @@ class CentralZoneExportTests(CentralBasic):
|
||||
pcheck, ctx, target = \
|
||||
designate.central.service.policy.check.call_args[0]
|
||||
self.assertEqual('delete_zone_export', pcheck)
|
||||
self.assertEqual(pcheck, 'delete_zone_export')
|
||||
|
||||
|
||||
class CentralStatusTests(CentralBasic):
|
||||
|
||||
def test__update_domain_or_record_status_no_domain(self):
|
||||
domain = RwObject(
|
||||
action='UPDATE',
|
||||
status='SUCCESS',
|
||||
serial=0,
|
||||
)
|
||||
dom, deleted = self.service.\
|
||||
_update_domain_or_record_status(domain, 'NO_DOMAIN', 0)
|
||||
|
||||
self.assertEqual(dom.action, 'CREATE')
|
||||
self.assertEqual(dom.status, 'ERROR')
|
||||
|
Loading…
x
Reference in New Issue
Block a user