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
This commit is contained in:
Ivan Kolodyazhny 2017-06-19 17:02:11 +03:00
parent 1fa43b8f79
commit bc7a4b7c9a
10 changed files with 21 additions and 21 deletions

View File

@ -67,10 +67,10 @@ def check_policy(context, action):
class API(base.Base): class API(base.Base):
"""API for interacting with the volume backup manager.""" """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.backup_rpcapi = backup_rpcapi.BackupAPI()
self.volume_api = cinder.volume.API() self.volume_api = cinder.volume.API()
super(API, self).__init__(db_driver) super(API, self).__init__(db)
def get(self, context, backup_id): def get(self, context, backup_id):
check_policy(context, 'get') check_policy(context, 'get')

View File

@ -90,8 +90,8 @@ class ChunkedBackupDriver(driver.BackupDriver):
def __init__(self, context, chunk_size_bytes, sha_block_size_bytes, def __init__(self, context, chunk_size_bytes, sha_block_size_bytes,
backup_default_container, enable_progress_timer, backup_default_container, enable_progress_timer,
db_driver=None): db=None):
super(ChunkedBackupDriver, self).__init__(context, db_driver) super(ChunkedBackupDriver, self).__init__(context, db)
self.chunk_size_bytes = chunk_size_bytes self.chunk_size_bytes = chunk_size_bytes
self.sha_block_size_bytes = sha_block_size_bytes self.sha_block_size_bytes = sha_block_size_bytes
self.backup_default_container = backup_default_container self.backup_default_container = backup_default_container

View File

@ -54,8 +54,8 @@ class BackupMetadataAPI(base.Base):
TYPE_TAG_VOL_META = 'volume-metadata' TYPE_TAG_VOL_META = 'volume-metadata'
TYPE_TAG_VOL_GLANCE_META = 'volume-glance-metadata' TYPE_TAG_VOL_GLANCE_META = 'volume-glance-metadata'
def __init__(self, context, db_driver=None): def __init__(self, context, db=None):
super(BackupMetadataAPI, self).__init__(db_driver) super(BackupMetadataAPI, self).__init__(db)
self.context = context self.context = context
@staticmethod @staticmethod
@ -347,10 +347,10 @@ class BackupMetadataAPI(base.Base):
@six.add_metaclass(abc.ABCMeta) @six.add_metaclass(abc.ABCMeta)
class BackupDriver(base.Base): class BackupDriver(base.Base):
def __init__(self, context, db_driver=None): def __init__(self, context, db=None):
super(BackupDriver, self).__init__(db_driver) super(BackupDriver, self).__init__(db)
self.context = context 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 # This flag indicates if backup driver supports force
# deletion. So it should be set to True if the driver that inherits # deletion. So it should be set to True if the driver that inherits
# from BackupDriver supports the force deletion function. # from BackupDriver supports the force deletion function.

View File

@ -170,8 +170,8 @@ class CephBackupDriver(driver.BackupDriver):
gain. gain.
""" """
def __init__(self, context, db_driver=None, execute=None): def __init__(self, context, db=None, execute=None):
super(CephBackupDriver, self).__init__(context, db_driver) super(CephBackupDriver, self).__init__(context, db)
self.rbd = rbd self.rbd = rbd
self.rados = rados self.rados = rados
self.chunk_size = CONF.backup_ceph_chunk_size self.chunk_size = CONF.backup_ceph_chunk_size

View File

@ -46,7 +46,7 @@ CONF.register_opts(glusterfsbackup_service_opts)
class GlusterfsBackupDriver(posix.PosixBackupDriver): class GlusterfsBackupDriver(posix.PosixBackupDriver):
"""Provides backup, restore and delete using GlusterFS repository.""" """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._check_configuration()
self.backup_mount_point_base = CONF.glusterfs_backup_mount_point self.backup_mount_point_base = CONF.glusterfs_backup_mount_point
self.backup_share = CONF.glusterfs_backup_share self.backup_share = CONF.glusterfs_backup_share

View File

@ -119,7 +119,7 @@ def gcs_logger(func):
class GoogleBackupDriver(chunkeddriver.ChunkedBackupDriver): class GoogleBackupDriver(chunkeddriver.ChunkedBackupDriver):
"""Provides backup, restore and delete of backup objects within GCS.""" """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() self.check_gcs_options()
backup_bucket = CONF.backup_gcs_bucket backup_bucket = CONF.backup_gcs_bucket
backup_credential = CONF.backup_gcs_credential_file backup_credential = CONF.backup_gcs_credential_file
@ -131,7 +131,7 @@ class GoogleBackupDriver(chunkeddriver.ChunkedBackupDriver):
sha_block_size_bytes, sha_block_size_bytes,
backup_bucket, backup_bucket,
enable_progress_timer, enable_progress_timer,
db_driver) db)
credentials = client.GoogleCredentials.from_stream(backup_credential) credentials = client.GoogleCredentials.from_stream(backup_credential)
self.reader_chunk_size = CONF.backup_gcs_reader_chunk_size self.reader_chunk_size = CONF.backup_gcs_reader_chunk_size
self.writer_chunk_size = CONF.backup_gcs_writer_chunk_size self.writer_chunk_size = CONF.backup_gcs_writer_chunk_size

View File

@ -49,7 +49,7 @@ CONF.register_opts(nfsbackup_service_opts)
class NFSBackupDriver(posix.PosixBackupDriver): class NFSBackupDriver(posix.PosixBackupDriver):
"""Provides backup, restore and delete using NFS supplied repository.""" """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._check_configuration()
self.backup_mount_point_base = CONF.backup_mount_point_base self.backup_mount_point_base = CONF.backup_mount_point_base
self.backup_share = CONF.backup_share self.backup_share = CONF.backup_share

View File

@ -69,7 +69,7 @@ CONF.register_opts(posixbackup_service_opts)
class PosixBackupDriver(chunkeddriver.ChunkedBackupDriver): class PosixBackupDriver(chunkeddriver.ChunkedBackupDriver):
"""Provides backup, restore and delete using a Posix file system.""" """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 chunk_size_bytes = CONF.backup_file_size
sha_block_size_bytes = CONF.backup_sha_block_size_bytes sha_block_size_bytes = CONF.backup_sha_block_size_bytes
backup_default_container = CONF.backup_container backup_default_container = CONF.backup_container
@ -78,7 +78,7 @@ class PosixBackupDriver(chunkeddriver.ChunkedBackupDriver):
sha_block_size_bytes, sha_block_size_bytes,
backup_default_container, backup_default_container,
enable_progress_timer, enable_progress_timer,
db_driver) db)
self.backup_path = backup_path self.backup_path = backup_path
if not backup_path: if not backup_path:
self.backup_path = CONF.backup_posix_path self.backup_path = CONF.backup_posix_path

View File

@ -143,7 +143,7 @@ CONF.register_opts(swiftbackup_service_opts)
class SwiftBackupDriver(chunkeddriver.ChunkedBackupDriver): class SwiftBackupDriver(chunkeddriver.ChunkedBackupDriver):
"""Provides backup, restore and delete of backup objects within Swift.""" """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 chunk_size_bytes = CONF.backup_swift_object_size
sha_block_size_bytes = CONF.backup_swift_block_size sha_block_size_bytes = CONF.backup_swift_block_size
backup_default_container = CONF.backup_swift_container backup_default_container = CONF.backup_swift_container
@ -152,7 +152,7 @@ class SwiftBackupDriver(chunkeddriver.ChunkedBackupDriver):
sha_block_size_bytes, sha_block_size_bytes,
backup_default_container, backup_default_container,
enable_progress_timer, enable_progress_timer,
db_driver) db)
self.swift_attempts = CONF.backup_swift_retry_attempts self.swift_attempts = CONF.backup_swift_retry_attempts
self.swift_backoff = CONF.backup_swift_retry_backoff self.swift_backoff = CONF.backup_swift_retry_backoff
self.backup_swift_auth_insecure = CONF.backup_swift_auth_insecure self.backup_swift_auth_insecure = CONF.backup_swift_auth_insecure

View File

@ -266,8 +266,8 @@ class TSMBackupDriver(driver.BackupDriver):
DRIVER_VERSION = '1.0.0' DRIVER_VERSION = '1.0.0'
def __init__(self, context, db_driver=None): def __init__(self, context, db=None):
super(TSMBackupDriver, self).__init__(context, db_driver) super(TSMBackupDriver, self).__init__(context, db)
self.tsm_password = CONF.backup_tsm_password self.tsm_password = CONF.backup_tsm_password
self.volume_prefix = CONF.backup_tsm_volume_prefix self.volume_prefix = CONF.backup_tsm_volume_prefix