Add mysql cluster to glance deployment
Change-Id: Ia3fe4461a7e1991cadf5963664ec7efd19d2db7e
This commit is contained in:
parent
d10f7e5e8f
commit
6c1fcf1f9e
@ -4,8 +4,9 @@ configMap:
|
||||
ceilometer:
|
||||
dbUri: "sqlite:///:memory:"
|
||||
glance:
|
||||
configDir: /etc/glance
|
||||
dataDir: /opt/stack/data/glance
|
||||
mysql:
|
||||
size: 10Gi
|
||||
horizon:
|
||||
hostAliases:
|
||||
- hostnames:
|
||||
|
@ -12,4 +12,6 @@ data:
|
||||
keystone: {}
|
||||
heat: {}
|
||||
magnum: {}
|
||||
glance:
|
||||
dataDir: /opt/stack/data/glance
|
||||
chronyd: {}
|
||||
|
@ -25,8 +25,10 @@ function configure_glance {
|
||||
sudo install -d -o $STACK_USER $GLANCE_CONF_DIR $GLANCE_METADEF_DIR
|
||||
|
||||
# Set non-default configuration options for the API server
|
||||
local dburl
|
||||
dburl=`database_connection_url glance`
|
||||
# Get mysql password
|
||||
GLANCE_DATABASE_USER=$(get_data_from_secret glance-mysql openstack USER)
|
||||
GLANCE_DATABASE_PASSWORD=$(get_data_from_secret glance-mysql openstack PASSWORD)
|
||||
GLANCE_DATABASE_NAME=$(get_data_from_secret glance-mysql openstack DATABASE)
|
||||
|
||||
# Configure multiple stores
|
||||
if [[ "$GLANCE_ENABLE_MULTIPLE_STORES" == "True" ]]; then
|
||||
@ -39,7 +41,7 @@ function configure_glance {
|
||||
fi
|
||||
|
||||
iniset $GLANCE_API_CONF DEFAULT debug $ENABLE_DEBUG_LOG_LEVEL
|
||||
iniset $GLANCE_API_CONF database connection $dburl
|
||||
iniset $GLANCE_API_CONF database connection "mysql+pymysql://$GLANCE_DATABASE_USER:$GLANCE_DATABASE_PASSWORD@glance-mysql/$GLANCE_DATABASE_NAME?charset=utf8"
|
||||
iniset $GLANCE_API_CONF DEFAULT use_syslog $SYSLOG
|
||||
iniset $GLANCE_API_CONF DEFAULT image_cache_dir $GLANCE_CACHE_DIR/
|
||||
iniset $GLANCE_API_CONF oslo_concurrency lock_path $GLANCE_LOCK_DIR
|
||||
@ -78,11 +80,6 @@ function configure_glance {
|
||||
iniset $GLANCE_API_CONF cors allowed_origin "http://$SERVICE_HOST"
|
||||
fi
|
||||
|
||||
if [[ "$GLANCE_STANDALONE" == "False" ]]; then
|
||||
# NOTE(danms): Do not advertise import methods if we are running in WSGI mode
|
||||
iniset $GLANCE_API_CONF DEFAULT enabled_import_methods []
|
||||
fi
|
||||
|
||||
# No multiple stores for swift yet
|
||||
# Store the images in swift if enabled.
|
||||
if is_service_enabled s-proxy; then
|
||||
@ -158,7 +155,7 @@ function configure_glance {
|
||||
fi
|
||||
}
|
||||
|
||||
# init_glance() - Initialize databases, etc.
|
||||
# init_glance()
|
||||
function init_glance {
|
||||
# Delete existing images
|
||||
rm -rf $GLANCE_IMAGE_DIR
|
||||
@ -166,9 +163,6 @@ function init_glance {
|
||||
|
||||
# NOTE: Permissions here are bad but it's temporary so we don't care as much.
|
||||
sudo chmod -Rv 777 $DATA_DIR/glance
|
||||
|
||||
# (Re)create glance database
|
||||
recreate_database glance
|
||||
}
|
||||
export -f init_glance
|
||||
|
||||
|
@ -19,6 +19,7 @@ the appropriate deployments, Mcrouter, pod monitors and Prometheus rules.
|
||||
"""
|
||||
|
||||
|
||||
from openstack_operator import database
|
||||
from openstack_operator import utils
|
||||
|
||||
|
||||
@ -29,11 +30,20 @@ def create_or_resume(name, spec, **_):
|
||||
start the service up for the first time.
|
||||
"""
|
||||
|
||||
# deploy mysql
|
||||
if "mysql" not in spec:
|
||||
database.ensure_mysql_cluster("glance", {})
|
||||
else:
|
||||
database.ensure_mysql_cluster("glance", spec["mysql"])
|
||||
|
||||
# deploy memcached
|
||||
utils.create_or_update('glance/memcached.yml.j2', spec=spec)
|
||||
|
||||
# deploy glance api
|
||||
utils.create_or_update('glance/daemonset.yml.j2',
|
||||
name=name, spec=spec)
|
||||
utils.create_or_update('glance/service.yml.j2',
|
||||
name=name, spec=spec)
|
||||
utils.create_or_update('glance/memcached.yml.j2', spec=spec)
|
||||
if "ingress" in spec:
|
||||
utils.create_or_update('glance/ingress.yml.j2',
|
||||
name=name, spec=spec)
|
||||
|
Loading…
x
Reference in New Issue
Block a user