Signed-off-by: Rodrigo Trujillo
<rodrigo.trujillo@linux.vnet.ibm.com>
---
src/kimchi/i18n.py | 4 ++--
src/kimchi/model/networks.py | 10 ++++++++--
2 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/src/kimchi/i18n.py b/src/kimchi/i18n.py
index e3a051c..30ec89a 100644
--- a/src/kimchi/i18n.py
+++ b/src/kimchi/i18n.py
@@ -229,8 +229,8 @@ messages = {
"KCHNET0014E": _("Network interface must be a string"),
"KCHNET0015E": _("Network VLAN ID must be an integer
between 1 and 4094"),
"KCHNET0016E": _("Specify name and type to create a
Network"),
- "KCHNET0017E": _("Unable to delete network %(name)s. There
are some virtual machines and/or templates linked to this
network."),
- "KCHNET0018E": _("Unable to deactivate network %(name)s.
There are some virtual machines and/or templates linked to this
network."),
+ "KCHNET0017E": _("Unable to delete network %(name)s. There
are some virtual machines %(vms)s and/or templates linked to
this network."),
+ "KCHNET0018E": _("Unable to deactivate network %(name)s.
There are some virtual machines %(vms)s and/or templates linked
to this network."),
"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."),
diff --git a/src/kimchi/model/networks.py
b/src/kimchi/model/networks.py
index 1e94fd2..04783c4 100644
--- a/src/kimchi/model/networks.py
+++ b/src/kimchi/model/networks.py
@@ -313,14 +313,20 @@ class NetworkModel(object):
def deactivate(self, name):
if self._is_network_in_use(name):
- raise InvalidOperation("KCHNET0018E", {'name':
name})
+ vms = self._get_vms_attach_to_a_network(name)
+ if not vms:
+ vms = ""
To do what I suggested below:
vms = []
+ raise
InvalidOperation("KCHNET0018E", {'name': name, 'vms': vms})
And then:
raise InvalidOperation("KCHNET0018E", {'name': name, 'vms': *",
".join(vms)*})
network = self.get_network(self.conn.get(), name)
network.destroy()
def delete(self, name):
if self._is_network_in_use(name):
- raise InvalidOperation("KCHNET0017E", {'name':
name})
+ vms = self._get_vms_attach_to_a_network(name)
+ if not vms:
+ vms = ""
+ raise InvalidOperation("KCHNET0017E", {'name':
name, 'vms': vms})
network = self.get_network(self.conn.get(), name)
if network.isActive():
_______________________________________________
Kimchi-devel mailing list
Kimchi-devel@ovirt.org
http://lists.ovirt.org/mailman/listinfo/kimchi-devel