Thu, Jun 25, 2015 at 03:25:37PM CEST, jprochaz(a)redhat.com wrote:
This patch fixes possibility to define interfaces with non-unique IDs
per machine.
Please don't put stuff like "fix issue #3214" into subject line.
Put that in patch description.
Thanks.
Signed-off-by: Jiri Prochazka <jprochaz(a)redhat.com>
---
lnst/Controller/RecipeParser.py | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/lnst/Controller/RecipeParser.py b/lnst/Controller/RecipeParser.py
index 73422f1..936a870 100644
--- a/lnst/Controller/RecipeParser.py
+++ b/lnst/Controller/RecipeParser.py
@@ -66,10 +66,18 @@ class RecipeParser(XmlParser):
machine["interfaces"] = XmlCollection(interfaces_tag)
lo_netns = []
+ unique_ids = []
for interface_tag in interfaces_tag:
interfaces = self._process_interface(interface_tag)
for interface in interfaces:
+ if interface['id'] in unique_ids:
+ msg = "Interface with ID \"%s\" has already been
"\
+ "defined for this machine." %
interface['id']
+ raise RecipeError(msg, interface_tag)
+ else:
+ unique_ids.append(interface['id'])
+
if interface['type'] != 'lo':
continue
elif interface['netns'] in lo_netns:
@@ -77,6 +85,7 @@ class RecipeParser(XmlParser):
raise RecipeError(msg, interface_tag)
else:
lo_netns.append(interface['netns'])
+
machine["interfaces"].extend(interfaces)
return machine
--
2.4.3
_______________________________________________
LNST-developers mailing list
LNST-developers(a)lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/lnst-developers