This will have devstack setup the Cinder internal tenant and generic
image-volume cache by default. If left alone it will use reasonable
defaults.
More information about configuration options and the cache can be found
here: http://docs.openstack.org/admin-guide/blockstorage_image_volume_cache.html
As part of this we switch the default lvm type to thin so it will
work more efficiently with the image cache.
Change-Id: I0b2cc261736f32d38d43c60254f0dc7225b24c01
Implements: blueprint cinder-image-volume-cache
| ... | ... |
@@ -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 |
# --------- |
| ... | ... |
@@ -293,6 +303,7 @@ function configure_cinder {
|
| 293 | 293 |
if [[ -n "$default_name" ]]; then |
| 294 | 294 |
iniset $CINDER_CONF DEFAULT default_volume_type ${default_name}
|
| 295 | 295 |
fi |
| 296 |
+ configure_cinder_image_volume_cache |
|
| 296 | 297 |
fi |
| 297 | 298 |
|
| 298 | 299 |
if is_service_enabled swift; then |
| ... | ... |
@@ -394,6 +405,8 @@ function create_cinder_accounts {
|
| 394 | 394 |
"$CINDER_SERVICE_PROTOCOL://$CINDER_SERVICE_HOST:$CINDER_SERVICE_PORT/v3/\$(project_id)s" \ |
| 395 | 395 |
"$CINDER_SERVICE_PROTOCOL://$CINDER_SERVICE_HOST:$CINDER_SERVICE_PORT/v3/\$(project_id)s" \ |
| 396 | 396 |
"$CINDER_SERVICE_PROTOCOL://$CINDER_SERVICE_HOST:$CINDER_SERVICE_PORT/v3/\$(project_id)s" |
| 397 |
+ |
|
| 398 |
+ configure_cinder_internal_tenant |
|
| 397 | 399 |
fi |
| 398 | 400 |
} |
| 399 | 401 |
|
| ... | ... |
@@ -573,6 +586,31 @@ function create_cinder_volume_group {
|
| 573 | 573 |
: |
| 574 | 574 |
} |
| 575 | 575 |
|
| 576 |
+function configure_cinder_internal_tenant {
|
|
| 577 |
+ # Re-use the Cinder service account for simplicity. |
|
| 578 |
+ iniset $CINDER_CONF DEFAULT cinder_internal_tenant_project_id $(get_or_create_project $SERVICE_PROJECT_NAME) |
|
| 579 |
+ iniset $CINDER_CONF DEFAULT cinder_internal_tenant_user_id $(get_or_create_user "cinder") |
|
| 580 |
+} |
|
| 581 |
+ |
|
| 582 |
+function configure_cinder_image_volume_cache {
|
|
| 583 |
+ # Expect CINDER_CACHE_ENABLED_FOR_BACKENDS to be a list of backends |
|
| 584 |
+ # similar to CINDER_ENABLED_BACKENDS with NAME:TYPE where NAME will |
|
| 585 |
+ # be the backend specific configuration stanza in cinder.conf. |
|
| 586 |
+ for be in ${CINDER_CACHE_ENABLED_FOR_BACKENDS//,/ }; do
|
|
| 587 |
+ local be_name=${be##*:}
|
|
| 588 |
+ |
|
| 589 |
+ iniset $CINDER_CONF $be_name image_volume_cache_enabled $CINDER_IMG_CACHE_ENABLED |
|
| 590 |
+ |
|
| 591 |
+ if [[ -n $CINDER_IMG_CACHE_SIZE_GB ]]; then |
|
| 592 |
+ iniset $CINDER_CONF $be_name image_volume_cache_max_size_gb $CINDER_IMG_CACHE_SIZE_GB |
|
| 593 |
+ fi |
|
| 594 |
+ |
|
| 595 |
+ if [[ -n $CINDER_IMG_CACHE_SIZE_COUNT ]]; then |
|
| 596 |
+ iniset $CINDER_CONF $be_name image_volume_cache_max_count $CINDER_IMG_CACHE_SIZE_COUNT |
|
| 597 |
+ fi |
|
| 598 |
+ done |
|
| 599 |
+} |
|
| 600 |
+ |
|
| 576 | 601 |
|
| 577 | 602 |
# Restore xtrace |
| 578 | 603 |
$_XTRACE_CINDER |