From 1cc14bef836ee0fc1e805743598208404e8d01cf Mon Sep 17 00:00:00 2001 From: James Slagle Date: Tue, 2 Aug 2022 08:46:47 -0400 Subject: [PATCH] Add cell export to overcloud deploy Run the equivalent of cell export after the stack is deployed. The difference between overcloud export and cell export is that should_filter=True when running cell export. As either of these exports might be needed later to deploy other stacks, go ahead and make sure both are always run. Change-Id: Idceeb31609533b78034f0b25c4b0fbc6d47c19fb Signed-off-by: James Slagle (cherry picked from commit 43c2810d65babad54ef665c2fb8563f97ef62579) --- .../overcloud_deploy/test_overcloud_deploy.py | 2 +- tripleoclient/v1/overcloud_deploy.py | 35 +++++++++++++------ 2 files changed, 26 insertions(+), 11 deletions(-) diff --git a/tripleoclient/tests/v1/overcloud_deploy/test_overcloud_deploy.py b/tripleoclient/tests/v1/overcloud_deploy/test_overcloud_deploy.py index 206b4b506..201f3f09d 100644 --- a/tripleoclient/tests/v1/overcloud_deploy/test_overcloud_deploy.py +++ b/tripleoclient/tests/v1/overcloud_deploy/test_overcloud_deploy.py @@ -1375,7 +1375,7 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud): 0, 12345678, 0, 1585820526, 1585820526, - 0, 0, 0]): + 0, 0, 0, 0, 0]): self.cmd.take_action(parsed_args) self.assertIn([ mock.call( diff --git a/tripleoclient/v1/overcloud_deploy.py b/tripleoclient/v1/overcloud_deploy.py index c4fe7eea4..4ce4baa89 100644 --- a/tripleoclient/v1/overcloud_deploy.py +++ b/tripleoclient/v1/overcloud_deploy.py @@ -646,6 +646,18 @@ class DeployOvercloud(command.Command): return [output_path] + def _export_stack(self, parsed_args, should_filter, + config_download_dir, export_file): + # Create overcloud export + data = export.export_overcloud( + self.working_dir, + parsed_args.stack, True, should_filter, + config_download_dir) + # write the exported data + with open(export_file, 'w') as f: + yaml.safe_dump(data, f, default_flow_style=False) + os.chmod(export_file, 0o600) + def setup_ephemeral_heat(self, parsed_args): self.log.info("Using ephemeral heat for stack operation") self.heat_launcher = utils.get_heat_launcher( @@ -1357,16 +1369,19 @@ class DeployOvercloud(command.Command): try: if do_stack: # Create overcloud export - data = export.export_overcloud( - self.working_dir, - parsed_args.stack, True, False, - config_download_dir) - export_file = os.path.join( - self.working_dir, "%s-export.yaml" % parsed_args.stack) - # write the exported data - with open(export_file, 'w') as f: - yaml.safe_dump(data, f, default_flow_style=False) - os.chmod(export_file, 0o600) + self._export_stack( + parsed_args, False, + config_download_dir, + os.path.join( + self.working_dir, "%s-export.yaml" % + parsed_args.stack)) + # Create overcloud cell export + self._export_stack( + parsed_args, True, + config_download_dir, + os.path.join( + self.working_dir, "%s-cell-export.yaml" % + parsed_args.stack)) except Exception as e: self.log.error('Exception creating overcloud export.') self.log.error(e)