[ffwd3] Create nework_environment during node_extraction
When extracting nodes from stack during Undercloud upgrade we should also extract network environment so we can use it during the subsequent Overcloud upgrade. Change-Id: Ic86c1cab0b5e79326c52098ebf1b3369a6cd3da2
This commit is contained in:
parent
d027aa968a
commit
61752801c0
@ -666,9 +666,17 @@ class ExtractProvisionedNode(command.Command):
|
||||
|
||||
data = []
|
||||
warnings = []
|
||||
network_environment = {'resource_registry': {},
|
||||
'parameter_defaults': {}}
|
||||
for role_name, entries in host_vars.items():
|
||||
role_count = len(entries)
|
||||
|
||||
net_parameter_defaults = {}
|
||||
net_resource_registry = {
|
||||
"OS::TripleO::{}::Net::SoftwareConfig".format(role_name):
|
||||
"OS::Heat::None"}
|
||||
network_environment['resource_registry'].update(
|
||||
net_resource_registry)
|
||||
# skip zero count roles
|
||||
if not role_count:
|
||||
continue
|
||||
@ -715,6 +723,9 @@ class ExtractProvisionedNode(command.Command):
|
||||
'Please edit the file and set the path to the correct '
|
||||
'network config template.'.format(role_name))
|
||||
else:
|
||||
net_parameter_defaults = {
|
||||
"{}NetworkConfigTemplate".format(role_name):
|
||||
"{}".format(net_conf['template'])}
|
||||
warnings.append(
|
||||
'WARNING: Network config for role {} was '
|
||||
'automatically converted from Heat template to '
|
||||
@ -775,7 +786,9 @@ class ExtractProvisionedNode(command.Command):
|
||||
role_net_ip_map[role_name][net['network']][idx])
|
||||
|
||||
instances.append(instance)
|
||||
|
||||
if net_parameter_defaults != {}:
|
||||
network_environment['parameter_defaults'].update(
|
||||
net_parameter_defaults)
|
||||
data.append(role)
|
||||
|
||||
# Write the file header
|
||||
@ -794,6 +807,15 @@ class ExtractProvisionedNode(command.Command):
|
||||
yaml.dump(data, file_data, RoleDataDumper, width=120,
|
||||
default_flow_style=False)
|
||||
|
||||
if len(network_environment['parameter_defaults']) > 0:
|
||||
net_env_file = os.path.join(self.working_dir,
|
||||
"{}-network-environment.yaml".format(
|
||||
parsed_args.stack))
|
||||
with open(net_env_file, 'w+') as nfp:
|
||||
nfp.write(yaml.dump(network_environment,
|
||||
width=120,
|
||||
default_flow_style=False))
|
||||
|
||||
if parsed_args.output:
|
||||
if (os.path.exists(parsed_args.output)
|
||||
and not parsed_args.yes and sys.stdin.isatty()):
|
||||
|
Loading…
Reference in New Issue
Block a user