ip_wrapper = ip_lib.IPWrapper(self.root_helper,
namespace=ns_name)
ip_wrapper.netns.execute(arping_cmd, check_exit_code=True)
- except Exception as e:
- LOG.error(_LE("Failed sending gratuitous ARP: %s"), str(e))
+ except Exception:
+ LOG.exception(_LE("Failed sending gratuitous ARP."))
if distributed:
device.addr.delete(net.version, ip_cidr)
# under the License.
import os
+import six
from alembic import command as alembic_command
from alembic import config as alembic_config
try:
getattr(alembic_command, cmd)(config, *args, **kwargs)
except alembic_util.CommandError as e:
- alembic_util.err(str(e))
+ alembic_util.err(six.text_type(e))
def do_check_migration(config, cmd):
raise cfg.Error(_('Could not retrieve initial '
'certificate from controller %(server)s. '
'Error details: %(error)s') %
- {'server': server, 'error': str(e)})
+ {'server': server, 'error': e})
LOG.warning(_LW("Storing to certificate for host %(server)s "
"at %(path)s"), {'server': server,
tokens)) + '\n'
vm_cfg_data += line
return {'iosxe_config.txt': vm_cfg_data}
- except IOError as e:
- LOG.error(_LE('Failed to create config file: %s. Trying to'
- 'clean up.'), str(e))
+ 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.error(_LE("Failed to delete packet_filter id=%(id)s "
"from OFC: %(exc)s"),
- {'id': pf_id, 'exc': str(exc)})
+ {'id': pf_id, 'exc': exc})
self._update_resource_status_if_changed(
context, "packet_filter", packet_filter,
pf_db.PF_STATUS_ERROR)
# Sync all resources
self._sync(resources, fipquota)
- except Exception as e:
- LOG.error(_LE("Cannot complete the sync between Neutron and VSD "
- "because of error:%s"), str(e))
+ except Exception:
+ LOG.exception(_LE("Cannot complete the sync between Neutron and "
+ "VSD because of error."))
return
LOG.info(_LI("Sync between Neutron and VSD completed successfully"))
except Exception as e:
LOG.exception(_LE("Failed executing ip command"))
raise exc.IpCommandError(dev_name=self.dev_name,
- reason=str(e))
+ reason=e)
vf_lines = self._get_vf_link_show(vf_list, out)
vf_details_list = []
if vf_lines:
except Exception as e:
LOG.exception(_LE("Failed executing ip command"))
raise exc.IpCommandError(dev_name=self.dev_name,
- reason=str(e))
+ reason=e)
vf_lines = self._get_vf_link_show([vf_index], out)
if vf_lines:
vf_details = self._parse_vf_link_show(vf_lines[0])
except Exception as e:
LOG.exception(_LE("Failed executing ip command"))
raise exc.IpCommandError(dev_name=self.dev_name,
- reason=str(e))
+ reason=e)
def _get_vf_link_show(self, vf_list, link_show_out):
"""Get link show output for VFs
cluster=cluster).get('results', [])
except Exception as e:
msg = (_("Error '%(err)s' when connecting to controller(s): %(ctl)s.")
- % {'err': str(e),
+ % {'err': e,
'ctl': ', '.join(get_nsx_controllers(cluster))})
raise Exception(msg)
cluster=cluster)['connection']['connected']
except Exception as e:
msg = (_("Error '%(err)s' when connecting to controller(s): %(ctl)s.")
- % {'err': str(e),
+ % {'err': e,
'ctl': ', '.join(get_nsx_controllers(cluster))})
raise Exception(msg)
raise nsx_exc.NsxPluginException(err_msg=msg)
except api_exc.NsxApiException as e:
msg = _("An exception occurred while updating IP addresses on a "
- "router logical port:%s") % str(e)
+ "router logical port:%s") % e
LOG.exception(msg)
raise nsx_exc.NsxPluginException(err_msg=msg)
try:
return nsxlib.do_request(HTTP_PUT, uri, jsonutils.dumps(lswitch_obj),
cluster=cluster)
- except exception.NotFound as e:
- LOG.error(_LE("Network not found, Error: %s"), str(e))
+ except exception.NotFound:
+ LOG.exception(_LE("Network not found."))
raise exception.NetworkNotFound(net_id=lswitch_id)
path = "/ws.v1/lswitch/%s" % ls_id
try:
nsxlib.do_request(HTTP_DELETE, path, cluster=cluster)
- except exception.NotFound as e:
- LOG.error(_LE("Network not found, Error: %s"), str(e))
+ except exception.NotFound:
+ LOG.exception(_LE("Network not found."))
raise exception.NetworkNotFound(net_id=ls_id)
uri += "relations=%s" % relations
try:
return nsxlib.do_request(HTTP_GET, uri, cluster=cluster)
- except exception.NotFound as e:
- LOG.error(_LE("Port or Network not found, Error: %s"), str(e))
+ except exception.NotFound:
+ LOG.exception(_LE("Port or Network not found."))
raise exception.PortNotFoundOnNetwork(
port_id=port, net_id=network)
"on logical switch %(uuid)s",
{'result': result['uuid'], 'uuid': lswitch_uuid})
return result
- except exception.NotFound as e:
- LOG.error(_LE("Port or Network not found, Error: %s"), str(e))
+ except exception.NotFound:
+ LOG.exception(_LE("Port or Network not found."))
raise exception.PortNotFoundOnNetwork(
port_id=lport_uuid, net_id=lswitch_uuid)
r = nsxlib.do_request(HTTP_GET,
"/ws.v1/lswitch/%s/lport/%s/status" %
(lswitch_id, port_id), cluster=cluster)
- except exception.NotFound as e:
- LOG.error(_LE("Port not found, Error: %s"), str(e))
+ except exception.NotFound:
+ LOG.exception(_LE("Port not found."))
raise exception.PortNotFoundOnNetwork(
port_id=port_id, net_id=lswitch_id)
if r['link_status_up'] is True:
net_dict["id"] = str(net.uuid)
net_dict["name"] = net.name
nets.append(net_dict)
- except Exception as exc:
- LOG.error("Failed to get all networks: %s", str(exc))
+ except Exception:
+ LOG.exception("Failed to get all networks.")
return nets
def get_network(self, network_id):
net_dict["id"] = str(net.uuid)
net_dict["name"] = net.name
net.append(net_dict)
- except Exception as exc:
- LOG.error("Failed to get network: %s", str(exc))
+ except Exception:
+ LOG.exception("Failed to get network.")
return net
def create_network(self, tenant_id, net_name):
net_dict["id"] = str(res.uuid)
net_dict["name"] = res.name
return net_dict
- except Exception as exc:
- LOG.error("Failed to create network: %s", str(exc))
+ except Exception:
+ LOG.exception("Failed to create network.")
def delete_network(self, net_id):
"""Delete a network."""
net_dict = {}
net_dict["id"] = str(net.uuid)
return net_dict
- except Exception as exc:
- LOG.error("Failed to delete network: %s", str(exc))
+ except Exception:
+ LOG.exception("Failed to delete network.")
def update_network(self, tenant_id, net_id, param_data):
"""Rename a network."""
net_dict["id"] = str(net.uuid)
net_dict["name"] = net.name
return net_dict
- except Exception as exc:
- LOG.error("Failed to update network: %s", str(exc))
+ except Exception:
+ LOG.exception("Failed to update network.")
def get_all_ports(self, net_id):
"""Get all ports."""
port_dict["state"] = port.state
ports.append(port_dict)
return ports
- except Exception as exc:
- LOG.error("Failed to get all ports: %s", str(exc))
+ except Exception:
+ LOG.exception("Failed to get all ports.")
def get_port(self, net_id, port_id):
"""Get a port."""
port_dict["state"] = port.state
port_list.append(port_dict)
return port_list
- except Exception as exc:
- LOG.error("Failed to get port: %s", str(exc))
+ except Exception:
+ LOG.exception("Failed to get port.")
def create_port(self, net_id):
"""Add a port."""
port_dict["attachment"] = port.interface_id
port_dict["state"] = port.state
return port_dict
- except Exception as exc:
- LOG.error("Failed to create port: %s", str(exc))
+ except Exception:
+ LOG.exception("Failed to create port.")
def delete_port(self, net_id, port_id):
"""Delete a port."""
port_dict = {}
port_dict["id"] = str(port.uuid)
return port_dict
- except Exception as exc:
- LOG.error("Failed to delete port: %s", str(exc))
+ except Exception:
+ LOG.exception("Failed to delete port.")
def update_port(self, net_id, port_id, **kwargs):
"""Update a port."""
port_dict["attachment"] = port.interface_id
port_dict["state"] = port.state
return port_dict
- except Exception as exc:
- LOG.error("Failed to update port state: %s", str(exc))
+ except Exception:
+ LOG.exception("Failed to update port state.")
def plug_interface(self, net_id, port_id, int_id):
"""Plug interface to a port."""
port_dict["attachment"] = port.interface_id
port_dict["state"] = port.state
return port_dict
- except Exception as exc:
- LOG.error("Failed to plug interface: %s", str(exc))
+ except Exception:
+ LOG.exception("Failed to plug interface.")
def unplug_interface(self, net_id, port_id):
"""Unplug interface to a port."""
try:
db.port_unset_attachment(port_id, net_id)
LOG.debug("Detached interface from port %s", port_id)
- except Exception as exc:
- LOG.error("Failed to unplug interface: %s", str(exc))
+ except Exception:
+ LOG.exception("Failed to unplug interface.")