|
...
|
...
|
@@ -68,9 +68,8 @@ CINDER_SERVICE_PROTOCOL=${CINDER_SERVICE_PROTOCOL:-$SERVICE_PROTOCOL}
|
|
68
|
68
|
CINDER_SERVICE_LISTEN_ADDRESS=${CINDER_SERVICE_LISTEN_ADDRESS:-$SERVICE_LISTEN_ADDRESS}
|
|
69
|
69
|
|
|
70
|
70
|
# What type of LVM device should Cinder use for LVM backend
|
|
71
|
|
-# Defaults to default, which is thick, the other valid choice
|
|
72
|
|
-# is thin, which as the name implies utilizes lvm thin provisioning.
|
|
73
|
|
-CINDER_LVM_TYPE=${CINDER_LVM_TYPE:-default}
|
|
|
71
|
+# Defaults to thin. For thick provisioning change to 'default'
|
|
|
72
|
+CINDER_LVM_TYPE=${CINDER_LVM_TYPE:-thin}
|
|
74
|
73
|
|
|
75
|
74
|
# Default backends
|
|
76
|
75
|
# The backend format is type:name where type is one of the supported backend
|
|
...
|
...
|
@@ -128,6 +127,17 @@ fi
|
|
128
|
128
|
CINDER_NOVA_CATALOG_INFO=${CINDER_NOVA_CATALOG_INFO:-compute:nova:publicURL}
|
|
129
|
129
|
CINDER_NOVA_CATALOG_ADMIN_INFO=${CINDER_NOVA_CATALOG_ADMIN_INFO:-compute:nova:adminURL}
|
|
130
|
130
|
|
|
|
131
|
+# Environment variables to configure the image-volume cache
|
|
|
132
|
+CINDER_IMG_CACHE_ENABLED=${CINDER_IMG_CACHE_ENABLED:-True}
|
|
|
133
|
+
|
|
|
134
|
+# For limits, if left unset, it will use cinder defaults of 0 for unlimited
|
|
|
135
|
+CINDER_IMG_CACHE_SIZE_GB=${CINDER_IMG_CACHE_SIZE_GB:-}
|
|
|
136
|
+CINDER_IMG_CACHE_SIZE_COUNT=${CINDER_IMG_CACHE_SIZE_COUNT:-}
|
|
|
137
|
+
|
|
|
138
|
+# Configure which cinder backends will have the image-volume cache, this takes the same
|
|
|
139
|
+# form as the CINDER_ENABLED_BACKENDS config option. By default it will
|
|
|
140
|
+# enable the cache for all cinder backends.
|
|
|
141
|
+CINDER_CACHE_ENABLED_FOR_BACKENDS=${CINDER_CACHE_ENABLED_FOR_BACKENDS:-$CINDER_ENABLED_BACKENDS}
|
|
131
|
142
|
|
|
132
|
143
|
# Functions
|
|
133
|
144
|
# ---------
|
|
...
|
...
|
@@ -292,6 +302,7 @@ function configure_cinder {
|
|
292
|
292
|
if [[ -n "$default_name" ]]; then
|
|
293
|
293
|
iniset $CINDER_CONF DEFAULT default_volume_type ${default_name}
|
|
294
|
294
|
fi
|
|
|
295
|
+ configure_cinder_image_volume_cache
|
|
295
|
296
|
fi
|
|
296
|
297
|
|
|
297
|
298
|
if is_service_enabled swift; then
|
|
...
|
...
|
@@ -397,6 +408,8 @@ function create_cinder_accounts {
|
|
397
|
397
|
"$CINDER_SERVICE_PROTOCOL://$CINDER_SERVICE_HOST:$CINDER_SERVICE_PORT/v3/\$(project_id)s" \
|
|
398
|
398
|
"$CINDER_SERVICE_PROTOCOL://$CINDER_SERVICE_HOST:$CINDER_SERVICE_PORT/v3/\$(project_id)s" \
|
|
399
|
399
|
"$CINDER_SERVICE_PROTOCOL://$CINDER_SERVICE_HOST:$CINDER_SERVICE_PORT/v3/\$(project_id)s"
|
|
|
400
|
+
|
|
|
401
|
+ configure_cinder_internal_tenant
|
|
400
|
402
|
fi
|
|
401
|
403
|
}
|
|
402
|
404
|
|
|
...
|
...
|
@@ -574,6 +587,31 @@ function create_cinder_volume_group {
|
|
574
|
574
|
:
|
|
575
|
575
|
}
|
|
576
|
576
|
|
|
|
577
|
+function configure_cinder_internal_tenant {
|
|
|
578
|
+ # Re-use the Cinder service account for simplicity.
|
|
|
579
|
+ iniset $CINDER_CONF DEFAULT cinder_internal_tenant_project_id $(get_or_create_project $SERVICE_PROJECT_NAME)
|
|
|
580
|
+ iniset $CINDER_CONF DEFAULT cinder_internal_tenant_user_id $(get_or_create_user "cinder")
|
|
|
581
|
+}
|
|
|
582
|
+
|
|
|
583
|
+function configure_cinder_image_volume_cache {
|
|
|
584
|
+ # Expect CINDER_CACHE_ENABLED_FOR_BACKENDS to be a list of backends
|
|
|
585
|
+ # similar to CINDER_ENABLED_BACKENDS with NAME:TYPE where NAME will
|
|
|
586
|
+ # be the backend specific configuration stanza in cinder.conf.
|
|
|
587
|
+ for be in ${CINDER_CACHE_ENABLED_FOR_BACKENDS//,/ }; do
|
|
|
588
|
+ local be_name=${be##*:}
|
|
|
589
|
+
|
|
|
590
|
+ iniset $CINDER_CONF $be_name image_volume_cache_enabled $CINDER_IMG_CACHE_ENABLED
|
|
|
591
|
+
|
|
|
592
|
+ if [[ -n $CINDER_IMG_CACHE_SIZE_GB ]]; then
|
|
|
593
|
+ iniset $CINDER_CONF $be_name image_volume_cache_max_size_gb $CINDER_IMG_CACHE_SIZE_GB
|
|
|
594
|
+ fi
|
|
|
595
|
+
|
|
|
596
|
+ if [[ -n $CINDER_IMG_CACHE_SIZE_COUNT ]]; then
|
|
|
597
|
+ iniset $CINDER_CONF $be_name image_volume_cache_max_count $CINDER_IMG_CACHE_SIZE_COUNT
|
|
|
598
|
+ fi
|
|
|
599
|
+ done
|
|
|
600
|
+}
|
|
|
601
|
+
|
|
577
|
602
|
|
|
578
|
603
|
# Restore xtrace
|
|
579
|
604
|
$_XTRACE_CINDER
|