From 8399577c6edd2352047c36e5cc4a67d806b6a5ac Mon Sep 17 00:00:00 2001 From: AKamyshnikova Date: Fri, 19 Dec 2014 13:24:11 +0300 Subject: [PATCH] csr1kv_hd_driver: Improve exception handling When logging exceptions the exception handling should make use of save_and_reraise. Partial-bug: #1305032 Change-Id: I316417f3c9cbb28ea0cf2cd24a1f5b2b803b5a95 --- .../cisco/l3/hosting_device_drivers/csr1kv_hd_driver.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/neutron/plugins/cisco/l3/hosting_device_drivers/csr1kv_hd_driver.py b/neutron/plugins/cisco/l3/hosting_device_drivers/csr1kv_hd_driver.py index 189f5e277..5ec76b79f 100644 --- a/neutron/plugins/cisco/l3/hosting_device_drivers/csr1kv_hd_driver.py +++ b/neutron/plugins/cisco/l3/hosting_device_drivers/csr1kv_hd_driver.py @@ -15,6 +15,7 @@ import netaddr from oslo.config import cfg +from oslo.utils import excutils from neutron.i18n import _LE from neutron import manager @@ -64,10 +65,10 @@ class CSR1kvHostingDeviceDriver(hosting_device_drivers.HostingDeviceDriver): vm_cfg_data += line return {'iosxe_config.txt': vm_cfg_data} except IOError: - LOG.exception(_LE('Failed to create config file. Trying to ' - 'clean up.')) - self.delete_configdrive_files(context, mgmtport) - raise + with excutils.save_and_reraise_exception(): + LOG.exception(_LE('Failed to create config file. Trying to ' + 'clean up.')) + self.delete_configdrive_files(context, mgmtport) @property def _core_plugin(self): -- 2.45.2