ffu: Introduce Nova fast-forward upgrade tasks

fast_forward_upgrade_tasks for Nova covering Ocata and Pike.
- Service status check
- Stop services when updating from Ocata to Pike
- Update nova packages
- Db sync

Change-Id: Iff416668f8b8d15bdf7712f09e145eb7c7a6b83e
This commit is contained in:
Lee Yarwood 2017-11-23 20:09:06 +00:00 committed by Marius Cornea
parent b627ccb686
commit 781094e79b
7 changed files with 156 additions and 0 deletions

View File

@ -39,6 +39,10 @@ parameters:
EnableInternalTLS:
type: boolean
default: false
NovaDbSyncTimeout:
default: 300
description: Timeout for Nova db sync
type: number
UpgradeRemoveUnusedPackages:
default: false
description: Remove package if the service is being disabled during upgrade
@ -362,3 +366,92 @@ outputs:
file:
path: /var/spool/cron/nova
state: absent
fast_forward_upgrade_tasks:
- name: Check if nova-api is deployed
command: systemctl is-enabled --quiet openstack-nova-api
ignore_errors: True
register: nova_api_enabled
- name: Stop openstack-nova-api service
service: name=openstack-nova-api state=stopped
when: (step|int == 2) and (nova_api_enabled.rc == 0) and (release == 'ocata')
- name: Extra migration for nova tripleo/+bug/1656791
command: nova-manage db online_data_migrations
when:
- step|int == 5
- release == 'ocata'
- is_bootstrap_node|bool
- name: Update nova packages
command: yum update -y *nova*
when:
- step|int == 6
- is_bootstrap_node|bool
#FIXME(lyarwood): Use puppet to do this?
- when:
- step|int == 7
- release == 'ocata'
- is_bootstrap_node|bool
block:
- name: Create cell0 db
mysql_db:
name: nova_cell0
state: present
- name: Grant access to cell0 db
mysql_user:
name: nova
host_all: yes
state: present
priv: '*.*:ALL'
- name: Create puppet manifest to set transport_url in nova.conf
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
command: puppet apply --modulepath /etc/puppet/modules:/opt/stack/puppet-modules:/usr/share/openstack-puppet/modules --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)
shell: nova-manage cell_v2 map_cell0 --database_connection=$(hiera nova::cell0_database_connection)
- name: Setup cell_v2 (create default cell)
# (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)
command: nova-manage db sync
async: {get_param: NovaDbSyncTimeout}
poll: 10
- name: Setup cell_v2 (get cell uuid)
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 hosts)
command: nova-manage cell_v2 discover_hosts --cell_uuid {{nova_api_cell_uuid.stdout}} --verbose
- name: Setup cell_v2 (migrate instances)
command: nova-manage cell_v2 map_instances --cell_uuid {{nova_api_cell_uuid.stdout}}
- name: Sync nova_api DB
command: nova-manage api_db sync
when:
- step|int == 8
- is_bootstrap_node|bool
- name: Online data migration for nova
command: nova-manage db online_data_migrations
when:
- step|int == 8
- is_bootstrap_node|bool

View File

@ -221,3 +221,14 @@ outputs:
when:
- step|int == 2
- remove_nova_compute_package|bool
fast_forward_upgrade_tasks:
- name: Check if nova-compute is deployed
command: systemctl is-enabled --quiet openstack-nova-compute
ignore_errors: True
register: nova_compute_enabled
- name: Stop and disable nova-compute service
service: name=openstack-nova-compute state=stopped
when:
- step|int == 2
- nova_compute_enabled.rc == 0
- release == 'ocata'

View File

@ -161,3 +161,14 @@ outputs:
when:
- step|int == 2
- remove_nova_conductor_package|bool
fast_forward_upgrade_tasks:
- name: Check if nova_conductor is deployed
command: systemctl is-enabled --quiet openstack-nova-conductor
ignore_errors: True
register: nova_conductor_enabled
- name: Stop and disable nova_conductor service
service: name=openstack-nova-conductor state=stopped
when:
- step|int == 2
- nova_conductor_enabled.rc == 0
- release == 'ocata'

View File

@ -149,3 +149,14 @@ outputs:
when:
- step|int == 2
- remove_nova_console_package|bool
fast_forward_upgrade_tasks:
- name: Check if nova_consoleauth is deployed
command: systemctl is-active --quiet openstack-nova-consoleauth
ignore_errors: True
register: nova_consoleauth_enabled
- name: Stop and disable nova-consoleauth service
service: name=openstack-nova-consoleauth state=stopped
when:
- step|int == 2
- nova_consoleauth_enabled.rc == 0
- release == 'ocata'

View File

@ -146,3 +146,11 @@ outputs:
- step|int == 2
- nova_ironic_enabled.rc == 0
service: name=openstack-nova-compute state=stopped enabled=no
fast_forward_upgrade_tasks:
- name: Check if nova ironic is deployed
command: systemctl is-enabled --quiet openstack-nova-compute
tags: common
register: nova_ironic_enabled
- name: Stop and disable nova-compute service
service: name=openstack-nova-compute state=stopped
when: (step|int == 2) and (nova_ironic_enabled.rc == 0) and (release == 'ocata')

View File

@ -150,3 +150,14 @@ outputs:
when:
- step|int == 2
- remove_nova_scheduler_package|bool
fast_forward_upgrade_tasks:
- name: Check if nova_scheduler is deployed
command: systemctl is-enabled --quiet openstack-nova-scheduler
ignore_errors: True
register: nova_scheduler_enabled
- name: Stop and disable nova-scheduler service
service: name=openstack-nova-scheduler state=stopped
when:
- step|int == 2
- nova_scheduler_enabled.rc == 0
- release == 'ocata'

View File

@ -149,3 +149,14 @@ outputs:
when:
- step|int == 2
- remove_nova_novncproxy_package|bool
fast_forward_upgrade_tasks:
- name: Check if nova vncproxy is deployed
command: systemctl is-enabled --quiet openstack-nova-novncproxy
ignore_errors: True
register: nova_vncproxy_enabled
- name: Stop and disable nova-novncproxy service
service: name=openstack-nova-novncproxy state=stopped
when:
- step|int == 2
- nova_vncproxy_enabled.rc == 0
- release == 'ocata'