Enable Swift backup driver for auth 2.0

This patch adds support for Swift auth 2.0 to the cinder-backup
Swift driver.

DocImpact

Change-Id: I99585661792420e363b5259c9ed45a853a939a74
Closes-Bug: #1354801
This commit is contained in:
Ronen Kat 2014-08-07 17:00:53 +03:00
parent 79b6b98f21
commit a00f41a02b
2 changed files with 24 additions and 5 deletions

View File

@ -58,6 +58,14 @@ swiftbackup_service_opts = [
cfg.StrOpt('backup_swift_auth',
default='per_user',
help='Swift authentication mechanism'),
cfg.StrOpt('backup_swift_auth_version',
default='1',
help='Swift authentication version. Specify "1" for auth 1.0'
', or "2" for auth 2.0'),
cfg.StrOpt('backup_swift_tenant',
default=None,
help='Swift tenant/account name. Required when connecting'
' to an auth 2.0 system'),
cfg.StrOpt('backup_swift_user',
default=None,
help='Swift user name'),
@ -125,11 +133,14 @@ class SwiftBackupDriver(BackupDriver):
"but %(param)s not set")
% {'param': 'backup_swift_user'})
raise exception.ParameterNotFound(param='backup_swift_user')
self.conn = swift.Connection(authurl=CONF.backup_swift_url,
user=CONF.backup_swift_user,
key=CONF.backup_swift_key,
retries=self.swift_attempts,
starting_backoff=self.swift_backoff)
self.conn = swift.Connection(
authurl=CONF.backup_swift_url,
auth_version=CONF.backup_swift_auth_version,
tenant_name=CONF.backup_swift_tenant,
user=CONF.backup_swift_user,
key=CONF.backup_swift_key,
retries=self.swift_attempts,
starting_backoff=self.swift_backoff)
else:
self.conn = swift.Connection(retries=self.swift_attempts,
preauthurl=self.swift_url,

View File

@ -409,6 +409,14 @@
# Swift authentication mechanism (string value)
#backup_swift_auth=per_user
# Swift authentication version. Specify "1" for auth 1.0, or
# "2" for auth 2.0 (string value)
#backup_swift_auth_version=1
# Swift tenant/account name. Required when connecting to an
# auth 2.0 system (string value)
#backup_swift_tenant=<None>
# Swift user name (string value)
#backup_swift_user=<None>