Merge "Change exception messages to error log messages for DNS integration."

This commit is contained in:
Zuul 2024-04-10 23:53:01 +00:00 committed by Gerrit Code Review
commit 031aad583d
3 changed files with 52 additions and 33 deletions

View File

@ -213,15 +213,18 @@ class DNSDbMixin(object):
try: try:
self.dns_driver.delete_record_set(context, dns_domain, dns_name, self.dns_driver.delete_record_set(context, dns_domain, dns_name,
ips) ips)
except (dns_exc.DNSDomainNotFound, dns_exc.DuplicateRecordSet) as e: except dns_exc.DNSDomainNotFound:
LOG.exception("Error deleting Floating IP data from external " LOG.error("Error deleting Floating IP record %(name)s from "
"DNS service. Name: '%(name)s'. Domain: " "external DNS service. The DNS domain %(domain)s was "
"'%(domain)s'. IP addresses '%(ips)s'. DNS " "not found.",
"service driver message '%(message)s'", {"name": dns_name,
{"name": dns_name, "domain": dns_domain})
"domain": dns_domain, except dns_exc.DuplicateRecordSet:
"message": e.msg, LOG.error("Error deleting Floating IP record from external DNS "
"ips": ', '.join(ips)}) "service. Duplicate Floating IP records for %(name)s in "
"domain %(domain)s were found.",
{"name": dns_name,
"domain": dns_domain})
def _get_requested_state_for_external_dns_service_create(self, context, def _get_requested_state_for_external_dns_service_create(self, context,
floatingip_data, floatingip_data,
@ -245,11 +248,15 @@ class DNSDbMixin(object):
try: try:
self.dns_driver.create_record_set(context, dns_domain, dns_name, self.dns_driver.create_record_set(context, dns_domain, dns_name,
ips) ips)
except (dns_exc.DNSDomainNotFound, dns_exc.DuplicateRecordSet) as e: except dns_exc.DNSDomainNotFound:
LOG.exception("Error publishing floating IP data in external " LOG.error("The DNS domain %(domain)s was not found. Creation of "
"DNS service. Name: '%(name)s'. Domain: " "Floating IP record %(name)s from external DNS service "
"'%(domain)s'. DNS service driver message " "will be skipped.",
"'%(message)s'", {"name": dns_name,
{"name": dns_name, "domain": dns_domain})
"domain": dns_domain, except dns_exc.DuplicateRecordSet:
"message": e.msg}) LOG.error("A Floating IP record for %(name)s in domain %(domain)s "
"already exists. record creation in external DNS "
"service will be skipped.",
{"name": dns_name,
"domain": dns_domain})

View File

@ -487,28 +487,34 @@ def _send_data_to_external_dns_service(context, dns_driver, dns_domain,
dns_name, records): dns_name, records):
try: try:
dns_driver.create_record_set(context, dns_domain, dns_name, records) dns_driver.create_record_set(context, dns_domain, dns_name, records)
except (dns_exc.DNSDomainNotFound, dns_exc.DuplicateRecordSet) as e: except dns_exc.DNSDomainNotFound:
LOG.exception("Error publishing port data in external DNS " LOG.error("Error publishing port data. The DNS domain %(domain)s "
"service. Name: '%(name)s'. Domain: '%(domain)s'. " "was not found, creation of recordset %(name)s in "
"DNS service driver message '%(message)s'", "external DNS service will be skipped.",
{"name": dns_name, {"name": dns_name,
"domain": dns_domain, "domain": dns_domain})
"message": e.msg}) except dns_exc.DuplicateRecordSet:
LOG.error("Error publishing port data. A recordset for %(name)s in "
"domain %(domain)s already exists, recordset creation in "
"external DNS service will be skipped.",
{"name": dns_name,
"domain": dns_domain})
def _remove_data_from_external_dns_service(context, dns_driver, dns_domain, def _remove_data_from_external_dns_service(context, dns_driver, dns_domain,
dns_name, records): dns_name, records):
try: try:
dns_driver.delete_record_set(context, dns_domain, dns_name, records) dns_driver.delete_record_set(context, dns_domain, dns_name, records)
except (dns_exc.DNSDomainNotFound, dns_exc.DuplicateRecordSet) as e: except dns_exc.DNSDomainNotFound:
LOG.exception("Error deleting port data from external DNS " LOG.error("Error deleting port data from external DNS service. "
"service. Name: '%(name)s'. Domain: '%(domain)s'. " "The DNS domain %(domain)s was not found.",
"IP addresses '%(ips)s'. DNS service driver message " {"domain": dns_domain})
"'%(message)s'", except dns_exc.DuplicateRecordSet:
{"name": dns_name, LOG.error("Error deleting port data from external DNS service. "
"domain": dns_domain, "Duplicate recordsets for %(name)s in domain %(domain)s "
"message": e.msg, "were found.",
"ips": ', '.join(records)}) {"name": dns_name,
"domain": dns_domain})
def _update_port_in_external_dns_service(resource, event, trigger, payload): def _update_port_in_external_dns_service(resource, event, trigger, payload):

View File

@ -0,0 +1,6 @@
---
fixes:
- |
Cleaned non-harmful stack trace errors from DNS integration plugin. This
prevents the logs from filling with stack traces where error log messages
would have been sufficient.