Fix VirtualInterfacePlugException message info

In vif.py plug method, the HttpError exception reason
will be specified to make VirtualInterfacePlugException
raised more meaningful.

In SRIOV vif driver plug code, if no ethernet ports are
found on a physical network for an instance then instead
of vif details this change will furnish instance mac
address as more meaningful data to user.

Change-Id: Ia9072f45829018c51ba42e5cb032bff7d7eadd23
Closes-bug: #1661609
This commit is contained in:
Esha Seth 2017-02-03 09:26:47 -05:00
parent 0f65fa459e
commit 2fcd97e1b3
1 changed files with 6 additions and 4 deletions

View File

@ -149,7 +149,7 @@ def plug(adapter, host_uuid, instance, vif, slot_mgr, new_vif=True):
except pvm_ex.HttpError as he:
# Log the message constructed by HttpError
LOG.exception(he.args[0], instance=instance)
raise exception.VirtualInterfacePlugException()
raise exception.VirtualInterfacePlugException(reason=he.args[0])
# Other exceptions are (hopefully) custom VirtualInterfacePlugException
# generated lower in the call stack.
@ -647,9 +647,11 @@ class PvmVnicSriovVifDriver(PvmVifDriver):
if not pports:
raise exception.VirtualInterfacePlugException(
_("Unable to find SR-IOV physical ports for physical "
"network '%(physnet)s' (instance %(inst)s). VIF: %(vif)s") %
{'physnet': physnet, 'inst': self.instance.name, 'vif': vif})
_("Unable to find acceptable Ethernet ports on physical "
"network '%(physnet)s' for instance %(inst)s for SRIOV "
"based VIF with MAC address %(vif_mac)s.") %
{'physnet': physnet, 'inst': self.instance.name,
'vif_mac': vif['address']})
# MAC
mac_address = pvm_util.sanitize_mac_for_api(vif['address'])