Allow overriding CLI parameter defaults with env files
We've added the ability to override CLI defaults with environment files [1] but then it got reversed while fixing a related bug [2]. We need to put this ability back because otherwise we cannot customize e.g. NeutronDhcpAgentsPerNetwork, or deploy with external Ceph with custom FSID and key. As a related change we have to remove hardcoded role counts from overcloud-env.json, because they'd overwrite the counts passed via CLI. (Furthermore, having the hardcoded default counts there doesn't make too much sense now that we have custom roles, the counts should already be properly defaulted in role_data.yaml.) [1] Change ID I2722e118abde1cea6210148b16ac1ed3d9f235d8 [2] Change ID I80c663c23dfa27fa7b4ca2bf6b0101c132e5889b Closes-Bug: #1632683 Change-Id: Iaf0adda44c84fcc552e743e4712d1dcf01daa7e4
This commit is contained in:
parent
cf799762c5
commit
71ebf2a31e
|
@ -378,40 +378,16 @@ def wait_for_provision_state(baremetal_client, node_uuid, provision_state,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def create_environment_file(path="~/overcloud-env.json",
|
def create_environment_file(path="~/overcloud-env.json"):
|
||||||
control_scale=1, compute_scale=1,
|
"""Create a blank heat environment file
|
||||||
ceph_storage_scale=0, block_storage_scale=0,
|
|
||||||
swift_storage_scale=0):
|
|
||||||
"""Create a heat environment file
|
|
||||||
|
|
||||||
Create the heat environment file with the scale parameters.
|
Create a Heat environment file for supplying initial parameter
|
||||||
|
values when deploying overcloud
|
||||||
:param control_scale: Scale value for control roles.
|
|
||||||
:type control_scale: int
|
|
||||||
|
|
||||||
:param compute_scale: Scale value for compute roles.
|
|
||||||
:type compute_scale: int
|
|
||||||
|
|
||||||
:param ceph_storage_scale: Scale value for ceph storage roles.
|
|
||||||
:type ceph_storage_scale: int
|
|
||||||
|
|
||||||
:param block_storage_scale: Scale value for block storage roles.
|
|
||||||
:type block_storage_scale: int
|
|
||||||
|
|
||||||
:param swift_storage_scale: Scale value for swift storage roles.
|
|
||||||
:type swift_storage_scale: int
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
env_path = os.path.expanduser(path)
|
env_path = os.path.expanduser(path)
|
||||||
with open(env_path, 'w+') as f:
|
with open(env_path, 'w+') as f:
|
||||||
f.write(json.dumps({
|
f.write(json.dumps({"parameter_defaults": {}}))
|
||||||
"parameter_defaults": {
|
|
||||||
"ControllerCount": control_scale,
|
|
||||||
"ComputeCount": compute_scale,
|
|
||||||
"CephStorageCount": ceph_storage_scale,
|
|
||||||
"BlockStorageCount": block_storage_scale,
|
|
||||||
"ObjectStorageCount": swift_storage_scale}
|
|
||||||
}))
|
|
||||||
|
|
||||||
return env_path
|
return env_path
|
||||||
|
|
||||||
|
|
|
@ -540,13 +540,11 @@ class DeployOvercloud(command.Command):
|
||||||
env_files, localenv = self._process_multiple_environments(
|
env_files, localenv = self._process_multiple_environments(
|
||||||
created_env_files, added_files, tht_root, user_tht_root,
|
created_env_files, added_files, tht_root, user_tht_root,
|
||||||
cleanup=not parsed_args.no_cleanup)
|
cleanup=not parsed_args.no_cleanup)
|
||||||
|
template_utils.deep_update(env, localenv)
|
||||||
# Command line has more precedence than env files
|
|
||||||
template_utils.deep_update(localenv, env)
|
|
||||||
|
|
||||||
self._try_overcloud_deploy_with_compat_yaml(
|
self._try_overcloud_deploy_with_compat_yaml(
|
||||||
tht_root, stack, parsed_args.stack, parameters, env_files,
|
tht_root, stack, parsed_args.stack, parameters, env_files,
|
||||||
parsed_args.timeout, localenv)
|
parsed_args.timeout, env)
|
||||||
|
|
||||||
def _try_overcloud_deploy_with_compat_yaml(self, tht_root, stack,
|
def _try_overcloud_deploy_with_compat_yaml(self, tht_root, stack,
|
||||||
stack_name, parameters,
|
stack_name, parameters,
|
||||||
|
|
Loading…
Reference in New Issue