Sync the db as part of the glance-api install
authorFlavio Percoco <flaper87@gmail.com>
Wed, 7 Dec 2016 14:38:28 +0000 (15:38 +0100)
committerEmilien Macchi <emilien@redhat.com>
Wed, 4 Jan 2017 14:41:51 +0000 (09:41 -0500)
The glance database should be created as part of the glance-api service
installation and not the registry. Move the db_sync param to the
glance-api class call.

Change-Id: Ib9f511219e8cb9a7322745b6bd7c4f9c9cc0c198

manifests/profile/base/glance/api.pp
manifests/profile/base/glance/registry.pp

index 5ba7a0b..bfa9572 100644 (file)
 #
 # === Parameters
 #
+# [*bootstrap_node*]
+#   (Optional) The hostname of the node responsible for bootstrapping tasks
+#   Defaults to hiera('bootstrap_nodeid')
+#
 # [*glance_backend*]
 #   (Optional) Glance backend(s) to use.
 #   Defaults to downcase(hiera('glance_backend', 'swift'))
@@ -40,6 +44,7 @@
 #   Defaults to hiera('glance::notify::rabbitmq::rabbit_port', 5672)
 
 class tripleo::profile::base::glance::api (
+  $bootstrap_node     = hiera('bootstrap_nodeid', undef),
   $glance_backend     = downcase(hiera('glance_backend', 'swift')),
   $glance_nfs_enabled = false,
   $step               = hiera('step'),
@@ -47,11 +52,17 @@ class tripleo::profile::base::glance::api (
   $rabbit_port        = hiera('glance::notify::rabbitmq::rabbit_port', 5672),
 ) {
 
+  if $::hostname == downcase($bootstrap_node) {
+    $sync_db = true
+  } else {
+    $sync_db = false
+  }
+
   if $step >= 1 and $glance_nfs_enabled {
     include ::tripleo::glance::nfs_mount
   }
 
-  if $step >= 4 {
+  if $step >= 4 or ($step >= 3 and $sync_db) {
     case $glance_backend {
         'swift': { $backend_store = 'glance.store.swift.Store' }
         'file': { $backend_store = 'glance.store.filesystem.Store' }
@@ -65,7 +76,15 @@ class tripleo::profile::base::glance::api (
     include ::glance
     include ::glance::config
     class { '::glance::api':
-      stores => $glance_store,
+      stores  => $glance_store,
+      sync_db => false,
+    }
+    # When https://review.openstack.org/#/c/408554 is merged,
+    # Remove this block and set sync_db to $sync_db in glance::api.
+    if $sync_db {
+      class { '::glance::db::sync':
+        extra_params => '',
+      }
     }
     $rabbit_endpoints = suffix(any2array($rabbit_hosts), ":${rabbit_port}")
     class { '::glance::notify::rabbitmq' :
index 9e2be9d..cd40aeb 100644 (file)
@@ -19,6 +19,7 @@
 # === Parameters
 #
 # [*bootstrap_node*]
+#   DEPRECATED
 #   (Optional) The hostname of the node responsible for bootstrapping tasks
 #   Defaults to hiera('bootstrap_nodeid')
 #
 #   Defaults to hiera('step')
 #
 class tripleo::profile::base::glance::registry (
-  $bootstrap_node = hiera('bootstrap_nodeid', undef),
+  $bootstrap_node = undef,
   $glance_backend = downcase(hiera('glance_backend', 'swift')),
   $step           = hiera('step'),
 ) {
-  if $::hostname == downcase($bootstrap_node) {
-    $sync_db = true
-  } else {
-    $sync_db = false
-  }
 
-  if $step >= 4 or ( $step >= 3 and $sync_db ) {
+  if $step >= 4 {
     # TODO: notifications, scrubber, etc.
     include ::glance
     include ::glance::config
-    class { '::glance::registry' :
-      sync_db        => $sync_db,
-    }
+    include ::glance::registry
     include ::glance::notify::rabbitmq
     include join(['::glance::backend::', $glance_backend])
   }