Pike support for Nova allocation ratio adjustment playbook

The Nova Allocation ratio adjustment playbook has been modified to
support both Newton, Ocata and Pike builds.  Note Newton and Ocata
requires changes to the Nova configuration on the Controllers as Pike
requires changes on the Computes due to placement API usage.

Change-Id: I30149b5cc1c47dd5fa02a68d1ccbb2cc5adfe31e
This commit is contained in:
akrzos 2018-01-16 13:58:19 -05:00 committed by Alex Krzos
parent ff13703dd5
commit c948d579b0
3 changed files with 63 additions and 28 deletions

View File

@ -2,25 +2,27 @@
#
# Playbook to adjust Nova allocation ratios
#
# Versions tested: Newton, Ocata
# Versions tested: Newton, Ocata, Pike
#
# Newton, Ocata apply changes to the Controllers as Pike applies changes to the Computes
#
# Examples:
# ansible-playbook -i hosts browbeat/adjustment-nova-allocation.yml -e "cpu_allocation_ratio=24"
# ansible-playbook -i hosts browbeat/adjustment-nova-allocation.yml -e "cpu_allocation_ratio=24 ram_allocation_ratio=10.0"
# ansible-playbook -i hosts browbeat/adjustment-nova-allocation.yml -e "cpu_allocation_ratio=24 ram_allocation_ratio=10.0 disk_allocation_ratio=10.0"
# ansible-playbook -i hosts browbeat/adjust-nova-allocation.yml -e "cpu_allocation_ratio=100.0"
# ansible-playbook -i hosts browbeat/adjust-nova-allocation.yml -e "cpu_allocation_ratio=100.0 ram_allocation_ratio=100.0"
# ansible-playbook -i hosts browbeat/adjust-nova-allocation.yml -e "cpu_allocation_ratio=100.0 ram_allocation_ratio=100.0 disk_allocation_ratio=100.0"
#
# In order for new settings to take affect, you need to restart the Nova services
# by adding variable restart_nova=true into the extra vars.
#
# ansible-playbook -i hosts browbeat/adjustment-nova-allocation.yml -e "cpu_allocation_ratio=24 ram_allocation_ratio=10.0 disk_allocation_ratio=10.0 restart_nova=true"
# ansible-playbook -i hosts browbeat/adjust-nova-allocation.yml -e "cpu_allocation_ratio=100.0 ram_allocation_ratio=100.0 disk_allocation_ratio=100.0 restart_nova=true"
#
# * Note not setting a variable does not change that configuration item then. Setting no variables
# and running the playbook sets all configuration items to defaults (cpu/ram/disk - 16/1/1)
#
# ansible-playbook -i hosts browbeat/adjustment-nova-allocation.yml
# ansible-playbook -i hosts browbeat/adjust-nova-allocation.yml
#
- hosts: controller
- hosts: controller,compute
remote_user: "{{ host_remote_user }}"
gather_facts: false
vars_files:
@ -49,6 +51,11 @@
nova_config_file: /etc/nova/nova.conf
when: "('Newton' in osp_version['content'] | b64decode or 'Ocata' in osp_version['content'] | b64decode)"
- name: (Pike) Set Config File based on OpenStack Version
set_fact:
nova_config_file: /var/lib/config-data/puppet-generated/nova_libvirt/etc/nova/nova.conf
when: "'Pike' in osp_version['content'] | b64decode"
- name: Set default cpu_allocation_ratio/ram_allocation_ratio/disk_allocation_ratio configuration for Nova
set_fact:
nova_configuration:
@ -93,3 +100,30 @@
roles:
- nova-config
post_tasks:
- name: (Newton, Ocata) Restart Nova Services
become: true
service:
name: "{{ item }}"
state: restarted
with_items:
- openstack-nova-scheduler
- openstack-nova-api
- openstack-nova-conductor
- openstack-nova-novncproxy
- openstack-nova-consoleauth
- httpd
when:
- "'Newton' in osp_version['content'] | b64decode or 'Ocata' in osp_version['content'] | b64decode"
- "'controller' in group_names"
- restart_nova
- name: (Pike) Restart Nova Compute Container
become: true
command: docker restart nova_compute
when:
- "'Pike' in osp_version['content'] | b64decode"
- "'compute' in group_names"
- restart_nova

View File

@ -114,3 +114,25 @@
roles:
- nova-config
post_tasks:
- name: (Newton, Ocata) Restart Nova Services
become: true
service:
name: "{{ item }}"
state: restarted
with_items:
- openstack-nova-scheduler
- openstack-nova-api
- openstack-nova-conductor
- openstack-nova-novncproxy
- openstack-nova-consoleauth
- httpd
when: "('Newton' in osp_version['content'] | b64decode or 'Ocata' in osp_version['content'] | b64decode) and (restart_nova)"
- name: (Pike) Restart Nova Scheduler Container
become: true
command: "docker restart {{item}}"
with_items:
- nova_scheduler
when: "('Pike' in osp_version['content'] | b64decode) and (restart_nova)"

View File

@ -16,24 +16,3 @@
backup: yes
with_items:
- "{{nova_configuration}}"
- name: (Newton, Ocata) Restart Nova Services
become: true
service:
name: "{{ item }}"
state: restarted
with_items:
- openstack-nova-scheduler
- openstack-nova-api
- openstack-nova-conductor
- openstack-nova-novncproxy
- openstack-nova-consoleauth
- httpd
when: "('Newton' in osp_version['content'] | b64decode or 'Ocata' in osp_version['content'] | b64decode) and (restart_nova)"
- name: (Pike) Restart Nova Scheduler Container
become: true
command: "docker restart {{item}}"
with_items:
- nova_scheduler
when: "('Pike' in osp_version['content'] | b64decode) and (restart_nova)"