Use multistore modules to set up glance_store

This patch replaces legacy modules for single glance_store by the
new modules for multi store feature, since the legacy modules have
been deprecated[1].

[1] fd02761c6e634100ce4583c88a092f2958742ae7

Depends-on: https://review.opendev.org/768103
Change-Id: I28ef9215a8f13637d539e804d1777e4583534e1e
This commit is contained in:
Takashi Kajinami 2020-11-09 22:43:16 +09:00
parent 632b05b36f
commit 535a86e527

View File

@ -51,42 +51,43 @@ class openstack_integration::glance (
} }
case $backend { case $backend {
'file': { 'file': {
include glance::backend::file glance::backend::multistore::file { 'file1': }
$backend_store = ['file'] $default_backend = 'file1'
} }
'rbd': { 'rbd': {
class { 'glance::backend::rbd': glance::backend::multistore::rbd { 'rbd1':
rbd_store_user => 'openstack', rbd_store_user => 'openstack',
rbd_store_pool => 'glance', rbd_store_pool => 'glance',
} }
$backend_store = ['rbd']
# make sure ceph pool exists before running Glance API # make sure ceph pool exists before running Glance API
Exec['create-glance'] -> Service['glance-api'] Exec['create-glance'] -> Service['glance-api']
$default_backend = 'rbd1'
} }
'swift': { 'swift': {
$backend_store = ['swift'] glance::backend::multistore::swift { 'swift1':
class { 'glance::backend::swift':
swift_store_user => 'services:glance', swift_store_user => 'services:glance',
swift_store_key => 'a_big_secret', swift_store_key => 'a_big_secret',
swift_store_create_container_on_put => 'True', swift_store_create_container_on_put => 'True',
swift_store_auth_address => "${::openstack_integration::config::keystone_auth_uri}/v3", swift_store_auth_address => "${::openstack_integration::config::keystone_auth_uri}/v3",
swift_store_auth_version => '3', swift_store_auth_version => '3',
} }
$default_backend = 'swift1'
} }
default: { default: {
fail("Unsupported backend (${backend})") fail("Unsupported backend (${backend})")
} }
} }
$http_store = ['http']
$glance_stores = concat($http_store, $backend_store) $enabled_backends = ["${default_backend}:${backend}"]
class { 'glance::api::logging': class { 'glance::api::logging':
debug => true, debug => true,
} }
class { 'glance::api': class { 'glance::api':
database_connection => 'mysql+pymysql://glance:glance@127.0.0.1/glance?charset=utf8', database_connection => 'mysql+pymysql://glance:glance@127.0.0.1/glance?charset=utf8',
workers => 2, workers => 2,
stores => $glance_stores, enabled_backends => $enabled_backends,
default_store => $backend, default_backend => $default_backend,
bind_host => $::openstack_integration::config::host, bind_host => $::openstack_integration::config::host,
cert_file => $crt_file, cert_file => $crt_file,
key_file => $key_file, key_file => $key_file,