On 01/09/2015 09:36, Ramon Medeiros wrote:
Changes:
v3:
Make i18n message more clear
v2:
Correct Issue number on title
Verify vlan name size before adding it. If name greater than 15
characters, display an error.
Signed-off-by: Ramon Medeiros <ramonn(a)linux.vnet.ibm.com>
---
src/kimchi/i18n.py | 1 +
src/kimchi/model/networks.py | 3 +++
2 files changed, 4 insertions(+)
diff --git a/src/kimchi/i18n.py b/src/kimchi/i18n.py
index 862df7f..9ea557c 100644
--- a/src/kimchi/i18n.py
+++ b/src/kimchi/i18n.py
@@ -257,6 +257,7 @@ messages = {
"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"),
+ "KCHNET0023E": _("VLAN interface name %(name)s exceeds kernel limit
of 15 characters"),
"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 275e12b..03737d1 100644
--- a/src/kimchi/model/networks.py
+++ b/src/kimchi/model/networks.py
@@ -216,6 +216,9 @@ class NetworksModel(object):
if br_name in bridges:
raise InvalidOperation("KCHNET0010E", {'iface':
br_name})
+ if len(br_name) > 15:
+ raise InvalidOperation("KCHNET0023E", {'name': br_name})
+
The brigde name is generated by Kimchi, so I think we can make a logic
to reduce it to be less than 15 characters instead of block the user
operation.
with RollbackContext() as rollback:
try:
vlan_tagged_br = conn.interfaceDefineXML(br_xml, 0)