From c948d579b0b220da8ae452f0634a9eed43abad18 Mon Sep 17 00:00:00 2001 From: akrzos Date: Tue, 16 Jan 2018 13:58:19 -0500 Subject: [PATCH] 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 --- ...ocation.yml => adjust-nova-allocation.yml} | 48 ++++++++++++++++--- .../browbeat/adjustment-nova-scheduler.yml | 22 +++++++++ .../browbeat/roles/nova-config/tasks/main.yml | 21 -------- 3 files changed, 63 insertions(+), 28 deletions(-) rename ansible/browbeat/{adjustment-nova-allocation.yml => adjust-nova-allocation.yml} (62%) diff --git a/ansible/browbeat/adjustment-nova-allocation.yml b/ansible/browbeat/adjust-nova-allocation.yml similarity index 62% rename from ansible/browbeat/adjustment-nova-allocation.yml rename to ansible/browbeat/adjust-nova-allocation.yml index 4450daebd..86be347da 100644 --- a/ansible/browbeat/adjustment-nova-allocation.yml +++ b/ansible/browbeat/adjust-nova-allocation.yml @@ -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 diff --git a/ansible/browbeat/adjustment-nova-scheduler.yml b/ansible/browbeat/adjustment-nova-scheduler.yml index 6ae6eb7d7..d8ae588f6 100644 --- a/ansible/browbeat/adjustment-nova-scheduler.yml +++ b/ansible/browbeat/adjustment-nova-scheduler.yml @@ -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)" diff --git a/ansible/browbeat/roles/nova-config/tasks/main.yml b/ansible/browbeat/roles/nova-config/tasks/main.yml index 896401c60..3563f1386 100644 --- a/ansible/browbeat/roles/nova-config/tasks/main.yml +++ b/ansible/browbeat/roles/nova-config/tasks/main.yml @@ -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)"