On 01/13/2015 07:25 AM, Rodrigo Trujillo wrote:
On 01/13/2015 10:55 AM, Aline Manera wrote:
>
> On 09/01/2015 16:43, Rodrigo Trujillo wrote:
>> This patch changes the error message returned by backend, adding the
>> name of virtual machines that are prohibiting the network to be removed
>> or deactivated. In other words, the vms linked to that network.
>> MSG example:
>> "Unable to delete network NET1. There are some virtual machines
['VM1',
>> 'VM2', 'VM3'] and/or templates linked to this network
>
> Just a minor comment to make the error message more professional
>
> Instead of "Unable to delete network NET1. There are some virtual
> machines *['VM1', 'VM2', 'VM3'] *and/or templates linked to
this
> network "
> display "Unable to delete network NET1. There are some virtual
> machines *VM1, VM2, VM3* and/or templates linked to this network
ACK =]
While you're at it, I think you can take out "some."
>
>> Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo(a)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(a)ovirt.org
>
http://lists.ovirt.org/mailman/listinfo/kimchi-devel
_______________________________________________
Kimchi-devel mailing list
Kimchi-devel(a)ovirt.org
http://lists.ovirt.org/mailman/listinfo/kimchi-devel