Merge "l3_db: Check dns-integration extension"

This commit is contained in:
Jenkins 2016-01-25 22:06:46 +00:00 committed by Gerrit Code Review
commit cc5876693e

View File

@ -1031,6 +1031,7 @@ class L3_NAT_dbonly_mixin(l3.RouterPluginBase):
msg = _("Network %s does not contain any IPv4 subnet") % f_net_id
raise n_exc.BadRequest(resource='floatingip', msg=msg)
dns_integration = utils.is_extension_supported(self, 'dns-integration')
with context.session.begin(subtransactions=True):
# This external port is never exposed to the tenant.
# it is used purely for internal system and admin use when
@ -1078,12 +1079,14 @@ class L3_NAT_dbonly_mixin(l3.RouterPluginBase):
context.session.add(floatingip_db)
floatingip_dict = self._make_floatingip_dict(
floatingip_db, process_extensions=False)
dns_actions_data = self._process_dns_floatingip_create_precommit(
if dns_integration:
dns_data = self._process_dns_floatingip_create_precommit(
context, floatingip_dict, fip)
if dns_integration:
self._process_dns_floatingip_create_postcommit(context,
floatingip_dict,
dns_actions_data)
dns_data)
return floatingip_dict
def create_floatingip(self, context, floatingip,
@ -1092,6 +1095,7 @@ class L3_NAT_dbonly_mixin(l3.RouterPluginBase):
def _update_floatingip(self, context, id, floatingip):
fip = floatingip['floatingip']
dns_integration = utils.is_extension_supported(self, 'dns-integration')
with context.session.begin(subtransactions=True):
floatingip_db = self._get_floatingip(context, id)
old_floatingip = self._make_floatingip_dict(floatingip_db)
@ -1102,11 +1106,13 @@ class L3_NAT_dbonly_mixin(l3.RouterPluginBase):
self._core_plugin.get_port(
context.elevated(), fip_port_id))
floatingip_dict = self._make_floatingip_dict(floatingip_db)
dns_actions_data = self._process_dns_floatingip_update_precommit(
if dns_integration:
dns_data = self._process_dns_floatingip_update_precommit(
context, floatingip_dict)
if dns_integration:
self._process_dns_floatingip_update_postcommit(context,
floatingip_dict,
dns_actions_data)
dns_data)
return old_floatingip, floatingip_dict
def _floatingips_to_router_ids(self, floatingips):
@ -1128,6 +1134,7 @@ class L3_NAT_dbonly_mixin(l3.RouterPluginBase):
def _delete_floatingip(self, context, id):
floatingip = self._get_floatingip(context, id)
floatingip_dict = self._make_floatingip_dict(floatingip)
if utils.is_extension_supported(self, 'dns-integration'):
self._process_dns_floatingip_delete(context, floatingip_dict)
# Foreign key cascade will take care of the removal of the
# floating IP record once the port is deleted. We can't start