Add nova service support for composable upgrades

Co-Authored-By: Mathieu Bultel <mbultel@redhat.com>
Co-Authored-By: Oliver Walsh <owalsh@redhat.com>

Change-Id: Iafad800a6819d7e75fdaab60d328999d3d3c037f
Partially-Implements: blueprint overcloud-upgrades-per-service
Related-Bug: #1662344
This commit is contained in:
Steven Hardy 2016-12-01 10:02:56 +00:00 committed by Oliver Walsh
parent be6a66042e
commit 5353f1c7c9
10 changed files with 163 additions and 5 deletions

View File

@ -1,2 +1,4 @@
resource_registry: resource_registry:
OS::TripleO::PostDeploySteps: ../puppet/major_upgrade_steps.yaml OS::TripleO::PostDeploySteps: ../puppet/major_upgrade_steps.yaml
parameter_defaults:
UpgradeLevelNovaCompute: auto

View File

@ -34,6 +34,10 @@ parameters:
default: true default: true
description: Whether to use Galera instead of regular MariaDB. description: Whether to use Galera instead of regular MariaDB.
type: boolean type: boolean
NovaPassword:
description: The password for the nova db account
type: string
hidden: true
resources: resources:
@ -94,6 +98,8 @@ outputs:
{get_param: [ServiceNetMap, MysqlNetwork]} {get_param: [ServiceNetMap, MysqlNetwork]}
step_config: | step_config: |
include ::tripleo::profile::base::database::mysql include ::tripleo::profile::base::database::mysql
metadata_settings:
get_attr: [MySQLTLS, role_data, metadata_settings]
upgrade_tasks: upgrade_tasks:
- name: Check for galera root password - name: Check for galera root password
tags: step0 tags: step0
@ -104,6 +110,15 @@ outputs:
- name: Start service - name: Start service
tags: step4 tags: step4
service: name=mariadb state=started service: name=mariadb state=started
metadata_settings: - name: Setup cell_v2 (create cell0 database)
get_attr: [MySQLTLS, role_data, metadata_settings] tags: step4
mysql_db:
name: nova_cell0
state: present
- name: Setup cell_v2 (grant access to the nova DB user)
tags: step4
mysql_user:
str_replace:
template: "name=nova password=PASSWORD host=\"%\" priv=\"nova.*:ALL/nova_cell0.*:ALL,GRANT\" state=present"
params:
PASSWORD: {get_param: NovaPassword}

View File

@ -58,6 +58,10 @@ parameters:
default: 'public' default: 'public'
description: Default pool for floating IP addresses description: Default pool for floating IP addresses
type: string type: string
NovaDbSyncTimeout:
default: 300
description: Timeout for Nova db sync
type: number
conditions: conditions:
nova_workers_zero: {equals : [{get_param: NovaWorkers}, 0]} nova_workers_zero: {equals : [{get_param: NovaWorkers}, 0]}
@ -178,3 +182,86 @@ outputs:
# https://bugs.launchpad.net/nova/+bug/1661360 # https://bugs.launchpad.net/nova/+bug/1661360
# metadata_settings: # metadata_settings:
# get_attr: [ApacheServiceBase, role_data, metadata_settings] # get_attr: [ApacheServiceBase, role_data, metadata_settings]
upgrade_tasks:
- name: get bootstrap nodeid
tags: common
command: hiera bootstrap_nodeid
register: bootstrap_node
- name: set is_bootstrap_node fact
tags: common
set_fact: is_bootstrap_node={{bootstrap_node.stdout == ansible_hostname}}
- name: Extra migration for nova tripleo/+bug/1656791
tags: step0,pre-upgrade
when: is_bootstrap_node
command: nova-manage db online_data_migrations
- name: update nova api
tags: step2
yum: name=openstack-nova-api state=latest
- name: Stop and disable nova_api service (pre-upgrade not under httpd)
tags: step2
service: name=openstack-nova-api state=stopped enabled=no
- name: Create puppet manifest to set transport_url in nova.conf
tags: step5
when: is_bootstrap_node
copy:
dest: /root/nova-api_upgrade_manifest.pp
mode: 0600
content: >
$transport_url = os_transport_url({
'transport' => hiera('messaging_service_name', 'rabbit'),
'hosts' => any2array(hiera('rabbitmq_node_names', undef)),
'port' => sprintf('%s',hiera('nova::rabbit_port', '5672') ),
'username' => hiera('nova::rabbit_userid', 'guest'),
'password' => hiera('nova::rabbit_password'),
'ssl' => sprintf('%s', bool2num(str2bool(hiera('nova::rabbit_use_ssl', '0'))))
})
oslo::messaging::default { 'nova_config':
transport_url => $transport_url
}
- name: Run puppet apply to set tranport_url in nova.conf
tags: step5
when: is_bootstrap_node
command: puppet apply --detailed-exitcodes /root/nova-api_upgrade_manifest.pp
register: puppet_apply_nova_api_upgrade
failed_when: puppet_apply_nova_api_upgrade.rc not in [0,2]
changed_when: puppet_apply_nova_api_upgrade.rc == 2
- name: Setup cell_v2 (map cell0)
tags: step5
when: is_bootstrap_node
command: nova-manage cell_v2 map_cell0
- name: Setup cell_v2 (create default cell)
tags: step5
when: is_bootstrap_node
# (owalsh) puppet-nova expects the cell name 'default'
# (owalsh) pass the db uri explicitly to avoid https://bugs.launchpad.net/tripleo/+bug/1662344
shell: nova-manage cell_v2 create_cell --name='default' --database_connection=$(hiera nova::database_connection)
register: nova_api_create_cell
failed_when: nova_api_create_cell.rc not in [0,2]
changed_when: nova_api_create_cell.rc == 0
- name: Setup cell_v2 (sync nova/cell DB)
tags: step5
when: is_bootstrap_node
command: nova-manage db sync
async: {get_param: NovaDbSyncTimeout}
poll: 10
- name: Setup cell_v2 (migrate hosts)
tags: step5
when: is_bootstrap_node
command: nova-manage cell_v2 map_cell_and_hosts
- name: Setup cell_v2 (get cell uuid)
tags: step5
when: is_bootstrap_node
shell: nova-manage cell_v2 list_cells | sed -e '1,3d' -e '$d' | awk -F ' *| *' '$2 == "default" {print $4}'
register: nova_api_cell_uuid
- name: Setup cell_v2 (migrate instances)
tags: step5
when: is_bootstrap_node
command: nova-manage cell_v2 map_instances --cell_uuid {{nova_api_cell_uuid.stdout}}
- name: Sync nova_api DB
tags: step5
command: nova-manage api_db sync
when: is_bootstrap_node
- name: Online data migration for nova
tags: step5
when: is_bootstrap_node
command: nova-manage db online_data_migrations

View File

@ -116,7 +116,6 @@ parameters:
Cron to move deleted instances to another table - Until complete Cron to move deleted instances to another table - Until complete
default: false default: false
conditions: conditions:
compute_upgrade_level_empty: {equals : [{get_param: UpgradeLevelNovaCompute}, '']} compute_upgrade_level_empty: {equals : [{get_param: UpgradeLevelNovaCompute}, '']}

View File

@ -75,6 +75,10 @@ parameters:
default: default:
tag: openstack.nova.compute tag: openstack.nova.compute
path: /var/log/nova/nova-compute.log path: /var/log/nova/nova-compute.log
UpgradeLevelNovaCompute:
type: string
description: Nova Compute upgrade level
default: auto
resources: resources:
NovaBase: NovaBase:
@ -146,3 +150,19 @@ outputs:
tripleo.collectd.plugins.nova_compute: tripleo.collectd.plugins.nova_compute:
- virt - virt
collectd::plugins::virt::connection: "qemu:///system" collectd::plugins::virt::connection: "qemu:///system"
upgrade_tasks:
- name: Stop nova-compute service
tags: step2
service: name=openstack-nova-compute state=stopped
# If not already set by puppet (e.g a pre-ocata version), set the
# upgrade_level for compute to "auto"
- name: Set compute upgrade level to auto
tags: step3
ini_file:
str_replace:
template: "dest=/etc/nova/nova.conf section=upgrade_levels option=compute value=LEVEL"
params:
LEVEL: {get_param: UpgradeLevelNovaCompute}
- name: Start nova-compute service
tags: step6
service: name=openstack-nova-compute state=started

View File

@ -30,6 +30,10 @@ parameters:
default: default:
tag: openstack.nova.scheduler tag: openstack.nova.scheduler
path: /var/log/nova/nova-scheduler.log path: /var/log/nova/nova-scheduler.log
UpgradeLevelNovaCompute:
type: string
description: Nova Compute upgrade level
default: auto
conditions: conditions:
nova_workers_zero: {equals : [{get_param: NovaWorkers}, 0]} nova_workers_zero: {equals : [{get_param: NovaWorkers}, 0]}
@ -61,3 +65,19 @@ outputs:
- nova::conductor::workers: {get_param: NovaWorkers} - nova::conductor::workers: {get_param: NovaWorkers}
step_config: | step_config: |
include tripleo::profile::base::nova::conductor include tripleo::profile::base::nova::conductor
upgrade_tasks:
- name: Stop nova_conductor service
tags: step2
service: name=openstack-nova-conductor state=stopped
- name: update nova conductor
tags: step2
yum: name=openstack-nova-conductor state=latest
# If not already set by puppet (e.g a pre-ocata version), set the
# upgrade_level for compute to "auto"
- name: Set compute upgrade level to auto
tags: step3
ini_file:
str_replace:
template: "dest=/etc/nova/nova.conf section=upgrade_levels option=compute value=LEVEL"
params:
LEVEL: {get_param: UpgradeLevelNovaCompute}

View File

@ -48,3 +48,7 @@ outputs:
get_attr: [NovaBase, role_data, config_settings] get_attr: [NovaBase, role_data, config_settings]
step_config: | step_config: |
include tripleo::profile::base::nova::consoleauth include tripleo::profile::base::nova::consoleauth
upgrade_tasks:
- name: Stop nova_consoleauth service
tags: step2
service: name=openstack-nova-consoleauth state=stopped

View File

@ -63,3 +63,10 @@ outputs:
nova::scheduler::filter::scheduler_default_filters: {get_param: NovaSchedulerDefaultFilters} nova::scheduler::filter::scheduler_default_filters: {get_param: NovaSchedulerDefaultFilters}
step_config: | step_config: |
include tripleo::profile::base::nova::scheduler include tripleo::profile::base::nova::scheduler
upgrade_tasks:
- name: Stop nova_scheduler service
tags: step2
service: name=openstack-nova-scheduler state=stopped
- name: update nova scheduler
tags: step2
yum: name=openstack-nova-scheduler state=latest

View File

@ -64,3 +64,7 @@ outputs:
- 13080 - 13080
step_config: | step_config: |
include tripleo::profile::base::nova::vncproxy include tripleo::profile::base::nova::vncproxy
upgrade_tasks:
- name: Stop nova_vnc_proxy service
tags: step2
service: name=openstack-nova-consoleauth state=stopped

View File

@ -41,7 +41,7 @@ resources:
- {get_param: SkipUpgradeConfigTags} - {get_param: SkipUpgradeConfigTags}
tags: tags:
str_replace: str_replace:
template: "stepSTEP" template: "common,stepSTEP"
params: params:
STEP: {get_param: step} STEP: {get_param: step}
modulepath: /usr/share/ansible-modules modulepath: /usr/share/ansible-modules