Skip to content

Commit

Permalink
Add support for --limit option for overcloud deploy
Browse files Browse the repository at this point in the history
with --limit option passed to overcloud deploy command for scaleout,
deployment will only be limited to hosts that are mentioned(or being scaled out).
  • Loading branch information
rajeshP524 committed Dec 30, 2022
1 parent 33b4f86 commit be2fdc2
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 1 deletion.
35 changes: 34 additions & 1 deletion scaleout.yml
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,10 @@
include_tasks: tasks/set_boot_mode.yml
when: osp_release|int >= 17 or composable_roles

- name: set fact for defining list of hosts for which the deployment should be limited
set_fact:
deploy_limit_str: ""

- block:
- name: copy roles definition for new machine types
command: |
Expand Down Expand Up @@ -253,6 +257,12 @@
node_type: "{{ item }}"
loop: "{{ new_machine_types | default([]) }}"
when: osp_release|int < 17

- name: prepare deploy_limit_str
include_tasks: tasks/prepare_deploy_limit_str_for_scaleout.yaml
vars:
node_type: "{{ item }}"
loop: "{{ total_machine_count.keys()|list }}"
when: composable_roles == true

- block:
Expand All @@ -262,6 +272,13 @@
{{ overcloud_host_list }} | grep compute | wc -l
register: compute_count

- name: prepare deploy_limit_str
set_fact:
deploy_limit_str: "{{ deploy_limit_str + append_item }}"
vars:
append_item: "{{ (deploy_limit_str|length == 0) | ternary(item, (',' + item)) }}"
with_sequence: "start={{ compute_count.stdout|int }} end={{ compute_count.stdout|int + new_nodes|length - 1 }} format=compute-%1u"

- name: set fact for compute count
set_fact:
compute_count: "{{ compute_count.stdout|int + new_nodes|length }}"
Expand Down Expand Up @@ -300,10 +317,26 @@
tee -a /home/stack/overcloud_provision_nodes.log
when: osp_release|int >= 17

- block:
- name: format deploy_limit_str
set_fact:
deploy_limit_str: " --limit \"{{ deploy_limit_str }}\" \\"

- name: copy overcloud_deploy.sh
shell: |
cp /home/stack/overcloud_deploy.sh /home/stack/overcloud_deploy_with_limit.sh
- name: update overcloud deploy script
lineinfile:
regexp: ".*--limit.*"
line: "{{ deploy_limit_str }}"
insertafter: ".*openstack overcloud deploy.*"
path: /home/stack/overcloud_deploy_with_limit.sh

- name: overcloud deploy
shell: |
source /home/stack/stackrc
set -o pipefail
./overcloud_deploy.sh &> /home/stack/overcloud_install.log
./overcloud_deploy_with_limit.sh &> /home/stack/overcloud_install.log
args:
chdir: /home/stack/
1 change: 1 addition & 0 deletions tasks/baremetal_deployment_prepare_for_scaleout.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
- name: set fact for compute count
set_fact:
compute_count: "{{ compute_count.stdout|int + total_machine_count[node_type]|int }}"

- name: update counts in baremetal_deployment.yaml with added computes
replace:
path: /home/stack/virt/network/baremetal_deployment.yaml
Expand Down
12 changes: 12 additions & 0 deletions tasks/prepare_deploy_limit_str_for_scaleout.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
- name: get existing compute count
shell: |
source /home/stack/stackrc
{{ overcloud_host_list }} | grep compute | grep {{ node_type }} | wc -l
register: compute_count

- name: add hosts to deploy_limit_str of type {{ node_type }}
set_fact:
deploy_limit_str: "{{ deploy_limit_str + append_item }}"
vars:
append_item: "{{ (deploy_limit_str|length == 0) | ternary(item, (',' + item)) }}"
with_sequence: "start={{ compute_count.stdout|int }} end={{ compute_count.stdout|int + total_machine_count[node_type]|int - 1 }} format=compute{{ node_type }}-%1u"
1 change: 1 addition & 0 deletions tasks/update_network_environment_for_scaleout.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
lineinfile:
regexp: ".*OS::TripleO::Compute{{ node_type }}::Net::SoftwareConfig:.*"
line: " OS::TripleO::Compute{{ node_type }}::Net::SoftwareConfig: vlans//compute_{{ node_type }}.yaml"
path: /home/stack/virt/network/network-environment.yaml

0 comments on commit be2fdc2

Please sign in to comment.