Change default values for glance_store
By default glance and glare will share common place to store data. For example, for 'filesystem' backend it is '/var/lib/glance/images'. To prevent possible collisions we have to redefine 4 glance_store default values: * filesystem_store_datadir='/var/lib/glare/artifacts', * rbd_store_pool='artifacts', * vmware_store_image_dir='/openstack_glare', * swift_store_container='glare' Change-Id: I37093eb491e13b1bd553bfc9788b89d9c95df937
This commit is contained in:
parent
a01cb16f6e
commit
eb1eb29b74
@ -29,6 +29,7 @@ import hashlib
|
||||
import os
|
||||
import re
|
||||
|
||||
import glance_store
|
||||
from OpenSSL import crypto
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
@ -580,3 +581,26 @@ def validate_change_allowed(af, field_name):
|
||||
msg = (_("Forbidden to change field '%s' after activation.")
|
||||
% field_name)
|
||||
raise exception.Forbidden(message=msg)
|
||||
|
||||
|
||||
def initialize_glance_store():
|
||||
"""Initialize glance store."""
|
||||
glance_store.register_opts(CONF)
|
||||
set_glance_store_config_defaults()
|
||||
glance_store.create_stores(CONF)
|
||||
glance_store.verify_default_store()
|
||||
|
||||
|
||||
def set_glance_store_config_defaults():
|
||||
# By default glance and glare share common place to store data.
|
||||
# To prevent possible collisions we have to set other glance_store default
|
||||
# values for various backends.
|
||||
cfg.set_defaults(glance_store.backend._list_opts()[1][1],
|
||||
# default '/var/lib/glance/images
|
||||
filesystem_store_datadir='/var/lib/glare/artifacts',
|
||||
# default 'images'
|
||||
rbd_store_pool='artifacts',
|
||||
# default '/openstack_glance
|
||||
vmware_store_image_dir='/openstack_glare',
|
||||
# default 'glance'
|
||||
swift_store_container='glare')
|
||||
|
@ -33,7 +33,6 @@ from eventlet.green import socket
|
||||
from eventlet.green import ssl
|
||||
import eventlet.greenio
|
||||
import eventlet.wsgi
|
||||
import glance_store
|
||||
from oslo_concurrency import processutils
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
@ -212,13 +211,6 @@ def set_eventlet_hub():
|
||||
reason=msg)
|
||||
|
||||
|
||||
def initialize_glance_store():
|
||||
"""Initialize glance store."""
|
||||
glance_store.register_opts(CONF)
|
||||
glance_store.create_stores(CONF)
|
||||
glance_store.verify_default_store()
|
||||
|
||||
|
||||
def get_asynchronous_eventlet_pool(size=1000):
|
||||
"""Return eventlet pool to caller.
|
||||
|
||||
@ -361,7 +353,7 @@ class Server(object):
|
||||
|
||||
self.configure_socket(old_conf, has_changed)
|
||||
if self.initialize_glance_store:
|
||||
initialize_glance_store()
|
||||
utils.initialize_glance_store()
|
||||
|
||||
def reload(self):
|
||||
"""Reload and re-apply configuration settings
|
||||
|
@ -35,11 +35,11 @@ Sample apache mod_wsgi configuration:
|
||||
|
||||
import os
|
||||
|
||||
import glance_store
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
|
||||
from glare.common import config
|
||||
from glare.common import utils
|
||||
|
||||
|
||||
CONF = cfg.CONF
|
||||
@ -47,8 +47,6 @@ logging.register_options(CONF)
|
||||
CONFIG_FILE = os.environ.get("GLARE_CONFIG_FILE", "etc/glare.conf")
|
||||
config.parse_args(args=["--config-file", CONFIG_FILE])
|
||||
|
||||
glance_store.register_opts(CONF)
|
||||
glance_store.create_stores(CONF)
|
||||
glance_store.verify_default_store()
|
||||
utils.initialize_glance_store()
|
||||
|
||||
application = config.load_paste_app('glare-api')
|
||||
|
@ -34,6 +34,8 @@ console_scripts =
|
||||
glare-scrubber = glare.cmd.scrubber:main
|
||||
oslo.config.opts =
|
||||
glare = glare.opts:list_artifacts_opts
|
||||
oslo.config.opts.defaults =
|
||||
glare = glare.common.utils:set_glance_store_config_defaults
|
||||
oslo.policy.enforcer =
|
||||
glare = glare.common.policy:_get_enforcer
|
||||
oslo.policy.policies =
|
||||
|
Loading…
Reference in New Issue
Block a user