From 77e67022d79f4c5cc18d3d8023de91f0e256bf07 Mon Sep 17 00:00:00 2001 From: Josep Puigdemont Date: Wed, 13 Jul 2016 18:39:51 +0200 Subject: fuel@opnfv: honor pod's interfaces/transforms Change-Id: I493279d81b32a58b918f2b6caa0cf869a0caa674 Signed-off-by: Josep Puigdemont --- ...nfig-honor-interfaces-and-transformations.patch | 85 ++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 patches/opnfv-fuel/0011-deploy-config-honor-interfaces-and-transformations.patch (limited to 'patches/opnfv-fuel/0011-deploy-config-honor-interfaces-and-transformations.patch') diff --git a/patches/opnfv-fuel/0011-deploy-config-honor-interfaces-and-transformations.patch b/patches/opnfv-fuel/0011-deploy-config-honor-interfaces-and-transformations.patch new file mode 100644 index 00000000..1567e85b --- /dev/null +++ b/patches/opnfv-fuel/0011-deploy-config-honor-interfaces-and-transformations.patch @@ -0,0 +1,85 @@ +From a7a2e8ff1c3389063b4d73805d0bbdbd7376f090 Mon Sep 17 00:00:00 2001 +From: Josep Puigdemont +Date: Wed, 13 Jul 2016 18:29:05 +0200 +Subject: [PATCH] deploy-config: honor interfaces and transformations + +Currently all scenarios assume interfaces and transformations are the +same for all nodes in the POD, however some PODs may contain nodes that +have different hardware, or where the interfaces are configured +differently. + +In this patch we honor the original interfaces and transformations if +they are present in the dea-override.yaml file. The way to add this +information in the dea-override is by having a "nodes:" section with +this information, ie: + +nodes: +- id: 1 + interfaces: interfaces_1 + transformations: transformations_1 +- id: 2 + interfaces: interfaces_2 + transformations: transformations_2 +- id: 3 + interfaces: interfaces_1 + transformations: transformations_1 + +The node IDs is used to find out this information. + +Change-Id: If6ff8ca28b42e043d1bdf91142a4a56ae36e4304 +Signed-off-by: Josep Puigdemont +--- + deploy/deploy-config.py | 23 +++++++++++++++++++++++ + 1 file changed, 23 insertions(+) + +diff --git a/deploy/deploy-config.py b/deploy/deploy-config.py +index 88a1111..5dfb863 100644 +--- a/deploy/deploy-config.py ++++ b/deploy/deploy-config.py +@@ -167,6 +167,7 @@ dea_base_sha = sha_uri(kwargs["dea_base_uri"]) + dea_base_comment = dea_base_conf['dea-base-config-metadata']['comment'] + dea_base_conf.pop('dea-base-config-metadata') + final_dea_conf = dea_base_conf ++dea_pod_override_nodes = None + + # Fetch dea-pod-override, extract and purge meta-data, merge with previous dea data structure + print 'Parsing the dea-pod-override from: ' + kwargs["dea_pod_override_uri"] + "...." +@@ -180,6 +181,9 @@ if dea_pod_override_conf: + dea_pod_comment = dea_pod_override_conf['dea-pod-override-config-metadata']['comment'] + print 'Merging dea-base and dea-pod-override configuration ....' + dea_pod_override_conf.pop('dea-pod-override-config-metadata') ++ # Copy the list of original nodes, which holds info on their transformations ++ if dea_pod_override_conf.has_key('nodes'): ++ dea_pod_override_nodes = list(dea_pod_override_conf['nodes']) + if dea_pod_override_conf: + final_dea_conf = dict(mergedicts(final_dea_conf, dea_pod_override_conf)) + +@@ -245,6 +249,25 @@ if deploy_scenario_conf["stack-extensions"]: + dea_scenario_module_override_conf['settings']['editable'][module["module"]] = scenario_module_override_conf + final_dea_conf = dict(mergedicts(final_dea_conf, dea_scenario_module_override_conf)) + ++def get_node_ifaces_and_trans(nodes, nid): ++ for node in nodes: ++ if node['id'] == nid: ++ if node.has_key('transformations') and node.has_key('interfaces'): ++ return (node['interfaces'], node['transformations']) ++ else: ++ return None ++ ++ return None ++ ++if dea_pod_override_nodes: ++ for node in final_dea_conf['nodes']: ++ data = get_node_ifaces_and_trans(dea_pod_override_nodes, node['id']) ++ if data: ++ print "Honoring original interfaces and transformations for " \ ++ "node %d to %s, %s" % (node['id'], data[0], data[1]) ++ node['interfaces'] = data[0] ++ node['transformations'] = data[1] ++ + # Dump final dea.yaml including configuration management meta-data to argument provided + # directory + if not os.path.exists(kwargs["output_path"]): +-- +2.7.4 + -- cgit 1.2.3-korg