From 179f54ce60d5fe5f92db34150593dacf97c8c5ba Mon Sep 17 00:00:00 2001 From: Matt Thompson Date: Wed, 29 Apr 2015 09:53:43 +0100 Subject: [PATCH] Update cinder.conf for cinder-backup This change updates the way we write cinder.conf when cinder backups are enabled. If cinder_service_backup_swift_auth is set to 'per_user', we do not set any url/user/key/tenant options in the config. However, if cinder_service_backup_swift_auth is set to 'single_user' then all auth-related options will be written. Some additional variables were added to allow 'single_user' to work properly. Note that backup_swift_url is actually the swift storage URL if using 'per_user', or your auth URL if using 'single_user'. Partial-bug: #1399386 Change-Id: Ia9d2e140d629b1f7b4c668d2f6041f3c440ab826 --- defaults/main.yml | 21 ++++++++++++--------- templates/cinder.conf.j2 | 10 +++++++--- 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index 5da26917..524bb41d 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -80,19 +80,22 @@ cinder_service_v2_internalurl: "{{ cinder_service_internaluri }}/v2/%(tenant_id) ## Keystone authentication middleware cinder_keystone_auth_plugin: password -## In order to enable the cinder backup you MUST set ``cinder_backup_program_enabled`` to "true" -## Additionally the configuration section will not be put in the `cinder.conf` file unless the -## following variables are defined: -# * cinder_service_backup_swift_user -# * cinder_service_backup_swift_user -# * cinder_service_backup_swift_key +## In order to enable the cinder backup you MUST set ``cinder_service_backup_program_enabled`` to "true" cinder_service_backup_program_enabled: false cinder_service_backup_program_name: cinder-backup cinder_service_backup_driver: cinder.backup.drivers.swift -cinder_service_backup_swift_url: http://127.0.0.1:8080/v1/AUTH -cinder_service_backup_swift_user: admin -cinder_service_backup_swift_key: secrete +# cinder_service_backup_swift_auth: Options include 'per_user' or 'single_user', we default to +# 'per_user' so that backups are saved to a user's swift account. cinder_service_backup_swift_auth: per_user +# cinder_service_backup_swift_url: This is your swift storage url when using 'per_user', or keystone +# endpoint when using 'single_user'. When using 'per_user', you +# can leave this as empty or as None to allow cinder-backup to +# obtain storage url from environment. +cinder_service_backup_swift_url: +cinder_service_backup_swift_auth_version: 2 +cinder_service_backup_swift_user: +cinder_service_backup_swift_tenant: +cinder_service_backup_swift_key: cinder_service_backup_swift_container: volumebackups cinder_service_backup_swift_object_size: 52428800 cinder_service_backup_swift_retry_attempts: 3 diff --git a/templates/cinder.conf.j2 b/templates/cinder.conf.j2 index 1dd900e9..228206ba 100644 --- a/templates/cinder.conf.j2 +++ b/templates/cinder.conf.j2 @@ -21,22 +21,26 @@ enable_v2_api = {{ cinder_enable_v2_api }} {% if inventory_hostname in groups['cinder_volume'] %} {% if cinder_service_backup_program_enabled == true %} -{% if cinder_service_backup_swift_url is defined and cinder_service_backup_swift_user is defined and cinder_service_backup_swift_key is defined %} ## Cinder Backup backup_driver = {{ cinder_service_backup_driver }} -backup_swift_url = {{ cinder_service_backup_swift_url }} +{% if cinder_service_backup_driver == 'cinder.backup.drivers.swift' %} backup_swift_auth = {{ cinder_service_backup_swift_auth }} +{% if cinder_service_backup_swift_auth == 'single_user' %} +backup_swift_url = {{ cinder_service_backup_swift_url }} backup_swift_user = {{ cinder_service_backup_swift_user }} +backup_swift_tenant = {{ cinder_service_backup_swift_tenant }} backup_swift_key = {{ cinder_service_backup_swift_key }} +backup_swift_auth_version = {{ cinder_service_backup_swift_auth_version }} +{% endif %} backup_swift_container = {{ cinder_service_backup_swift_container }} backup_swift_object_size = {{ cinder_service_backup_swift_object_size }} backup_swift_retry_attempts = {{ cinder_service_backup_swift_retry_attempts }} backup_swift_retry_backoff = {{ cinder_service_backup_swift_retry_backoff }} +{% endif %} backup_compression_algorithm = {{ cinder_service_backup_compression_algorithm }} backup_metadata_version = {{ cinder_service_backup_metadata_version }} {% endif %} {% endif %} -{% endif %} ## RabbitMQ rpc_backend = {{ cinder_rpc_backend }}