[Kimchi-devel] [PATCH] Issue #365: Preventing duplicate Bridged VLAN tagged network.

Paulo Vital pvital at linux.vnet.ibm.com
Thu Apr 3 20:32:08 UTC 2014


While creating a Bridged VLAN tagged network using the same
configuration of a previous network (destination and VLAN ID) but
with different names, Kimchi allows the creation process.

This patch prevents the creation of the second Bridged VLAN tagged
network, checking if already has some network with the same bridge
configured.

https://github.com/kimchi-project/kimchi/issues/365

Signed-off-by: Paulo Vital <pvital at linux.vnet.ibm.com>
---
 src/kimchi/model/networks.py | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/kimchi/model/networks.py b/src/kimchi/model/networks.py
index 63f3136..8f77c12 100644
--- a/src/kimchi/model/networks.py
+++ b/src/kimchi/model/networks.py
@@ -185,6 +185,11 @@ class NetworksModel(object):
                                                           vlan_id)
         conn = self.conn.get()
 
+        if br_name in [net.bridgeName() for net in conn.listAllNetworks()]:
+            error_msg = 'The interface %s already exist' % br_name
+            raise InvalidOperation("KCHNET0010E", {'iface': br_name,
+                                                   'err': error_msg})
+
         with RollbackContext() as rollback:
 
             try:
-- 
1.8.3.1




More information about the Kimchi-devel mailing list