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 <jslagle@redhat.com>
(cherry picked from commit 43c2810d65)
This commit is contained in:
James Slagle 2022-08-02 08:46:47 -04:00 committed by Bogdan Dobrelya
parent ccd5fd85c2
commit 1cc14bef83
2 changed files with 26 additions and 11 deletions

View File

@ -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(

View File

@ -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)