gnocchi/ceilometer upgrade workflow fix

The current workflow for gnocchi/ceilometer upgrade doesn't
work well with swift backend.

Notification agent push data into Gnocchi on step4, but
Ceilometer-upgrade run only on step5, So Gnocchi have not been populated
with latest resource schemas.

Gnocchi-api is started in step3 but gnocchi::storage configuration have
not been done and database upgrade have not been done.

When configuration is done on step4, httpd will be restarted.

This change will fix this issue by:

* Doing only the Gnocchi database upgrade on step3 because swift is
  ready only on step4.
* Configuring gnocchi::storage on step3 to avoid gnocchi-api restart on
  step4.
* Add dependencies between ceilometer-upgrade and gnocchi-api in case of
  non multinode deployment.

This ensures:

* gnocchi-api will be correctly configured at the end of
  step3 (configuration+database-sync).
* No new measures will be pushed to Gnocchi before ceilometer-upgrade have
  upgraded the Gnocchi resource schemas.
* Gnocchi-api have database updated before ceilometer-upgrade need it.
* We continue to upgrade storage/incoming data of Gnocchi on step4 after
  swift is up.

Closes-bug: #1724328
Change-Id: I3f9a784e507e03454b335ba8319601fba208ba0a
This commit is contained in:
Mehdi Abaakouk 2017-12-14 12:36:26 +01:00
parent 75b4f9bda6
commit 5b1a139fa0
2 changed files with 21 additions and 8 deletions

View File

@ -38,8 +38,6 @@ class tripleo::profile::base::ceilometer::upgrade (
$sync_db = false
}
# Run ceilometer-upgrade in step 5 so gnocchi resource types
# are created safely.
if $step >= 5 and $sync_db {
exec {'ceilometer-db-upgrade':
command => 'ceilometer-upgrade',
@ -53,5 +51,12 @@ class tripleo::profile::base::ceilometer::upgrade (
try_sleep => 5,
tries => 10
}
# NOTE(sileht): Ensure we run before ceilometer-agent-notification is
# started and after gnocchi-api is running
include ::gnocchi::deps
Anchor['gnocchi::service::end']
~> Exec['ceilometer-db-upgrade']
~> Anchor['ceilometer::service::begin']
}
}

View File

@ -94,20 +94,28 @@ class tripleo::profile::base::gnocchi::api (
$tls_keyfile = undef
}
if $step >= 4 and $sync_db {
include ::gnocchi::db::sync
}
if $step >= 4 or ($step >= 3 and $sync_db) {
if $sync_db {
# NOTE(sileht): We upgrade only the database on step 3.
# the storage will be updated on step4 when swift is ready
if ($step == 3 and $gnocchi_backend == 'swift') {
$db_sync_extra_opts = '--skip-storage --skip-incoming'
} else {
$db_sync_extra_opts = undef
}
class { '::gnocchi::db::sync':
extra_opts => $db_sync_extra_opts,
}
}
include ::gnocchi::api
include ::tripleo::profile::base::apache
class { '::gnocchi::wsgi::apache':
ssl_cert => $tls_certfile,
ssl_key => $tls_keyfile,
}
}
if $step >= 4 {
class { '::gnocchi::storage':
coordination_url => join(['redis://:', $gnocchi_redis_password, '@', normalize_ip_for_uri($redis_vip), ':6379/']),
}