Add nova cellv2 multicell support
This introduce needed changes to be able to deploy an additional cell via oooq. If additional_cell is set to true after the overcloud got deployed the additional cell gets deployed. Todo this information gets extracted from the overcloud stack, which is requried as input to the second heat stack, where the additional cell is managed with. As a reference [1] is the scenario which is installed adding a single additional cell. config/general_config/featureset063.yml is used for the configuration and config/nodes/1ctlr_1cellctrl_1comp.yml has a nova config example. [1] https://docs.openstack.org/project-deploy-guide/tripleo-docs/latest/features/deploy_cellv2_basic.html Depends-On: https://review.opendev.org/691688 Depends-On: https://review.opendev.org/704661 Change-Id: I2de781fcec64e862bde34929547b578d2af0c16c
This commit is contained in:
parent
219d1a3bce
commit
5b6d26c821
@ -0,0 +1,16 @@
|
||||
---
|
||||
features:
|
||||
- |
|
||||
This introduce needed changes to be able to deploy an additional
|
||||
cell via oooq. If additional_cell is set to true after the
|
||||
overcloud got deployed the additional cell gets deployed. Todo
|
||||
this information gets extracted from the overcloud stack, which
|
||||
is requried as input to the second heat stack, where the additional
|
||||
cell is managed with. As a reference [1] is the scenario which
|
||||
is installed adding a single additional cell.
|
||||
|
||||
config/general_config/featureset063.yml is used for the configuration
|
||||
and config/nodes/1ctlr_1cellctrl_1comp.yml has a nova config
|
||||
example.
|
||||
|
||||
[1] https://docs.openstack.org/project-deploy-guide/tripleo-docs/latest/features/deploy_cellv2_basic.html
|
@ -72,6 +72,7 @@ undercloud_networks:
|
||||
# Define all the flavors
|
||||
flavor_map:
|
||||
control: baremetal
|
||||
cellcontrol: baremetal
|
||||
compute: baremetal
|
||||
storage: baremetal
|
||||
ceph: baremetal
|
||||
|
@ -2,11 +2,15 @@
|
||||
|
||||
# Script and log locations used during the deploy process.
|
||||
deploy_script: overcloud-deploy.sh.j2
|
||||
deploy_cell_script: overcloud-deploy-cell.sh.j2
|
||||
deploy_log: "{{ working_dir }}/overcloud_deploy.log"
|
||||
deploy_cell_log: "{{ working_dir }}/cell_deploy.log"
|
||||
post_deploy_script: overcloud-deploy-post.sh.j2
|
||||
post_deploy_log: "{{ working_dir }}/overcloud_deploy_post.log"
|
||||
failed_deployments_log: "{{ working_dir }}/failed_deployments.log"
|
||||
failed_deployment_list: "{{ working_dir }}/failed_deployment_list.log"
|
||||
failed_cell_deployment_list: "{{ working_dir }}/failed_cell_deployment_list.log"
|
||||
failed_cell_deployments_log: "{{ working_dir }}/failed_cell_deployments.log"
|
||||
tripleo_config_download_log: "{{ working_dir }}/tripleo_config_download.log"
|
||||
ansible_steps_log: "{{ working_dir }}/ansible_steps.log"
|
||||
validate_script: overcloud-validate.sh.j2
|
||||
@ -59,6 +63,8 @@ overcloud_release: "{{ release }}"
|
||||
flavor_args: >-
|
||||
--control-flavor {{flavor_map.control
|
||||
if flavor_map is defined and 'control' in flavor_map else 'oooq_control'}}
|
||||
--cellcontrol-flavor {{flavor_map.cellcontrol
|
||||
if flavor_map is defined and 'cellcontrol' in flavor_map else 'oooq_cellcontrol'}}
|
||||
--compute-flavor {{flavor_map.compute
|
||||
if flavor_map is defined and 'compute' in flavor_map else 'oooq_compute'}}
|
||||
--ceph-storage-flavor {{flavor_map.ceph
|
||||
@ -144,6 +150,7 @@ composable_services: false
|
||||
deploy_multinode: false
|
||||
|
||||
step_deploy_overcloud: true
|
||||
step_deploy_cell: true
|
||||
|
||||
deploy_steps_ansible_workflow: false
|
||||
|
||||
|
20
roles/overcloud-deploy/tasks/deploy-cell.yml
Normal file
20
roles/overcloud-deploy/tasks/deploy-cell.yml
Normal file
@ -0,0 +1,20 @@
|
||||
---
|
||||
- name: Deploy the cell
|
||||
shell: >
|
||||
set -o pipefail &&
|
||||
{{ working_dir }}/overcloud-deploy-cell.sh 2>&1 {{ timestamper_cmd }} > {{ deploy_cell_log }}
|
||||
register: deploy_cell_script_result
|
||||
ignore_errors: true
|
||||
when: step_deploy_cell|bool
|
||||
|
||||
- name: Export actual used deploy args for persistence to other plays
|
||||
set_fact:
|
||||
# deploy_args end with a newline, remove to make deploy_args_used easier to use
|
||||
deploy_args_used: "{{ deploy_args | replace('\n', ' ') }}"
|
||||
cacheable: true
|
||||
|
||||
- name: Export actual used cell deploy args for persistence to other plays
|
||||
set_fact:
|
||||
# cell_deploy_args end with a newline, remove to make cell_deploy_args_used easier to use
|
||||
cell_deploy_args_used: "{{ cell_deploy_args | replace('\n', ' ') }}"
|
||||
cacheable: true
|
@ -24,3 +24,14 @@
|
||||
tags:
|
||||
- overcloud-post-deploy
|
||||
when: overcloud_deploy_result is defined and overcloud_deploy_result == "passed"
|
||||
|
||||
- block:
|
||||
- include: pre-cell-deploy.yml
|
||||
tags:
|
||||
- overcloud-scripts-cell
|
||||
- include: deploy-cell.yml
|
||||
tags:
|
||||
- overcloud-deploy-cell
|
||||
when:
|
||||
- additional_cell|bool
|
||||
- overcloud_deploy_result is defined and overcloud_deploy_result == "passed"
|
||||
|
63
roles/overcloud-deploy/tasks/pre-cell-deploy.yml
Normal file
63
roles/overcloud-deploy/tasks/pre-cell-deploy.yml
Normal file
@ -0,0 +1,63 @@
|
||||
---
|
||||
# Note.. the order of heat templates and args is very important. The last environment that sets a variable takes precedent.
|
||||
|
||||
|
||||
- name: Extract the number of cell controllers to be deployed (from cell topology_map)
|
||||
set_fact:
|
||||
number_of_cell_controllers: |-
|
||||
{% if cell_topology_map.CellController is defined -%}
|
||||
{{ cell_topology_map.CellController.scale }}
|
||||
{%- else -%}
|
||||
1
|
||||
{%- endif %}
|
||||
when:
|
||||
- cell_topology_map is defined
|
||||
|
||||
- name: Extract the cell controller flavor from cell topology_map
|
||||
set_fact:
|
||||
cell_controller_flavor: |-
|
||||
{% if cell_topology_map.CellController is defined and cell_topology_map.CellController.flavor is defined -%}
|
||||
{{ cell_topology_map.CellController.flavor }}
|
||||
{%- else -%}
|
||||
baremetal
|
||||
{%- endif %}
|
||||
when:
|
||||
- cell_topology_map is defined
|
||||
|
||||
- name: Extract the number of cell computes to be deployed (from cell topology_map)
|
||||
set_fact:
|
||||
number_of_cell_computes: |-
|
||||
{% if cell_topology_map.Compute is defined -%}
|
||||
{{ cell_topology_map.Compute.scale }}
|
||||
{%- else -%}
|
||||
0
|
||||
{%- endif %}
|
||||
when:
|
||||
- cell_topology_map is defined
|
||||
|
||||
- name: set cell_deploy args fact
|
||||
set_fact:
|
||||
cell_deploy_args: >-
|
||||
-r {{ working_dir }}/{{ cell_name }}/cell_roles_data.yaml
|
||||
-e {{ working_dir }}/{{ cell_name }}/cell-input.yaml
|
||||
-e {{ working_dir }}/{{ cell_name }}/cell.yaml
|
||||
--stack {{ cell_name }}
|
||||
|
||||
- name: Create cell data directory
|
||||
file:
|
||||
path: "{{ working_dir }}/{{ cell_name }}"
|
||||
state: directory
|
||||
mode: '0755'
|
||||
|
||||
- name: Create cell parameter file
|
||||
when: additional_cell|bool
|
||||
template:
|
||||
src: "cell.yaml.j2"
|
||||
dest: "{{ working_dir }}/{{ cell_name }}/cell.yaml"
|
||||
|
||||
- name: Create cell deploy script
|
||||
when: additional_cell|bool
|
||||
template:
|
||||
src: "{{ deploy_cell_script }}"
|
||||
dest: "{{ working_dir }}/overcloud-deploy-cell.sh"
|
||||
mode: 0755
|
30
roles/overcloud-deploy/templates/cell.yaml.j2
Normal file
30
roles/overcloud-deploy/templates/cell.yaml.j2
Normal file
@ -0,0 +1,30 @@
|
||||
resource_registry:
|
||||
# since the same networks are used in this example, the
|
||||
# creation of the different networks is omitted
|
||||
OS::TripleO::Network::External: OS::Heat::None
|
||||
OS::TripleO::Network::InternalApi: OS::Heat::None
|
||||
OS::TripleO::Network::Storage: OS::Heat::None
|
||||
OS::TripleO::Network::StorageMgmt: OS::Heat::None
|
||||
OS::TripleO::Network::Tenant: OS::Heat::None
|
||||
OS::TripleO::Network::Management: OS::Heat::None
|
||||
|
||||
parameter_defaults:
|
||||
# new CELL Parameter to reflect that this is an additional CELL
|
||||
NovaAdditionalCell: True
|
||||
|
||||
# The DNS names for the VIPs for the cell
|
||||
CloudName: {{cell_cloud_name|default('cell.localdomain')}}
|
||||
CloudNameInternal: {{cell_cloud_name_internal|default('cell.internalapi.localdomain')}}
|
||||
CloudNameStorage: {{cell_cloud_name_storage|default('cell.storage.localdomain')}}
|
||||
CloudNameStorageManagement: {{cell_cloud_name_storage_management|default('cell.storagemgmt.localdomain')}}
|
||||
CloudNameCtlplane: {{cell_cloud_name_ctlplane|default('cell.ctlplane.localdomain')}}
|
||||
|
||||
# Flavors used for the cell controller
|
||||
OvercloudCellControllerFlavor: {{ cell_controller_flavor|default('baremetal') }}
|
||||
|
||||
# number of controllers/computes in the cell
|
||||
CellControllerCount: {{ number_of_cell_controllers|default('1') }}
|
||||
ComputeCount: {{ number_of_cell_computes|default('0') }}
|
||||
{% if cell_public_vip is defined %}
|
||||
PublicVirtualFixedIPs: [{'ip_address':'{{ cell_public_vip }}'}]
|
||||
{% endif %}
|
97
roles/overcloud-deploy/templates/overcloud-deploy-cell.sh.j2
Normal file
97
roles/overcloud-deploy/templates/overcloud-deploy-cell.sh.j2
Normal file
@ -0,0 +1,97 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -ux
|
||||
|
||||
|
||||
### --start_docs
|
||||
## Deploying the cell
|
||||
## ==================
|
||||
|
||||
## Prepare Your Environment
|
||||
## ------------------------
|
||||
|
||||
## * Source in the undercloud credentials.
|
||||
## ::
|
||||
|
||||
source {{ working_dir }}/stackrc
|
||||
|
||||
### --start_docs
|
||||
|
||||
# Create directory for cell related parameter files
|
||||
mkdir -p {{ working_dir }}/{{ cell_name }}
|
||||
|
||||
# export overcloud information needed as input for cell stack
|
||||
openstack overcloud cell export {{ cell_name }} -o {{ working_dir }}/{{ cell_name }}/cell-input.yaml
|
||||
|
||||
# create cell roles file with Compute and CellController role
|
||||
openstack overcloud roles generate --roles-path \
|
||||
/usr/share/openstack-tripleo-heat-templates/roles \
|
||||
-o {{ working_dir }}/{{ cell_name }}/cell_roles_data.yaml Compute CellController
|
||||
|
||||
## * Deploy the cell
|
||||
## ::
|
||||
openstack overcloud deploy {% if release is not in ['newton', 'ocata', 'pike', 'queens'] %}--override-ansible-cfg {{ working_dir }}/custom_ansible.cfg{% endif %} \
|
||||
--templates {{overcloud_templates_path}} \
|
||||
{{ deploy_args | regex_replace("\n", " ") }} \
|
||||
{{ cell_deploy_args | regex_replace("\n", " ") }} \
|
||||
"$@" && status_code=0 || status_code=$?
|
||||
|
||||
### --stop_docs
|
||||
|
||||
if ! openstack stack list | grep -q {{ cell_name }}; then
|
||||
echo "cell deployment not started. Check the deploy configurations"
|
||||
exit 1
|
||||
|
||||
# We don't always get a useful error code from the openstack deploy command,
|
||||
# so check `openstack stack list` for a CREATE_COMPLETE or an UPDATE_COMPLETE
|
||||
# status.
|
||||
elif ! openstack stack list | grep {{ cell_name }} | grep -Eq '(CREATE|UPDATE)_COMPLETE'; then
|
||||
{%if release not in ['mitaka', 'liberty'] %}
|
||||
# get the failures list
|
||||
openstack stack failures list overcloud --long > {{ failed_cell_deployment_list }} || true
|
||||
{% endif %}
|
||||
|
||||
# get any puppet related errors
|
||||
for failed in $(openstack stack resource list \
|
||||
--nested-depth 5 {{ cell_name }} | grep FAILED |
|
||||
grep 'StructuredDeployment ' | cut -d '|' -f3)
|
||||
do
|
||||
echo "openstack software deployment show output for deployment: $failed" >> {{ failed_cell_deployments_log }}
|
||||
echo "######################################################" >> {{ failed_cell_deployments_log }}
|
||||
openstack software deployment show $failed >> {{ failed_cell_deployments_log }}
|
||||
echo "######################################################" >> {{ failed_cell_deployments_log }}
|
||||
echo "puppet standard error for deployment: $failed" >> {{ failed_cell_deployments_log }}
|
||||
echo "######################################################" >> {{ failed_cell_deployments_log }}
|
||||
# the sed part removes color codes from the text
|
||||
openstack software deployment show $failed -f json |
|
||||
jq -r .output_values.deploy_stderr |
|
||||
sed -r "s:\x1B\[[0-9;]*[mK]::g" >> {{ failed_cell_deployments_log }}
|
||||
echo "######################################################" >> {{ failed_cell_deployments_log }}
|
||||
# We need to exit with 1 because of the above || true
|
||||
done
|
||||
exit 1
|
||||
{%if release in ['rocky', 'master'] %}
|
||||
elif ! openstack overcloud status --stack {{ cell_name }}| grep -Eq 'DEPLOY_SUCCESS'; then
|
||||
# NOTE(emilien) "openstack overcloud failures" was introduced in Rocky
|
||||
openstack overcloud failures --stack {{ cell_name }}>> {{ failed_cell_deployment_list }} || true
|
||||
exit 1
|
||||
{% endif %}
|
||||
fi
|
||||
|
||||
# Create inventory files for overcloud and cell stack
|
||||
mkdir -p {{ working_dir }}/inventories
|
||||
|
||||
for i in $(openstack stack list -f value -c 'Stack Name'); do
|
||||
/usr/bin/tripleo-ansible-inventory \
|
||||
--static-yaml-inventory inventories/${i}.yaml \
|
||||
--stack ${i}
|
||||
done
|
||||
|
||||
ANSIBLE_HOST_KEY_CHECKING=False \
|
||||
ANSIBLE_SSH_RETRIES=3 \
|
||||
ansible-playbook -i inventories \
|
||||
/usr/share/ansible/tripleo-playbooks/create-nova-cell-v2.yaml \
|
||||
-e tripleo_cellv2_cell_name={{ cell_name }} \
|
||||
-e tripleo_cellv2_containercli={{ overcloud_container_cli }}
|
||||
|
||||
exit $status_code
|
Loading…
Reference in New Issue
Block a user