]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Enable Swift backup driver for auth 2.0
authorRonen Kat <ronenkat@il.ibm.com>
Thu, 7 Aug 2014 14:00:53 +0000 (17:00 +0300)
committerRonen Kat <ronenkat@il.ibm.com>
Sun, 10 Aug 2014 13:24:52 +0000 (13:24 +0000)
This patch adds support for Swift auth 2.0 to the cinder-backup
Swift driver.

DocImpact

Change-Id: I99585661792420e363b5259c9ed45a853a939a74
Closes-Bug: #1354801

cinder/backup/drivers/swift.py
etc/cinder/cinder.conf.sample

index 1c1751f31459747c68f0dbe753c599a1da134b8a..eedc723614ff7de008634af91159c44d4045a97c 100644 (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,
index 25c4dcb67714b2a3c4a8f190465a501e707aeee5..31fe4584a5b39a38b3edfd8071d32152ac4b5edc 100644 (file)
 # 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>