From bc7a4b7c9a9cd2968c7a607be5f3aea0630e2509 Mon Sep 17 00:00:00 2001 From: Ivan Kolodyazhny Date: Mon, 19 Jun 2017 17:02:11 +0300 Subject: [PATCH] Rename DB Driver param for backup drivers to 'db' This change makes DB Driver param the same for backup drivers as for volume drivers. We'll need this change because managers pass params for drivers __init__ methods via keywords, not via positional arguments. Change-Id: I024d916eef4c5a3564af7b68ffc7621596eb54be Related-Blueprint: generic-backup-implementation --- cinder/backup/api.py | 4 ++-- cinder/backup/chunkeddriver.py | 4 ++-- cinder/backup/driver.py | 10 +++++----- cinder/backup/drivers/ceph.py | 4 ++-- cinder/backup/drivers/glusterfs.py | 2 +- cinder/backup/drivers/google.py | 4 ++-- cinder/backup/drivers/nfs.py | 2 +- cinder/backup/drivers/posix.py | 4 ++-- cinder/backup/drivers/swift.py | 4 ++-- cinder/backup/drivers/tsm.py | 4 ++-- 10 files changed, 21 insertions(+), 21 deletions(-) diff --git a/cinder/backup/api.py b/cinder/backup/api.py index 798b9e5bb43..84a910a54ab 100644 --- a/cinder/backup/api.py +++ b/cinder/backup/api.py @@ -67,10 +67,10 @@ def check_policy(context, action): class API(base.Base): """API for interacting with the volume backup manager.""" - def __init__(self, db_driver=None): + def __init__(self, db=None): self.backup_rpcapi = backup_rpcapi.BackupAPI() self.volume_api = cinder.volume.API() - super(API, self).__init__(db_driver) + super(API, self).__init__(db) def get(self, context, backup_id): check_policy(context, 'get') diff --git a/cinder/backup/chunkeddriver.py b/cinder/backup/chunkeddriver.py index ba25992786c..196b4f1827d 100644 --- a/cinder/backup/chunkeddriver.py +++ b/cinder/backup/chunkeddriver.py @@ -90,8 +90,8 @@ class ChunkedBackupDriver(driver.BackupDriver): def __init__(self, context, chunk_size_bytes, sha_block_size_bytes, backup_default_container, enable_progress_timer, - db_driver=None): - super(ChunkedBackupDriver, self).__init__(context, db_driver) + db=None): + super(ChunkedBackupDriver, self).__init__(context, db) self.chunk_size_bytes = chunk_size_bytes self.sha_block_size_bytes = sha_block_size_bytes self.backup_default_container = backup_default_container diff --git a/cinder/backup/driver.py b/cinder/backup/driver.py index f6e1464e47b..1513124a5a4 100644 --- a/cinder/backup/driver.py +++ b/cinder/backup/driver.py @@ -54,8 +54,8 @@ class BackupMetadataAPI(base.Base): TYPE_TAG_VOL_META = 'volume-metadata' TYPE_TAG_VOL_GLANCE_META = 'volume-glance-metadata' - def __init__(self, context, db_driver=None): - super(BackupMetadataAPI, self).__init__(db_driver) + def __init__(self, context, db=None): + super(BackupMetadataAPI, self).__init__(db) self.context = context @staticmethod @@ -347,10 +347,10 @@ class BackupMetadataAPI(base.Base): @six.add_metaclass(abc.ABCMeta) class BackupDriver(base.Base): - def __init__(self, context, db_driver=None): - super(BackupDriver, self).__init__(db_driver) + def __init__(self, context, db=None): + super(BackupDriver, self).__init__(db) self.context = context - self.backup_meta_api = BackupMetadataAPI(context, db_driver) + self.backup_meta_api = BackupMetadataAPI(context, db) # This flag indicates if backup driver supports force # deletion. So it should be set to True if the driver that inherits # from BackupDriver supports the force deletion function. diff --git a/cinder/backup/drivers/ceph.py b/cinder/backup/drivers/ceph.py index a9524d11602..22a4adc20e8 100644 --- a/cinder/backup/drivers/ceph.py +++ b/cinder/backup/drivers/ceph.py @@ -170,8 +170,8 @@ class CephBackupDriver(driver.BackupDriver): gain. """ - def __init__(self, context, db_driver=None, execute=None): - super(CephBackupDriver, self).__init__(context, db_driver) + def __init__(self, context, db=None, execute=None): + super(CephBackupDriver, self).__init__(context, db) self.rbd = rbd self.rados = rados self.chunk_size = CONF.backup_ceph_chunk_size diff --git a/cinder/backup/drivers/glusterfs.py b/cinder/backup/drivers/glusterfs.py index c8bb548b0c6..807c06ba5f4 100644 --- a/cinder/backup/drivers/glusterfs.py +++ b/cinder/backup/drivers/glusterfs.py @@ -46,7 +46,7 @@ CONF.register_opts(glusterfsbackup_service_opts) class GlusterfsBackupDriver(posix.PosixBackupDriver): """Provides backup, restore and delete using GlusterFS repository.""" - def __init__(self, context, db_driver=None): + def __init__(self, context, db=None): self._check_configuration() self.backup_mount_point_base = CONF.glusterfs_backup_mount_point self.backup_share = CONF.glusterfs_backup_share diff --git a/cinder/backup/drivers/google.py b/cinder/backup/drivers/google.py index 3f67e9a6b63..1d61c998e94 100644 --- a/cinder/backup/drivers/google.py +++ b/cinder/backup/drivers/google.py @@ -119,7 +119,7 @@ def gcs_logger(func): class GoogleBackupDriver(chunkeddriver.ChunkedBackupDriver): """Provides backup, restore and delete of backup objects within GCS.""" - def __init__(self, context, db_driver=None): + def __init__(self, context, db=None): self.check_gcs_options() backup_bucket = CONF.backup_gcs_bucket backup_credential = CONF.backup_gcs_credential_file @@ -131,7 +131,7 @@ class GoogleBackupDriver(chunkeddriver.ChunkedBackupDriver): sha_block_size_bytes, backup_bucket, enable_progress_timer, - db_driver) + db) credentials = client.GoogleCredentials.from_stream(backup_credential) self.reader_chunk_size = CONF.backup_gcs_reader_chunk_size self.writer_chunk_size = CONF.backup_gcs_writer_chunk_size diff --git a/cinder/backup/drivers/nfs.py b/cinder/backup/drivers/nfs.py index 1a7b4fd5689..3e658c67879 100644 --- a/cinder/backup/drivers/nfs.py +++ b/cinder/backup/drivers/nfs.py @@ -49,7 +49,7 @@ CONF.register_opts(nfsbackup_service_opts) class NFSBackupDriver(posix.PosixBackupDriver): """Provides backup, restore and delete using NFS supplied repository.""" - def __init__(self, context, db_driver=None): + def __init__(self, context, db=None): self._check_configuration() self.backup_mount_point_base = CONF.backup_mount_point_base self.backup_share = CONF.backup_share diff --git a/cinder/backup/drivers/posix.py b/cinder/backup/drivers/posix.py index d6accc0358c..3d84b8a5c41 100644 --- a/cinder/backup/drivers/posix.py +++ b/cinder/backup/drivers/posix.py @@ -69,7 +69,7 @@ CONF.register_opts(posixbackup_service_opts) class PosixBackupDriver(chunkeddriver.ChunkedBackupDriver): """Provides backup, restore and delete using a Posix file system.""" - def __init__(self, context, db_driver=None, backup_path=None): + def __init__(self, context, db=None, backup_path=None): chunk_size_bytes = CONF.backup_file_size sha_block_size_bytes = CONF.backup_sha_block_size_bytes backup_default_container = CONF.backup_container @@ -78,7 +78,7 @@ class PosixBackupDriver(chunkeddriver.ChunkedBackupDriver): sha_block_size_bytes, backup_default_container, enable_progress_timer, - db_driver) + db) self.backup_path = backup_path if not backup_path: self.backup_path = CONF.backup_posix_path diff --git a/cinder/backup/drivers/swift.py b/cinder/backup/drivers/swift.py index 5d9e1cb245d..f67be62ce35 100644 --- a/cinder/backup/drivers/swift.py +++ b/cinder/backup/drivers/swift.py @@ -143,7 +143,7 @@ CONF.register_opts(swiftbackup_service_opts) class SwiftBackupDriver(chunkeddriver.ChunkedBackupDriver): """Provides backup, restore and delete of backup objects within Swift.""" - def __init__(self, context, db_driver=None): + def __init__(self, context, db=None): chunk_size_bytes = CONF.backup_swift_object_size sha_block_size_bytes = CONF.backup_swift_block_size backup_default_container = CONF.backup_swift_container @@ -152,7 +152,7 @@ class SwiftBackupDriver(chunkeddriver.ChunkedBackupDriver): sha_block_size_bytes, backup_default_container, enable_progress_timer, - db_driver) + db) self.swift_attempts = CONF.backup_swift_retry_attempts self.swift_backoff = CONF.backup_swift_retry_backoff self.backup_swift_auth_insecure = CONF.backup_swift_auth_insecure diff --git a/cinder/backup/drivers/tsm.py b/cinder/backup/drivers/tsm.py index ca306e4f79c..8762f6bd6fa 100644 --- a/cinder/backup/drivers/tsm.py +++ b/cinder/backup/drivers/tsm.py @@ -266,8 +266,8 @@ class TSMBackupDriver(driver.BackupDriver): DRIVER_VERSION = '1.0.0' - def __init__(self, context, db_driver=None): - super(TSMBackupDriver, self).__init__(context, db_driver) + def __init__(self, context, db=None): + super(TSMBackupDriver, self).__init__(context, db) self.tsm_password = CONF.backup_tsm_password self.volume_prefix = CONF.backup_tsm_volume_prefix