[Queens/Pike] Run online data migrations on converge, allow disabling them

We control whether online migrations run or not via a new parameter
EnableOnlineDataMigrations. The online data migrations get
automatically disabled for the main upgrade phase, and automatically
enabled on upgrade converge.

This means that if no manual override is done, the migrations will run
on `upgrade converge` automatically. However, user is still able to
override the EnableOnlineDataMigrations, to e.g. completely opt out of
running the migrations automatically, if they wish to run them by
hand.

This patch is a "spiritual backport" of change
I35c8d9985df21b3084fba558687e1f408e5a0878, which is not backportable
further back than Rocky.

Change-Id: Ife468bc86b4b2c415783f37ff8ef2f90a4c0e465
Partial-Bug: #1793332
This commit is contained in:
Jiri Stransky 2018-09-21 14:16:22 +02:00
parent 8537f02302
commit 218ff2a50e
8 changed files with 56 additions and 6 deletions

View File

@ -39,6 +39,10 @@ parameters:
EnableInternalTLS:
type: boolean
default: false
EnableOnlineDataMigrations:
type: boolean
description: Enable post-upgrade online data migrations.
default: true
UpgradeRemoveUnusedPackages:
default: false
description: Remove package if the service is being disabled during upgrade
@ -47,6 +51,7 @@ parameters:
conditions:
internal_tls_enabled: {equals: [{get_param: EnableInternalTLS}, true]}
online_data_migrations_enabled: {equals: [{get_param: EnableOnlineDataMigrations}, true]}
resources:
@ -66,6 +71,16 @@ resources:
RoleName: {get_param: RoleName}
RoleParameters: {get_param: RoleParameters}
OnlineDataMigrationsCommand:
type: OS::Heat::Value
properties:
type: string
value:
if:
- online_data_migrations_enabled
- "/usr/bin/bootstrap_host_exec cinder_api su cinder -s /bin/bash -c 'cinder-manage db online_data_migrations'"
- "/usr/bin/echo Online data migrations disabled via EnableOnlineDataMigrations parameter"
outputs:
role_data:
description: Role data for the Cinder API role.
@ -184,10 +199,7 @@ outputs:
- /var/lib/config-data/cinder/etc/cinder/:/etc/cinder/:ro
- /var/log/containers/cinder:/var/log/cinder
- /var/log/containers/httpd/cinder-api:/var/log/httpd
command:
- '/usr/bin/bootstrap_host_exec'
- 'cinder_api'
- "su cinder -s /bin/bash -c 'cinder-manage db online_data_migrations'"
command: {get_attr: [OnlineDataMigrationsCommand, value]}
cinder_api_cron:
image: *cinder_api_image
net: host

View File

@ -36,6 +36,14 @@ parameters:
default: {}
description: Parameters specific to the role
type: json
EnableOnlineDataMigrations:
type: boolean
description: Enable post-upgrade online data migrations.
default: true
conditions:
online_data_migrations_enabled: {equals: [{get_param: EnableOnlineDataMigrations}, true]}
resources:
@ -55,6 +63,16 @@ resources:
RoleName: {get_param: RoleName}
RoleParameters: {get_param: RoleParameters}
OnlineDataMigrationsCommand:
type: OS::Heat::Value
properties:
type: string
value:
if:
- online_data_migrations_enabled
- "/usr/bin/bootstrap_host_exec ironic_api su ironic -s /bin/bash -c 'ironic-dbsync --config-file /etc/ironic/ironic.conf online_data_migrations'"
- "/usr/bin/echo Online data migrations disabled via EnableOnlineDataMigrations parameter"
outputs:
role_data:
description: Role data for the Ironic API role.
@ -150,7 +168,7 @@ outputs:
- /var/lib/config-data/ironic_api/etc/ironic:/etc/ironic:ro
- /var/log/containers/ironic:/var/log/ironic
- /var/log/containers/httpd/ironic-api:/var/log/httpd
command: "/usr/bin/bootstrap_host_exec ironic_api su ironic -s /bin/bash -c 'ironic-dbsync --config-file /etc/ironic/ironic.conf online_data_migrations'"
command: {get_attr: [OnlineDataMigrationsCommand, value]}
host_prep_tasks:
- name: create persistent logs directory
file:

View File

@ -39,6 +39,10 @@ parameters:
EnableInternalTLS:
type: boolean
default: false
EnableOnlineDataMigrations:
type: boolean
description: Enable post-upgrade online data migrations.
default: true
NovaDbSyncTimeout:
default: 300
description: Timeout for Nova db sync
@ -61,6 +65,7 @@ parameters:
conditions:
internal_tls_enabled: {equals: [{get_param: EnableInternalTLS}, true]}
online_data_migrations_enabled: {equals: [{get_param: EnableOnlineDataMigrations}, true]}
resources:
@ -83,6 +88,16 @@ resources:
NovaApiLogging:
type: OS::TripleO::Services::Logging::NovaApi
OnlineDataMigrationsCommand:
type: OS::Heat::Value
properties:
type: string
value:
if:
- online_data_migrations_enabled
- "/usr/bin/bootstrap_host_exec nova_api su nova -s /bin/bash -c '/usr/bin/nova-manage db online_data_migrations'"
- "/usr/bin/echo Online data migrations disabled via EnableOnlineDataMigrations parameter"
outputs:
role_data:
description: Role data for the Nova API role.
@ -318,7 +333,7 @@ outputs:
detach: false
volumes: *nova_api_bootstrap_volumes
user: root
command: "/usr/bin/bootstrap_host_exec nova_api su nova -s /bin/bash -c '/usr/bin/nova-manage db online_data_migrations'"
command: {get_attr: [OnlineDataMigrationsCommand, value]}
metadata_settings:
get_attr: [NovaApiBase, role_data, metadata_settings]
host_prep_tasks: {get_attr: [NovaApiLogging, host_prep_tasks]}

View File

@ -8,4 +8,5 @@ resource_registry:
OS::Heat::SoftwareDeployment: OS::TripleO::Heat::SoftwareDeployment
OS::Heat::StructuredDeployment: OS::TripleO::Heat::StructuredDeployment
parameter_defaults:
EnableOnlineDataMigrations: false
StackUpdateType: ''

View File

@ -9,5 +9,6 @@ resource_registry:
OS::Heat::StructuredDeployment: OS::TripleO::Heat::StructuredDeployment
parameter_defaults:
CephAnsiblePlaybook: ['/usr/share/ceph-ansible/site-docker.yml.sample']
EnableOnlineDataMigrations: true
StackUpdateType: ''
NetworkDeploymentActions: ['CREATE']

View File

@ -16,5 +16,6 @@ resource_registry:
OS::TripleO::Services::FluentdClient: OS::Heat::None
parameter_defaults:
EnableOnlineDataMigrations: false
StackUpdateType: FASTFORWARDUPGRADE
NetworkDeploymentActions: ['CREATE','UPDATE']

View File

@ -6,6 +6,7 @@ resource_registry:
OS::TripleO::WorkflowSteps: OS::Mistral::ExternalResource
parameter_defaults:
CephAnsiblePlaybook: ['/usr/share/ceph-ansible/site-docker.yml.sample']
EnableOnlineDataMigrations: true
UpgradeLevelNovaCompute: ''
UpgradeInitCommonCommand: ''
UpgradeInitCommand: ''

View File

@ -10,6 +10,7 @@ resource_registry:
OS::TripleO::Services::FluentdClient: OS::Heat::None
parameter_defaults:
EnableOnlineDataMigrations: false
UpgradeLevelNovaCompute: auto
UpgradeInitCommonCommand: |
#!/bin/bash