[Kimchi-devel] [PATCH v3] Issue #694: VLAN ID accepting only one digit

Ramon Medeiros ramonn at linux.vnet.ibm.com
Tue Sep 1 12:36:02 UTC 2015


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 at 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})
+
         with RollbackContext() as rollback:
             try:
                 vlan_tagged_br = conn.interfaceDefineXML(br_xml, 0)
-- 
2.1.0




More information about the Kimchi-devel mailing list