Merge "Use save_and_reraise_exception when reraise exception"
This commit is contained in:
commit
7d900bec0e
@ -67,8 +67,8 @@ class NOSdriver():
|
||||
username=username, password=password,
|
||||
unknown_host_cb=nos_unknown_host_cb)
|
||||
except Exception as e:
|
||||
LOG.error(_("Connect failed to switch: %s"), e)
|
||||
raise
|
||||
with excutils.save_and_reraise_exception():
|
||||
LOG.error(_("Connect failed to switch: %s"), e)
|
||||
|
||||
LOG.debug(_("Connect success to host %(host)s:%(ssh_port)d"),
|
||||
dict(host=host, ssh_port=SSH_PORT))
|
||||
|
@ -518,9 +518,9 @@ class MidonetPluginV2(db_base_plugin_v2.NeutronDbPluginV2,
|
||||
try:
|
||||
super(MidonetPluginV2, self).delete_network(context, id)
|
||||
except Exception:
|
||||
LOG.error(_('Failed to delete neutron db, while Midonet bridge=%r'
|
||||
'had been deleted'), id)
|
||||
raise
|
||||
with excutils.save_and_reraise_exception():
|
||||
LOG.error(_('Failed to delete neutron db, while Midonet '
|
||||
'bridge=%r had been deleted'), id)
|
||||
|
||||
def create_port(self, context, port):
|
||||
"""Create a L2 port in Neutron/MidoNet."""
|
||||
|
@ -70,8 +70,8 @@ class NOSdriver():
|
||||
username=username, password=password,
|
||||
unknown_host_cb=nos_unknown_host_cb)
|
||||
except Exception:
|
||||
LOG.exception(_("Connect failed to switch"))
|
||||
raise
|
||||
with excutils.save_and_reraise_exception():
|
||||
LOG.exception(_("Connect failed to switch"))
|
||||
|
||||
LOG.debug(_("Connect success to host %(host)s:%(ssh_port)d"),
|
||||
dict(host=host, ssh_port=SSH_PORT))
|
||||
|
@ -485,28 +485,28 @@ class Ml2Plugin(db_base_plugin_v2.NeutronDbPluginV2,
|
||||
LOG.debug(_("Committing transaction"))
|
||||
break
|
||||
except os_db.exception.DBError as e:
|
||||
if isinstance(e.inner_exception, sql_exc.IntegrityError):
|
||||
msg = _("A concurrent port creation has occurred")
|
||||
LOG.warning(msg)
|
||||
continue
|
||||
else:
|
||||
raise
|
||||
with excutils.save_and_reraise_exception() as ctxt:
|
||||
if isinstance(e.inner_exception, sql_exc.IntegrityError):
|
||||
ctxt.reraise = False
|
||||
msg = _("A concurrent port creation has occurred")
|
||||
LOG.warning(msg)
|
||||
continue
|
||||
|
||||
for port in ports:
|
||||
try:
|
||||
self.delete_port(context, port.id)
|
||||
except Exception:
|
||||
LOG.exception(_("Exception auto-deleting port %s"),
|
||||
port.id)
|
||||
raise
|
||||
with excutils.save_and_reraise_exception():
|
||||
LOG.exception(_("Exception auto-deleting port %s"),
|
||||
port.id)
|
||||
|
||||
for subnet in subnets:
|
||||
try:
|
||||
self.delete_subnet(context, subnet.id)
|
||||
except Exception:
|
||||
LOG.exception(_("Exception auto-deleting subnet %s"),
|
||||
subnet.id)
|
||||
raise
|
||||
with excutils.save_and_reraise_exception():
|
||||
LOG.exception(_("Exception auto-deleting subnet %s"),
|
||||
subnet.id)
|
||||
|
||||
try:
|
||||
self.mechanism_manager.delete_network_postcommit(mech_context)
|
||||
@ -595,9 +595,9 @@ class Ml2Plugin(db_base_plugin_v2.NeutronDbPluginV2,
|
||||
try:
|
||||
self.delete_port(context, a.port_id)
|
||||
except Exception:
|
||||
LOG.exception(_("Exception auto-deleting port %s"),
|
||||
a.port_id)
|
||||
raise
|
||||
with excutils.save_and_reraise_exception():
|
||||
LOG.exception(_("Exception auto-deleting port %s"),
|
||||
a.port_id)
|
||||
|
||||
try:
|
||||
self.mechanism_manager.delete_subnet_postcommit(mech_context)
|
||||
|
@ -20,6 +20,7 @@ import json
|
||||
import socket
|
||||
import time
|
||||
|
||||
from neutron.openstack.common import excutils
|
||||
from neutron.openstack.common import log as logging
|
||||
from neutron.plugins.nec.common import config
|
||||
from neutron.plugins.nec.common import exceptions as nexc
|
||||
@ -129,16 +130,17 @@ class OFCClient(object):
|
||||
try:
|
||||
return self.do_single_request(method, action, body)
|
||||
except nexc.OFCServiceUnavailable as e:
|
||||
try:
|
||||
wait_time = int(e.retry_after)
|
||||
except (ValueError, TypeError):
|
||||
wait_time = None
|
||||
if i > 1 and wait_time:
|
||||
LOG.info(_("Waiting for %s seconds due to "
|
||||
"OFC Service_Unavailable."), wait_time)
|
||||
time.sleep(wait_time)
|
||||
continue
|
||||
raise
|
||||
with excutils.save_and_reraise_exception() as ctxt:
|
||||
try:
|
||||
wait_time = int(e.retry_after)
|
||||
except (ValueError, TypeError):
|
||||
wait_time = None
|
||||
if i > 1 and wait_time:
|
||||
LOG.info(_("Waiting for %s seconds due to "
|
||||
"OFC Service_Unavailable."), wait_time)
|
||||
time.sleep(wait_time)
|
||||
ctxt.reraise = False
|
||||
continue
|
||||
|
||||
def get(self, action):
|
||||
return self.do_request("GET", action)
|
||||
|
@ -37,6 +37,7 @@ from neutron.db import quota_db # noqa
|
||||
from neutron.db import securitygroups_rpc_base as sg_db_rpc
|
||||
from neutron.extensions import allowedaddresspairs as addr_pair
|
||||
from neutron.extensions import portbindings
|
||||
from neutron.openstack.common import excutils
|
||||
from neutron.openstack.common import importutils
|
||||
from neutron.openstack.common import log as logging
|
||||
from neutron.openstack.common import rpc
|
||||
@ -384,11 +385,11 @@ class NECPluginV2(db_base_plugin_v2.NeutronDbPluginV2,
|
||||
try:
|
||||
self.ofc.delete_ofc_network(context, id, net_db)
|
||||
except (nexc.OFCException, nexc.OFCMappingNotFound) as exc:
|
||||
reason = _("delete_network() failed due to %s") % exc
|
||||
LOG.error(reason)
|
||||
self._update_resource_status(context, "network", net_db['id'],
|
||||
const.NET_STATUS_ERROR)
|
||||
raise
|
||||
with excutils.save_and_reraise_exception():
|
||||
reason = _("delete_network() failed due to %s") % exc
|
||||
LOG.error(reason)
|
||||
self._update_resource_status(context, "network", net_db['id'],
|
||||
const.NET_STATUS_ERROR)
|
||||
|
||||
super(NECPluginV2, self).delete_network(context, id)
|
||||
|
||||
|
@ -26,6 +26,7 @@ from neutron.db import l3_db
|
||||
from neutron.db import l3_gwmode_db
|
||||
from neutron.db import models_v2
|
||||
from neutron.extensions import l3
|
||||
from neutron.openstack.common import excutils
|
||||
from neutron.openstack.common import importutils
|
||||
from neutron.openstack.common import log as logging
|
||||
from neutron.plugins.nec.common import config
|
||||
@ -77,8 +78,9 @@ class RouterMixin(extraroute_db.ExtraRoute_db_mixin,
|
||||
try:
|
||||
return driver.create_router(context, tenant_id, new_router)
|
||||
except nexc.RouterOverLimit:
|
||||
super(RouterMixin, self).delete_router(context, new_router['id'])
|
||||
raise
|
||||
with excutils.save_and_reraise_exception():
|
||||
super(RouterMixin, self).delete_router(context,
|
||||
new_router['id'])
|
||||
|
||||
def update_router(self, context, router_id, router):
|
||||
LOG.debug(_("RouterMixin.update_router() called, "
|
||||
|
@ -36,6 +36,7 @@ from neutron.db import models_v2
|
||||
from neutron.db import portbindings_base
|
||||
from neutron.db import securitygroups_rpc_base as sg_db_rpc
|
||||
from neutron.extensions import portbindings
|
||||
from neutron.openstack.common import excutils
|
||||
from neutron.openstack.common import log as logging
|
||||
from neutron.openstack.common import rpc
|
||||
from neutron.openstack.common.rpc import proxy
|
||||
@ -180,8 +181,8 @@ class RyuNeutronPluginV2(db_base_plugin_v2.NeutronDbPluginV2,
|
||||
try:
|
||||
self._client_create_network(net['id'], tunnel_key)
|
||||
except Exception:
|
||||
self._client_delete_network(net['id'])
|
||||
raise
|
||||
with excutils.save_and_reraise_exception():
|
||||
self._client_delete_network(net['id'])
|
||||
|
||||
return net
|
||||
|
||||
|
@ -18,6 +18,7 @@ from sqlalchemy.orm import exc
|
||||
|
||||
import neutron.db.api as db
|
||||
from neutron.openstack.common.db import exception as db_exc
|
||||
from neutron.openstack.common import excutils
|
||||
from neutron.openstack.common import log as logging
|
||||
from neutron.plugins.vmware.dbexts import models
|
||||
from neutron.plugins.vmware.dbexts import networkgw_db
|
||||
@ -64,20 +65,21 @@ def add_neutron_nsx_port_mapping(session, neutron_id,
|
||||
session.add(mapping)
|
||||
session.commit()
|
||||
except db_exc.DBDuplicateEntry:
|
||||
session.rollback()
|
||||
# do not complain if the same exact mapping is being added, otherwise
|
||||
# re-raise because even though it is possible for the same neutron
|
||||
# port to map to different back-end ports over time, this should not
|
||||
# occur whilst a mapping already exists
|
||||
current = get_nsx_switch_and_port_id(session, neutron_id)
|
||||
if current[1] == nsx_port_id:
|
||||
LOG.debug(_("Port mapping for %s already available"), neutron_id)
|
||||
else:
|
||||
raise
|
||||
with excutils.save_and_reraise_exception() as ctxt:
|
||||
session.rollback()
|
||||
# do not complain if the same exact mapping is being added,
|
||||
# otherwise re-raise because even though it is possible for the
|
||||
# same neutron port to map to different back-end ports over time,
|
||||
# this should not occur whilst a mapping already exists
|
||||
current = get_nsx_switch_and_port_id(session, neutron_id)
|
||||
if current[1] == nsx_port_id:
|
||||
LOG.debug(_("Port mapping for %s already available"),
|
||||
neutron_id)
|
||||
ctxt.reraise = False
|
||||
except db_exc.DBError:
|
||||
# rollback for any other db error
|
||||
session.rollback()
|
||||
raise
|
||||
with excutils.save_and_reraise_exception():
|
||||
# rollback for any other db error
|
||||
session.rollback()
|
||||
return mapping
|
||||
|
||||
|
||||
|
@ -19,6 +19,7 @@ from oslo.config import cfg
|
||||
|
||||
from neutron.common import exceptions as n_exc
|
||||
from neutron.openstack.common.db import exception as db_exc
|
||||
from neutron.openstack.common import excutils
|
||||
from neutron.openstack.common import log as logging
|
||||
from neutron.plugins.vmware.api_client import exception as api_exc
|
||||
from neutron.plugins.vmware.common import exceptions as p_exc
|
||||
@ -354,13 +355,15 @@ class PersistentLsnManager(LsnManager):
|
||||
context, network_id, raise_on_err=raise_on_err)
|
||||
return obj.lsn_id if obj else None
|
||||
except p_exc.LsnNotFound:
|
||||
if self.sync_on_missing:
|
||||
lsn_id = super(PersistentLsnManager, self).lsn_get(
|
||||
context, network_id, raise_on_err=raise_on_err)
|
||||
self.lsn_save(context, network_id, lsn_id)
|
||||
return lsn_id
|
||||
if raise_on_err:
|
||||
raise
|
||||
with excutils.save_and_reraise_exception() as ctxt:
|
||||
ctxt.reraise = False
|
||||
if self.sync_on_missing:
|
||||
lsn_id = super(PersistentLsnManager, self).lsn_get(
|
||||
context, network_id, raise_on_err=raise_on_err)
|
||||
self.lsn_save(context, network_id, lsn_id)
|
||||
return lsn_id
|
||||
if raise_on_err:
|
||||
ctxt.reraise = True
|
||||
|
||||
def lsn_save(self, context, network_id, lsn_id):
|
||||
"""Save LSN-Network mapping to the DB."""
|
||||
@ -377,8 +380,8 @@ class PersistentLsnManager(LsnManager):
|
||||
try:
|
||||
self.lsn_save(context, network_id, lsn_id)
|
||||
except p_exc.NsxPluginException:
|
||||
super(PersistentLsnManager, self).lsn_delete(context, lsn_id)
|
||||
raise
|
||||
with excutils.save_and_reraise_exception():
|
||||
super(PersistentLsnManager, self).lsn_delete(context, lsn_id)
|
||||
return lsn_id
|
||||
|
||||
def lsn_delete(self, context, lsn_id):
|
||||
@ -391,18 +394,20 @@ class PersistentLsnManager(LsnManager):
|
||||
context, subnet_id, raise_on_err=raise_on_err)
|
||||
return (obj.lsn_id, obj.lsn_port_id) if obj else (None, None)
|
||||
except p_exc.LsnPortNotFound:
|
||||
if self.sync_on_missing:
|
||||
lsn_id, lsn_port_id = (
|
||||
super(PersistentLsnManager, self).lsn_port_get(
|
||||
context, network_id, subnet_id,
|
||||
raise_on_err=raise_on_err))
|
||||
mac_addr = lsn_api.lsn_port_info_get(
|
||||
self.cluster, lsn_id, lsn_port_id)['mac_address']
|
||||
self.lsn_port_save(
|
||||
context, lsn_port_id, subnet_id, mac_addr, lsn_id)
|
||||
return (lsn_id, lsn_port_id)
|
||||
if raise_on_err:
|
||||
raise
|
||||
with excutils.save_and_reraise_exception() as ctxt:
|
||||
ctxt.reraise = False
|
||||
if self.sync_on_missing:
|
||||
lsn_id, lsn_port_id = (
|
||||
super(PersistentLsnManager, self).lsn_port_get(
|
||||
context, network_id, subnet_id,
|
||||
raise_on_err=raise_on_err))
|
||||
mac_addr = lsn_api.lsn_port_info_get(
|
||||
self.cluster, lsn_id, lsn_port_id)['mac_address']
|
||||
self.lsn_port_save(
|
||||
context, lsn_port_id, subnet_id, mac_addr, lsn_id)
|
||||
return (lsn_id, lsn_port_id)
|
||||
if raise_on_err:
|
||||
ctxt.reraise = True
|
||||
|
||||
def lsn_port_get_by_mac(self, context, network_id, mac, raise_on_err=True):
|
||||
try:
|
||||
@ -410,18 +415,20 @@ class PersistentLsnManager(LsnManager):
|
||||
context, mac, raise_on_err=raise_on_err)
|
||||
return (obj.lsn_id, obj.lsn_port_id) if obj else (None, None)
|
||||
except p_exc.LsnPortNotFound:
|
||||
if self.sync_on_missing:
|
||||
lsn_id, lsn_port_id = (
|
||||
super(PersistentLsnManager, self).lsn_port_get_by_mac(
|
||||
context, network_id, mac,
|
||||
raise_on_err=raise_on_err))
|
||||
subnet_id = lsn_api.lsn_port_info_get(
|
||||
self.cluster, lsn_id, lsn_port_id).get('subnet_id')
|
||||
self.lsn_port_save(
|
||||
context, lsn_port_id, subnet_id, mac, lsn_id)
|
||||
return (lsn_id, lsn_port_id)
|
||||
if raise_on_err:
|
||||
raise
|
||||
with excutils.save_and_reraise_exception() as ctxt:
|
||||
ctxt.reraise = False
|
||||
if self.sync_on_missing:
|
||||
lsn_id, lsn_port_id = (
|
||||
super(PersistentLsnManager, self).lsn_port_get_by_mac(
|
||||
context, network_id, mac,
|
||||
raise_on_err=raise_on_err))
|
||||
subnet_id = lsn_api.lsn_port_info_get(
|
||||
self.cluster, lsn_id, lsn_port_id).get('subnet_id')
|
||||
self.lsn_port_save(
|
||||
context, lsn_port_id, subnet_id, mac, lsn_id)
|
||||
return (lsn_id, lsn_port_id)
|
||||
if raise_on_err:
|
||||
ctxt.reraise = True
|
||||
|
||||
def lsn_port_save(self, context, lsn_port_id, subnet_id, mac_addr, lsn_id):
|
||||
"""Save LSN Port information to the DB."""
|
||||
@ -440,9 +447,9 @@ class PersistentLsnManager(LsnManager):
|
||||
self.lsn_port_save(context, lsn_port_id, subnet_info['subnet_id'],
|
||||
subnet_info['mac_address'], lsn_id)
|
||||
except p_exc.NsxPluginException:
|
||||
super(PersistentLsnManager, self).lsn_port_delete(
|
||||
context, lsn_id, lsn_port_id)
|
||||
raise
|
||||
with excutils.save_and_reraise_exception():
|
||||
super(PersistentLsnManager, self).lsn_port_delete(
|
||||
context, lsn_id, lsn_port_id)
|
||||
return lsn_port_id
|
||||
|
||||
def lsn_port_delete(self, context, lsn_id, lsn_port_id):
|
||||
|
@ -23,6 +23,7 @@ from neutron.common import exceptions as n_exc
|
||||
from neutron.db import db_base_plugin_v2
|
||||
from neutron.db import l3_db
|
||||
from neutron.extensions import external_net
|
||||
from neutron.openstack.common import excutils
|
||||
from neutron.openstack.common import log as logging
|
||||
from neutron.plugins.vmware.common import exceptions as p_exc
|
||||
from neutron.plugins.vmware.dhcp_meta import constants as d_const
|
||||
@ -261,10 +262,10 @@ def handle_port_dhcp_access(plugin, context, port, action):
|
||||
try:
|
||||
handler(context, network_id, subnet_id, host_data)
|
||||
except p_exc.PortConfigurationError:
|
||||
if action == 'create_port':
|
||||
db_base_plugin_v2.NeutronDbPluginV2.delete_port(
|
||||
plugin, context, port['id'])
|
||||
raise
|
||||
with excutils.save_and_reraise_exception():
|
||||
if action == 'create_port':
|
||||
db_base_plugin_v2.NeutronDbPluginV2.delete_port(
|
||||
plugin, context, port['id'])
|
||||
LOG.info(_("DHCP for port %s configured successfully"), port['id'])
|
||||
|
||||
|
||||
@ -289,10 +290,10 @@ def handle_port_metadata_access(plugin, context, port, is_delete=False):
|
||||
try:
|
||||
handler(context, network_id, subnet_id, host_data)
|
||||
except p_exc.PortConfigurationError:
|
||||
if not is_delete:
|
||||
db_base_plugin_v2.NeutronDbPluginV2.delete_port(
|
||||
plugin, context, port['id'])
|
||||
raise
|
||||
with excutils.save_and_reraise_exception():
|
||||
if not is_delete:
|
||||
db_base_plugin_v2.NeutronDbPluginV2.delete_port(
|
||||
plugin, context, port['id'])
|
||||
LOG.info(_("Metadata for port %s configured successfully"), port['id'])
|
||||
|
||||
|
||||
@ -310,8 +311,8 @@ def handle_router_metadata_access(plugin, context, router_id, interface=None):
|
||||
plugin.lsn_manager.lsn_metadata_configure(
|
||||
context, subnet_id, is_enabled)
|
||||
except p_exc.NsxPluginException:
|
||||
if is_enabled:
|
||||
l3_db.L3_NAT_db_mixin.remove_router_interface(
|
||||
plugin, context, router_id, interface)
|
||||
raise
|
||||
with excutils.save_and_reraise_exception():
|
||||
if is_enabled:
|
||||
l3_db.L3_NAT_db_mixin.remove_router_interface(
|
||||
plugin, context, router_id, interface)
|
||||
LOG.info(_("Metadata for router %s handled successfully"), router_id)
|
||||
|
@ -17,6 +17,7 @@ import json
|
||||
|
||||
from neutron.common import constants
|
||||
from neutron.common import exceptions
|
||||
from neutron.openstack.common import excutils
|
||||
from neutron.openstack.common import log
|
||||
from neutron.plugins.vmware.common import utils
|
||||
from neutron.plugins.vmware.nsxlib import _build_uri_path
|
||||
@ -139,7 +140,7 @@ def delete_security_profile(cluster, spid):
|
||||
try:
|
||||
do_request(HTTP_DELETE, path, cluster=cluster)
|
||||
except exceptions.NotFound:
|
||||
# This is not necessarily an error condition
|
||||
LOG.warn(_("Unable to find security profile %s on NSX backend"),
|
||||
spid)
|
||||
raise
|
||||
with excutils.save_and_reraise_exception():
|
||||
# This is not necessarily an error condition
|
||||
LOG.warn(_("Unable to find security profile %s on NSX backend"),
|
||||
spid)
|
||||
|
@ -205,9 +205,9 @@ class NsxPluginV2(addr_pair_db.AllowedAddressPairsMixin,
|
||||
# Ensure this method is executed only once
|
||||
self._is_default_net_gw_in_sync = True
|
||||
except Exception:
|
||||
LOG.exception(_("Unable to process default l2 gw service:%s"),
|
||||
def_l2_gw_uuid)
|
||||
raise
|
||||
with excutils.save_and_reraise_exception():
|
||||
LOG.exception(_("Unable to process default l2 gw service:%s"),
|
||||
def_l2_gw_uuid)
|
||||
|
||||
def _build_ip_address_list(self, context, fixed_ips, subnet_ids=None):
|
||||
"""Build ip_addresses data structure for logical router port.
|
||||
@ -1804,10 +1804,10 @@ class NsxPluginV2(addr_pair_db.AllowedAddressPairsMixin,
|
||||
destination_ip_addresses=internal_ip)
|
||||
|
||||
except api_exc.NsxApiException:
|
||||
LOG.exception(_("An error occurred while removing NAT rules "
|
||||
"on the NSX platform for floating ip:%s"),
|
||||
floating_ip_address)
|
||||
raise
|
||||
with excutils.save_and_reraise_exception():
|
||||
LOG.exception(_("An error occurred while removing NAT rules "
|
||||
"on the NSX platform for floating ip:%s"),
|
||||
floating_ip_address)
|
||||
except nsx_exc.NatRuleMismatch:
|
||||
# Do not surface to the user
|
||||
LOG.warning(_("An incorrect number of matching NAT rules "
|
||||
@ -2286,13 +2286,13 @@ class NsxPluginV2(addr_pair_db.AllowedAddressPairsMixin,
|
||||
"resource was not found"),
|
||||
{'neutron_id': device_id, 'nsx_id': nsx_device_id})
|
||||
except api_exc.NsxApiException:
|
||||
LOG.exception(_("Removal of gateway device: %(neutron_id)s "
|
||||
"failed on NSX backend (NSX id:%(nsx_id)s). "
|
||||
"Neutron and NSX states have diverged."),
|
||||
{'neutron_id': device_id,
|
||||
'nsx_id': nsx_device_id})
|
||||
# In this case a 500 should be returned
|
||||
raise
|
||||
with excutils.save_and_reraise_exception():
|
||||
# In this case a 500 should be returned
|
||||
LOG.exception(_("Removal of gateway device: %(neutron_id)s "
|
||||
"failed on NSX backend (NSX id:%(nsx_id)s). "
|
||||
"Neutron and NSX states have diverged."),
|
||||
{'neutron_id': device_id,
|
||||
'nsx_id': nsx_device_id})
|
||||
|
||||
def create_security_group(self, context, security_group, default_sg=False):
|
||||
"""Create security group.
|
||||
|
@ -1563,15 +1563,15 @@ class NsxAdvancedPlugin(sr_db.ServiceRouter_mixin,
|
||||
self.vcns_driver.update_ipsec_config(
|
||||
edge_id, sites, enabled=vpn_service.admin_state_up)
|
||||
except exceptions.VcnsBadRequest:
|
||||
LOG.exception(_("Bad or unsupported Input request!"))
|
||||
raise
|
||||
with excutils.save_and_reraise_exception():
|
||||
LOG.exception(_("Bad or unsupported Input request!"))
|
||||
except exceptions.VcnsApiException:
|
||||
msg = (_("Failed to update ipsec VPN configuration "
|
||||
"with vpnservice: %(vpnservice_id)s on vShield Edge: "
|
||||
"%(edge_id)s") % {'vpnservice_id': vpnservice_id,
|
||||
'edge_id': edge_id})
|
||||
LOG.exception(msg)
|
||||
raise
|
||||
with excutils.save_and_reraise_exception():
|
||||
msg = (_("Failed to update ipsec VPN configuration "
|
||||
"with vpnservice: %(vpnservice_id)s on vShield Edge: "
|
||||
"%(edge_id)s") % {'vpnservice_id': vpnservice_id,
|
||||
'edge_id': edge_id})
|
||||
LOG.exception(msg)
|
||||
|
||||
def create_vpnservice(self, context, vpnservice):
|
||||
LOG.debug(_("create_vpnservice() called"))
|
||||
|
@ -12,6 +12,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from neutron.openstack.common import excutils
|
||||
from neutron.openstack.common import log as logging
|
||||
from neutron.plugins.vmware.vshield.common import (
|
||||
exceptions as vcns_exc)
|
||||
@ -131,9 +132,9 @@ class EdgeIPsecVpnDriver():
|
||||
try:
|
||||
self.vcns.update_ipsec_config(edge_id, ipsec_config)
|
||||
except vcns_exc.VcnsApiException:
|
||||
LOG.exception(_("Failed to update ipsec vpn configuration "
|
||||
"with edge_id: %s"), edge_id)
|
||||
raise
|
||||
with excutils.save_and_reraise_exception():
|
||||
LOG.exception(_("Failed to update ipsec vpn configuration "
|
||||
"with edge_id: %s"), edge_id)
|
||||
|
||||
def delete_ipsec_config(self, edge_id):
|
||||
try:
|
||||
@ -141,9 +142,9 @@ class EdgeIPsecVpnDriver():
|
||||
except vcns_exc.ResourceNotFound:
|
||||
LOG.warning(_("IPsec config not found on edge: %s"), edge_id)
|
||||
except vcns_exc.VcnsApiException:
|
||||
LOG.exception(_("Failed to delete ipsec vpn configuration "
|
||||
"with edge_id: %s"), edge_id)
|
||||
raise
|
||||
with excutils.save_and_reraise_exception():
|
||||
LOG.exception(_("Failed to delete ipsec vpn configuration "
|
||||
"with edge_id: %s"), edge_id)
|
||||
|
||||
def get_ipsec_config(self, edge_id):
|
||||
return self.vcns.get_ipsec_config(edge_id)
|
||||
|
Loading…
Reference in New Issue
Block a user