]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Add CA cert option to backups swift driver
authorFrancis Moorehead <francis.moorehead@hp.com>
Fri, 23 Jan 2015 13:13:38 +0000 (13:13 +0000)
committerDuncan Thomas <duncan.thomas@gmail.com>
Wed, 15 Apr 2015 10:52:34 +0000 (11:52 +0100)
Add the option in volume backups swift driver
to specify a CA certificate file

DocImpact: Add the option in volume backups swift driver to
specify a CA certificate file

Closes-Bug: 1413945

Change-Id: Ibcfe220d35cbb5369679a1ff51fffd41f16c9909

cinder/backup/drivers/swift.py

index 7d0ba656cc58c379105beec4e2841a21c0e5defb..70d3d263cd2b00e99cec79101dced6143859fc71 100644 (file)
@@ -33,6 +33,8 @@
 :backup_compression_algorithm: Compression algorithm to use for volume
                                backups. Supported options are:
                                None (to disable), zlib and bz2 (default: zlib)
+:backup_swift_ca_cert_file: The location of the CA certificate file to use
+                            for swift client requests (default: None)
 """
 
 import hashlib
@@ -101,6 +103,10 @@ swiftbackup_service_opts = [
                      'progress notifications to Ceilometer when backing '
                      'up the volume to the Swift backend storage. The '
                      'default value is True to enable the timer.'),
+    cfg.StrOpt('backup_swift_ca_cert_file',
+               default=None,
+               help='Location of the CA certificate file to use for swift '
+                    'client requests.'),
 ]
 
 CONF = cfg.CONF
@@ -160,12 +166,14 @@ class SwiftBackupDriver(chunkeddriver.ChunkedBackupDriver):
                 user=CONF.backup_swift_user,
                 key=CONF.backup_swift_key,
                 retries=self.swift_attempts,
-                starting_backoff=self.swift_backoff)
+                starting_backoff=self.swift_backoff,
+                cacert=CONF.backup_swift_ca_cert_file)
         else:
             self.conn = swift.Connection(retries=self.swift_attempts,
                                          preauthurl=self.swift_url,
                                          preauthtoken=self.context.auth_token,
-                                         starting_backoff=self.swift_backoff)
+                                         starting_backoff=self.swift_backoff,
+                                         cacert=CONF.backup_swift_ca_cert_file)
 
     class SwiftObjectWriter(object):
         def __init__(self, container, object_name, conn):