Browse Source

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
Jiri Stransky 3 years ago
2 changed files with 7 additions and 33 deletions
  1. +5
  2. +2

+ 5
- 29
tripleoclient/ View File

@@ -378,40 +378,16 @@ def wait_for_provision_state(baremetal_client, node_uuid, provision_state,

def create_environment_file(path="~/overcloud-env.json",
control_scale=1, compute_scale=1,
ceph_storage_scale=0, block_storage_scale=0,
"""Create a heat environment file
def create_environment_file(path="~/overcloud-env.json"):
"""Create a blank heat environment file

Create the heat environment file with the scale parameters.

: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
Create a Heat environment file for supplying initial parameter
values when deploying overcloud

env_path = os.path.expanduser(path)
with open(env_path, 'w+') as f:
"parameter_defaults": {
"ControllerCount": control_scale,
"ComputeCount": compute_scale,
"CephStorageCount": ceph_storage_scale,
"BlockStorageCount": block_storage_scale,
"ObjectStorageCount": swift_storage_scale}
f.write(json.dumps({"parameter_defaults": {}}))

return env_path

+ 2
- 4
tripleoclient/v1/ View File

@@ -540,13 +540,11 @@ class DeployOvercloud(command.Command):
env_files, localenv = self._process_multiple_environments(
created_env_files, added_files, tht_root, user_tht_root,
cleanup=not parsed_args.no_cleanup)

# Command line has more precedence than env files
template_utils.deep_update(localenv, env)
template_utils.deep_update(env, localenv)

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,
stack_name, parameters,