Rebase: upstream DEA mechanism changes 45/18845/1
authorAlexandru Avadanii <Alexandru.Avadanii@enea.com>
Wed, 17 Aug 2016 14:21:20 +0000 (16:21 +0200)
committerAlexandru Avadanii <Alexandru.Avadanii@enea.com>
Wed, 17 Aug 2016 14:21:30 +0000 (16:21 +0200)
Change-Id: I6a8a96caa095b20d85db2d4d418dd9cb121b12e4
Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
patches/opnfv-fuel/0005-transplant-Generate-extra-interfaces-config-file.patch
patches/opnfv-fuel/0011-deploy-config-honor-interfaces-and-transformations.patch [deleted file]
patches/opnfv-fuel/0039-deploy-Allow-DEA-to-override-bootstrap-config.patch [deleted file]
patches/opnfv-fuel/0039-deploy-Fix-add-bootstrap-DEA-override-delay.patch [new file with mode: 0644]

index 1291769..76c2716 100644 (file)
@@ -92,8 +92,8 @@ index e57a4fb..9a65cf6 100644
  
  
 @@ -51,11 +85,14 @@ def main():
-     dea_file = parse_arguments()
      check_file_exists(ASTUTE_YAML)
+     check_file_exists(FUEL_BOOTSTRAP_CLI_YAML)
      dea = DeploymentEnvironmentAdapter(dea_file)
 +    log('Reading astute file %s' % ASTUTE_YAML)
      with io.open(ASTUTE_YAML) as stream:
@@ -103,6 +103,6 @@ index e57a4fb..9a65cf6 100644
      with io.open(ASTUTE_YAML, 'w') as stream:
          yaml.dump(astute, stream, default_flow_style=False)
 +    log('Transplant done')
- if __name__ == '__main__':
+     # Update bootstrap config yaml with info from DEA/astute.yaml
+     with io.open(FUEL_BOOTSTRAP_CLI_YAML) as stream:
+         fuel_bootstrap_cli = yaml.load(stream)
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
deleted file mode 100644 (file)
index 131843c..0000000
+++ /dev/null
@@ -1,82 +0,0 @@
-From a7a2e8ff1c3389063b4d73805d0bbdbd7376f090 Mon Sep 17 00:00:00 2001
-From: Josep Puigdemont <josep.puigdemont@enea.com>
-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 <josep.puigdemont@enea.com>
----
- 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,5 +167,6 @@ 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
-@@ -180,4 +181,7 @@ if dea_pod_override_conf:
-     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(merge_dicts(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(merge_dicts(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
-
diff --git a/patches/opnfv-fuel/0039-deploy-Allow-DEA-to-override-bootstrap-config.patch b/patches/opnfv-fuel/0039-deploy-Allow-DEA-to-override-bootstrap-config.patch
deleted file mode 100644 (file)
index 2d1013a..0000000
+++ /dev/null
@@ -1,99 +0,0 @@
-From: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
-Date: Tue, 26 Jul 2016 18:07:55 +0200
-Subject: [PATCH] deploy: Allow DEA to override bootstrap config
-
-This commit does not change the current behavior in OPNFV, the
-preconfigured fuel_bootstrap_cli.yaml from OPNFV ISO is still
-used to replace the default settings / fuel-menu bootstrap cfg.
-
-The only addition is the possibility to override the preconfigured
-fuel_bootstrap_cli.yaml info using DEA.
-
-JIRA: FUEL-155
-
-Change-Id: I4e66b789fdf0a5b1af512a3efc84fedb72ce3b05
-Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
----
- deploy/install_fuel_master.py      |  7 ++++---
- deploy/transplant_fuel_settings.py | 20 +++++++++++++++++++-
- 2 files changed, 23 insertions(+), 4 deletions(-)
-
-diff --git a/deploy/install_fuel_master.py b/deploy/install_fuel_master.py
-index 5adccef..adadcb5 100644
---- a/deploy/install_fuel_master.py
-+++ b/deploy/install_fuel_master.py
-@@ -84,14 +84,15 @@ class InstallFuelMaster(object):
-         log('Wait until Fuel menu is up')
-         fuel_menu_pid = self.wait_until_fuel_menu_up()
--        log('Inject our own astute.yaml settings')
--        self.inject_own_astute_yaml()
-+        log('Inject our own astute.yaml and fuel_bootstrap_cli.yaml settings')
-+        self.inject_own_astute_and_bootstrap_yaml()
-         log('Let the Fuel deployment continue')
-         log('Found FUEL menu as PID %s, now killing it' % fuel_menu_pid)
-         self.ssh_exec_cmd('kill %s' % fuel_menu_pid, False)
-         log('Wait until installation is complete')
-+        time.sleep(60)
-         self.wait_until_installation_completed()
-         log('Waiting for one minute for Fuel to stabilize')
-@@ -181,7 +182,7 @@ class InstallFuelMaster(object):
-             ret = self.ssh.exec_cmd(cmd, check=check)
-         return ret
--    def inject_own_astute_yaml(self):
-+    def inject_own_astute_and_bootstrap_yaml(self):
-         with self.ssh as s:
-             s.exec_cmd('rm -rf %s' % self.work_dir, False)
-             s.exec_cmd('mkdir %s' % self.work_dir)
-diff --git a/deploy/transplant_fuel_settings.py b/deploy/transplant_fuel_settings.py
-index 9a65cf6..8684d57 100644
---- a/deploy/transplant_fuel_settings.py
-+++ b/deploy/transplant_fuel_settings.py
-@@ -22,6 +22,7 @@ from common import (
- )
- ASTUTE_YAML = '/etc/fuel/astute.yaml'
-+FUEL_BOOTSTRAP_CLI_YAML = '/opt/opnfv/fuel_bootstrap_cli.yaml'
- def usage():
-@@ -81,9 +82,19 @@ def transplant(dea, astute):
-     return astute
-+def transplant_bootstrap(astute, fuel_bootstrap_cli):
-+    if 'BOOTSTRAP' in astute:
-+        for skey in astute['BOOTSTRAP'].iterkeys():
-+            # FIXME: astute.yaml repos point to public ones instead of
-+            # local mirrors, this filter should be removed when in sync
-+            if skey != 'repos':
-+                fuel_bootstrap_cli[skey] = astute['BOOTSTRAP'][skey]
-+    return fuel_bootstrap_cli
-+
- def main():
-     dea_file = parse_arguments()
-     check_file_exists(ASTUTE_YAML)
-+    check_file_exists(FUEL_BOOTSTRAP_CLI_YAML)
-     dea = DeploymentEnvironmentAdapter(dea_file)
-     log('Reading astute file %s' % ASTUTE_YAML)
-     with io.open(ASTUTE_YAML) as stream:
-@@ -92,7 +103,14 @@ def main():
-     transplant(dea, astute)
-     with io.open(ASTUTE_YAML, 'w') as stream:
-         yaml.dump(astute, stream, default_flow_style=False)
--    log('Transplant done')
-+    log('Transplant done for astute.yaml')
-+    # Update bootstrap config yaml with info from DEA/astute.yaml
-+    with io.open(FUEL_BOOTSTRAP_CLI_YAML) as stream:
-+        fuel_bootstrap_cli = yaml.load(stream)
-+    transplant_bootstrap(astute, fuel_bootstrap_cli)
-+    with io.open(FUEL_BOOTSTRAP_CLI_YAML, 'w') as stream:
-+        yaml.dump(fuel_bootstrap_cli, stream, default_flow_style=False)
-+    log('Transplant done for fuel_bootstrap_cli.yaml')
- if __name__ == '__main__':
diff --git a/patches/opnfv-fuel/0039-deploy-Fix-add-bootstrap-DEA-override-delay.patch b/patches/opnfv-fuel/0039-deploy-Fix-add-bootstrap-DEA-override-delay.patch
new file mode 100644 (file)
index 0000000..f001689
--- /dev/null
@@ -0,0 +1,25 @@
+From: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
+Date: Wed, 17 Aug 2016 16:18:26 +0200
+Subject: [PATCH] deploy: Fix/add bootstrap DEA override delay
+
+Previous change adding support for DEA to override bootstrap config
+did not account for slow execution on remote servers, so add a
+one minute sleep before checking for completition of fuel install.
+
+Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
+---
+ deploy/install_fuel_master.py | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/deploy/install_fuel_master.py b/deploy/install_fuel_master.py
+index 808d0b1..609a335 100644
+--- a/deploy/install_fuel_master.py
++++ b/deploy/install_fuel_master.py
+@@ -201,6 +201,7 @@ class InstallFuelMaster(object):
+         CMD = 'ps -ef | grep %s | grep -v grep' % BOOTSTRAP_ADMIN
+         install_completed = False
++        time.sleep(60)
+         with self.ssh:
+             for i in range(WAIT_LOOP):
+                 ret = self.ssh.exec_cmd(CMD)