[Kimchi-devel] [PATCH] issue #438: Display nicer error message when starting network
Royce Lv
lvroyce at linux.vnet.ibm.com
Tue Dec 9 03:28:40 UTC 2014
Reviewed-by: Royce Lv<lvroyce at linux.vnet.ibm.com>
On 2014年12月08日 23:59, Crístian Viana wrote:
> If an error occurs when a network is being started (e.g. the host
> firewall is disabled), a generic message is displayed.
>
> Add a more specific error message for when a network fails to start. The
> root reason is also displayed along the message.
>
> Fix issue #438 ("Unexpected error when starting network interface with
> firewall disabled").
>
> Signed-off-by: Crístian Viana <vianac at linux.vnet.ibm.com>
> ---
> src/kimchi/i18n.py | 1 +
> src/kimchi/model/networks.py | 6 +++++-
> 2 files changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/src/kimchi/i18n.py b/src/kimchi/i18n.py
> index 45aa15e..e3a051c 100644
> --- a/src/kimchi/i18n.py
> +++ b/src/kimchi/i18n.py
> @@ -234,6 +234,7 @@ messages = {
> "KCHNET0019E": _("Bridge device %(name)s can not be the trunk device of a VLAN."),
> "KCHNET0020E": _("Failed to activate interface %(iface)s: %(err)s."),
> "KCHNET0021E": _("Failed to activate interface %(iface)s. Please check the physical link status."),
> + "KCHNET0022E": _("Failed to start network %(name)s. Details: %(err)s"),
>
> "KCHDR0001E": _("Debug report %(name)s does not exist"),
> "KCHDR0002E": _("Debug report tool not found in system"),
> diff --git a/src/kimchi/model/networks.py b/src/kimchi/model/networks.py
> index 6d21e9e..f3ea099 100644
> --- a/src/kimchi/model/networks.py
> +++ b/src/kimchi/model/networks.py
> @@ -305,7 +305,11 @@ class NetworkModel(object):
>
> def activate(self, name):
> network = self.get_network(self.conn.get(), name)
> - network.create()
> + try:
> + network.create()
> + except libvirt.libvirtError, e:
> + raise OperationFailed('KCHNET0022E', {'name': name,
> + 'err': e.message})
>
> def deactivate(self, name):
> if self._is_network_in_use(name):
More information about the Kimchi-devel
mailing list