Browse code

Use glance config files from source tree

This rewrites the config files for Glance API and Registry (-paste.ini and .conf)
rather than use templates from devstack/files.

Fixes bug 950289

Change-Id: I90151e36bb5f778499481e9abe0d8637d41f19aa

Dean Troyer authored on 2012/04/07 02:10:05
Showing 5 changed files
1 1
deleted file mode 100644
... ...
@@ -1,39 +0,0 @@
1
-[pipeline:glance-api]
2
-#pipeline = versionnegotiation context apiv1app
3
-# NOTE: use the following pipeline for keystone
4
-pipeline = versionnegotiation authtoken context apiv1app
5
-
6
-# To enable Image Cache Management API replace pipeline with below:
7
-# pipeline = versionnegotiation context imagecache apiv1app
8
-# NOTE: use the following pipeline for keystone auth (with caching)
9
-# pipeline = versionnegotiation authtoken auth-context imagecache apiv1app
10
-
11
-[app:apiv1app]
12
-paste.app_factory = glance.common.wsgi:app_factory
13
-glance.app_factory = glance.api.v1.router:API
14
-
15
-[filter:versionnegotiation]
16
-paste.filter_factory = glance.common.wsgi:filter_factory
17
-glance.filter_factory = glance.api.middleware.version_negotiation:VersionNegotiationFilter
18
-
19
-[filter:cache]
20
-paste.filter_factory = glance.common.wsgi:filter_factory
21
-glance.filter_factory = glance.api.middleware.cache:CacheFilter
22
-
23
-[filter:cachemanage]
24
-paste.filter_factory = glance.common.wsgi:filter_factory
25
-glance.filter_factory = glance.api.middleware.cache_manage:CacheManageFilter
26
-
27
-[filter:context]
28
-paste.filter_factory = glance.common.wsgi:filter_factory
29
-glance.filter_factory = glance.common.context:ContextMiddleware
30
-
31
-[filter:authtoken]
32
-paste.filter_factory = keystone.middleware.auth_token:filter_factory
33
-auth_host = %KEYSTONE_AUTH_HOST%
34
-auth_port = %KEYSTONE_AUTH_PORT%
35
-auth_protocol = %KEYSTONE_AUTH_PROTOCOL%
36
-auth_uri = %KEYSTONE_SERVICE_PROTOCOL%://%KEYSTONE_SERVICE_HOST%:%KEYSTONE_SERVICE_PORT%/
37
-admin_tenant_name = %SERVICE_TENANT_NAME%
38
-admin_user = %SERVICE_USERNAME%
39
-admin_password = %SERVICE_PASSWORD%
40 1
deleted file mode 100644
... ...
@@ -1,139 +0,0 @@
1
-[DEFAULT]
2
-# Show more verbose log output (sets INFO log level output)
3
-verbose = True
4
-
5
-# Show debugging output in logs (sets DEBUG log level output)
6
-debug = True
7
-
8
-# Which backend store should Glance use by default is not specified
9
-# in a request to add a new image to Glance? Default: 'file'
10
-# Available choices are 'file', 'swift', and 's3'
11
-default_store = file
12
-
13
-# Address to bind the API server
14
-bind_host = 0.0.0.0
15
-
16
-# Port the bind the API server to
17
-bind_port = 9292
18
-
19
-# Address to find the registry server
20
-registry_host = 0.0.0.0
21
-
22
-# Port the registry server is listening on
23
-registry_port = 9191
24
-
25
-# Log to this file. Make sure you do not set the same log
26
-# file for both the API and registry servers!
27
-#log_file = %DEST%/glance/api.log
28
-
29
-# Send logs to syslog (/dev/log) instead of to file specified by `log_file`
30
-use_syslog = %SYSLOG%
31
-
32
-# ============ Notification System Options =====================
33
-
34
-# Notifications can be sent when images are create, updated or deleted.
35
-# There are three methods of sending notifications, logging (via the
36
-# log_file directive), rabbit (via a rabbitmq queue) or noop (no
37
-# notifications sent, the default)
38
-notifier_strategy = noop
39
-
40
-# Configuration options if sending notifications via rabbitmq (these are
41
-# the defaults)
42
-rabbit_host = localhost
43
-rabbit_port = 5672
44
-rabbit_use_ssl = false
45
-rabbit_userid = guest
46
-rabbit_password = guest
47
-rabbit_virtual_host = /
48
-rabbit_notification_topic = glance_notifications
49
-
50
-# ============ Filesystem Store Options ========================
51
-
52
-# Directory that the Filesystem backend store
53
-# writes image data to
54
-filesystem_store_datadir = %DEST%/glance/images/
55
-
56
-# ============ Swift Store Options =============================
57
-
58
-# Address where the Swift authentication service lives
59
-swift_store_auth_address = 127.0.0.1:8080/v1.0/
60
-
61
-# User to authenticate against the Swift authentication service
62
-swift_store_user = jdoe
63
-
64
-# Auth key for the user authenticating against the
65
-# Swift authentication service
66
-swift_store_key = a86850deb2742ec3cb41518e26aa2d89
67
-
68
-# Container within the account that the account should use
69
-# for storing images in Swift
70
-swift_store_container = glance
71
-
72
-# Do we create the container if it does not exist?
73
-swift_store_create_container_on_put = False
74
-
75
-# What size, in MB, should Glance start chunking image files
76
-# and do a large object manifest in Swift? By default, this is
77
-# the maximum object size in Swift, which is 5GB
78
-swift_store_large_object_size = 5120
79
-
80
-# When doing a large object manifest, what size, in MB, should
81
-# Glance write chunks to Swift? This amount of data is written
82
-# to a temporary disk buffer during the process of chunking
83
-# the image file, and the default is 200MB
84
-swift_store_large_object_chunk_size = 200
85
-
86
-# Whether to use ServiceNET to communicate with the Swift storage servers.
87
-# (If you aren't RACKSPACE, leave this False!)
88
-#
89
-# To use ServiceNET for authentication, prefix hostname of
90
-# `swift_store_auth_address` with 'snet-'.
91
-# Ex. https://example.com/v1.0/ -> https://snet-example.com/v1.0/
92
-swift_enable_snet = False
93
-
94
-# ============ S3 Store Options =============================
95
-
96
-# Address where the S3 authentication service lives
97
-s3_store_host = 127.0.0.1:8080/v1.0/
98
-
99
-# User to authenticate against the S3 authentication service
100
-s3_store_access_key = <20-char AWS access key>
101
-
102
-# Auth key for the user authenticating against the
103
-# S3 authentication service
104
-s3_store_secret_key = <40-char AWS secret key>
105
-
106
-# Container within the account that the account should use
107
-# for storing images in S3. Note that S3 has a flat namespace,
108
-# so you need a unique bucket name for your glance images. An
109
-# easy way to do this is append your AWS access key to "glance".
110
-# S3 buckets in AWS *must* be lowercased, so remember to lowercase
111
-# your AWS access key if you use it in your bucket name below!
112
-s3_store_bucket = <lowercased 20-char aws access key>glance
113
-
114
-# Do we create the bucket if it does not exist?
115
-s3_store_create_bucket_on_put = False
116
-
117
-# ============ Image Cache Options ========================
118
-
119
-image_cache_enabled = False
120
-
121
-# Directory that the Image Cache writes data to
122
-# Make sure this is also set in glance-pruner.conf
123
-image_cache_datadir = /var/lib/glance/image-cache/
124
-
125
-# Number of seconds after which we should consider an incomplete image to be
126
-# stalled and eligible for reaping
127
-image_cache_stall_timeout = 86400
128
-
129
-# ============ Delayed Delete Options =============================
130
-
131
-# Turn on/off delayed delete
132
-delayed_delete = False
133
-
134
-# Delayed delete time in seconds
135
-scrub_time = 43200
136
-
137
-# Directory that the scrubber will use to remind itself of what to delete
138
-# Make sure this is also set in glance-scrubber.conf
139
-scrubber_datadir = /var/lib/glance/scrubber
140 1
deleted file mode 100644
... ...
@@ -1,23 +0,0 @@
1
-[pipeline:glance-registry]
2
-#pipeline = context registryapp
3
-# NOTE: use the following pipeline for keystone
4
-pipeline = authtoken context registryapp
5
-
6
-[app:registryapp]
7
-paste.app_factory = glance.common.wsgi:app_factory
8
-glance.app_factory = glance.registry.api.v1:API
9
-
10
-[filter:context]
11
-context_class = glance.registry.context.RequestContext
12
-paste.filter_factory = glance.common.wsgi:filter_factory
13
-glance.filter_factory = glance.common.context:ContextMiddleware
14
-
15
-[filter:authtoken]
16
-paste.filter_factory = keystone.middleware.auth_token:filter_factory
17
-auth_host = %KEYSTONE_AUTH_HOST%
18
-auth_port = %KEYSTONE_AUTH_PORT%
19
-auth_protocol = %KEYSTONE_AUTH_PROTOCOL%
20
-auth_uri = %KEYSTONE_SERVICE_PROTOCOL%://%KEYSTONE_SERVICE_HOST%:%KEYSTONE_SERVICE_PORT%/
21
-admin_tenant_name = %SERVICE_TENANT_NAME%
22
-admin_user = %SERVICE_USERNAME%
23
-admin_password = %SERVICE_PASSWORD%
24 1
deleted file mode 100644
... ...
@@ -1,44 +0,0 @@
1
-[DEFAULT]
2
-# Show more verbose log output (sets INFO log level output)
3
-verbose = True
4
-
5
-# Show debugging output in logs (sets DEBUG log level output)
6
-debug = True
7
-
8
-# Address to bind the registry server
9
-bind_host = 0.0.0.0
10
-
11
-# Port the bind the registry server to
12
-bind_port = 9191
13
-
14
-# Log to this file. Make sure you do not set the same log
15
-# file for both the API and registry servers!
16
-#log_file = %DEST%/glance/registry.log
17
-
18
-# Where to store images
19
-filesystem_store_datadir = %DEST%/glance/images
20
-
21
-# Send logs to syslog (/dev/log) instead of to file specified by `log_file`
22
-use_syslog = %SYSLOG%
23
-
24
-# SQLAlchemy connection string for the reference implementation
25
-# registry server. Any valid SQLAlchemy connection string is fine.
26
-# See: http://www.sqlalchemy.org/docs/05/reference/sqlalchemy/connections.html#sqlalchemy.create_engine
27
-sql_connection = %SQL_CONN%
28
-
29
-# Period in seconds after which SQLAlchemy should reestablish its connection
30
-# to the database.
31
-#
32
-# MySQL uses a default `wait_timeout` of 8 hours, after which it will drop
33
-# idle connections. This can result in 'MySQL Gone Away' exceptions. If you
34
-# notice this, you can lower this value to ensure that SQLAlchemy reconnects
35
-# before MySQL can drop the connection.
36
-sql_idle_timeout = 3600
37
-
38
-# Limit the api to return `param_limit_max` items in a call to a container. If
39
-# a larger `limit` query param is provided, it will be reduced to this value.
40
-api_limit_max = 1000
41
-
42
-# If a `limit` query param is not provided in an api request, it will
43
-# default to `limit_param_default`
44
-limit_param_default = 25
... ...
@@ -855,45 +855,42 @@ if is_service_enabled g-reg; then
855 855
     mysql -u$MYSQL_USER -p$MYSQL_PASSWORD -e 'DROP DATABASE IF EXISTS glance;'
856 856
     mysql -u$MYSQL_USER -p$MYSQL_PASSWORD -e 'CREATE DATABASE glance CHARACTER SET utf8;'
857 857
 
858
-    function glance_config {
859
-        sudo sed -e "
860
-            s,%KEYSTONE_API_PORT%,$KEYSTONE_API_PORT,g;
861
-            s,%KEYSTONE_AUTH_HOST%,$KEYSTONE_AUTH_HOST,g;
862
-            s,%KEYSTONE_AUTH_PORT%,$KEYSTONE_AUTH_PORT,g;
863
-            s,%KEYSTONE_AUTH_PROTOCOL%,$KEYSTONE_AUTH_PROTOCOL,g;
864
-            s,%KEYSTONE_SERVICE_HOST%,$KEYSTONE_SERVICE_HOST,g;
865
-            s,%KEYSTONE_SERVICE_PORT%,$KEYSTONE_SERVICE_PORT,g;
866
-            s,%KEYSTONE_SERVICE_PROTOCOL%,$KEYSTONE_SERVICE_PROTOCOL,g;
867
-            s,%SQL_CONN%,$BASE_SQL_CONN/glance?charset=utf8,g;
868
-            s,%SERVICE_TENANT_NAME%,$SERVICE_TENANT_NAME,g;
869
-            s,%SERVICE_USERNAME%,glance,g;
870
-            s,%SERVICE_PASSWORD%,$SERVICE_PASSWORD,g;
871
-            s,%SERVICE_TOKEN%,$SERVICE_TOKEN,g;
872
-            s,%DEST%,$DEST,g;
873
-            s,%SYSLOG%,$SYSLOG,g;
874
-        " -i $1
875
-    }
876
-
877 858
     # Copy over our glance configurations and update them
878 859
     GLANCE_REGISTRY_CONF=$GLANCE_CONF_DIR/glance-registry.conf
879
-    cp $FILES/glance-registry.conf $GLANCE_REGISTRY_CONF
880
-    glance_config $GLANCE_REGISTRY_CONF
881
-
882
-    if [[ -e $FILES/glance-registry-paste.ini ]]; then
883
-        GLANCE_REGISTRY_PASTE_INI=$GLANCE_CONF_DIR/glance-registry-paste.ini
884
-        cp $FILES/glance-registry-paste.ini $GLANCE_REGISTRY_PASTE_INI
885
-        glance_config $GLANCE_REGISTRY_PASTE_INI
886
-    fi
860
+    cp $GLANCE_DIR/etc/glance-registry.conf $GLANCE_REGISTRY_CONF
861
+    iniset $GLANCE_REGISTRY_CONF DEFAULT debug True
862
+    inicomment $GLANCE_REGISTRY_CONF DEFAULT log_file
863
+    iniset $GLANCE_REGISTRY_CONF DEFAULT sql_connection $BASE_SQL_CONN/glance?charset=utf8
864
+    iniset $GLANCE_REGISTRY_CONF DEFAULT use_syslog $SYSLOG
865
+    iniset $GLANCE_REGISTRY_CONF paste_deploy flavor keystone
866
+
867
+    GLANCE_REGISTRY_PASTE_INI=$GLANCE_CONF_DIR/glance-registry-paste.ini
868
+    cp $GLANCE_DIR/etc/glance-registry-paste.ini $GLANCE_REGISTRY_PASTE_INI
869
+    iniset $GLANCE_REGISTRY_PASTE_INI filter:authtoken auth_host $KEYSTONE_AUTH_HOST
870
+    iniset $GLANCE_REGISTRY_PASTE_INI filter:authtoken auth_port $KEYSTONE_AUTH_PORT
871
+    iniset $GLANCE_REGISTRY_PASTE_INI filter:authtoken auth_protocol $KEYSTONE_AUTH_PROTOCOL
872
+    iniset $GLANCE_REGISTRY_PASTE_INI filter:authtoken auth_uri $KEYSTONE_SERVICE_PROTOCOL://$KEYSTONE_SERVICE_HOST:$KEYSTONE_SERVICE_PORT/
873
+    iniset $GLANCE_REGISTRY_PASTE_INI filter:authtoken admin_tenant_name $SERVICE_TENANT_NAME
874
+    iniset $GLANCE_REGISTRY_PASTE_INI filter:authtoken admin_user glance
875
+    iniset $GLANCE_REGISTRY_PASTE_INI filter:authtoken admin_password $SERVICE_PASSWORD
887 876
 
888 877
     GLANCE_API_CONF=$GLANCE_CONF_DIR/glance-api.conf
889
-    cp $FILES/glance-api.conf $GLANCE_API_CONF
890
-    glance_config $GLANCE_API_CONF
891
-
892
-    if [[ -e $FILES/glance-api-paste.ini ]]; then
893
-        GLANCE_API_PASTE_INI=$GLANCE_CONF_DIR/glance-api-paste.ini
894
-        cp $FILES/glance-api-paste.ini $GLANCE_API_PASTE_INI
895
-        glance_config $GLANCE_API_PASTE_INI
896
-    fi
878
+    cp $GLANCE_DIR/etc/glance-api.conf $GLANCE_API_CONF
879
+    iniset $GLANCE_API_CONF DEFAULT debug True
880
+    inicomment $GLANCE_API_CONF DEFAULT log_file
881
+    iniset $GLANCE_API_CONF DEFAULT use_syslog $SYSLOG
882
+    iniset $GLANCE_API_CONF DEFAULT filesystem_store_datadir $GLANCE_IMAGE_DIR/
883
+    iniset $GLANCE_API_CONF paste_deploy flavor keystone
884
+
885
+    GLANCE_API_PASTE_INI=$GLANCE_CONF_DIR/glance-api-paste.ini
886
+    cp $GLANCE_DIR/etc/glance-api-paste.ini $GLANCE_API_PASTE_INI
887
+    iniset $GLANCE_API_PASTE_INI filter:authtoken auth_host $KEYSTONE_AUTH_HOST
888
+    iniset $GLANCE_API_PASTE_INI filter:authtoken auth_port $KEYSTONE_AUTH_PORT
889
+    iniset $GLANCE_API_PASTE_INI filter:authtoken auth_protocol $KEYSTONE_AUTH_PROTOCOL
890
+    iniset $GLANCE_API_PASTE_INI filter:authtoken auth_uri $KEYSTONE_SERVICE_PROTOCOL://$KEYSTONE_SERVICE_HOST:$KEYSTONE_SERVICE_PORT/
891
+    iniset $GLANCE_API_PASTE_INI filter:authtoken admin_tenant_name $SERVICE_TENANT_NAME
892
+    iniset $GLANCE_API_PASTE_INI filter:authtoken admin_user glance
893
+    iniset $GLANCE_API_PASTE_INI filter:authtoken admin_password $SERVICE_PASSWORD
897 894
 fi
898 895
 
899 896
 # Quantum