From 2fd5e00ce51146f376f4d0aae712c650ebc6f6ed Mon Sep 17 00:00:00 2001 From: Seif Lotfy Date: Sun, 14 Jul 2013 23:05:44 +0000 Subject: [PATCH] Mark methods used in class only with prefix "_" In the swift driver the three methods prepare_nbackup, backup_chunk and finalize_backup are used internally in the class only and are not meant to be used from outside. Thus marked with prefix "_" Change-Id: Idf3a75f2e799c16b1442a349e0724d3e5af2795a --- cinder/backup/drivers/swift.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/cinder/backup/drivers/swift.py b/cinder/backup/drivers/swift.py index f4146f50c..b243d32b7 100644 --- a/cinder/backup/drivers/swift.py +++ b/cinder/backup/drivers/swift.py @@ -223,7 +223,7 @@ class SwiftBackupDriver(BackupDriver): LOG.debug(_('_read_metadata finished (%s)') % metadata) return metadata - def prepare_backup(self, backup): + def _prepare_backup(self, backup): """Prepare the backup process and return the backup metadata""" backup_id = backup['id'] volume_id = backup['volume_id'] @@ -257,7 +257,7 @@ class SwiftBackupDriver(BackupDriver): object_meta = {'id': 1, 'list': [], 'prefix': object_prefix} return object_meta, container - def backup_chunk(self, backup, container, data, data_offset, object_meta): + def _backup_chunk(self, backup, container, data, data_offset, object_meta): """Backup data chunk based on the object metadata and offset""" object_prefix = object_meta['prefix'] object_list = object_meta['list'] @@ -311,7 +311,7 @@ class SwiftBackupDriver(BackupDriver): LOG.debug(_('Calling eventlet.sleep(0)')) eventlet.sleep(0) - def finalize_backup(self, backup, container, object_meta): + def _finalize_backup(self, backup, container, object_meta): """Finalize the backup by updating its metadata on Swift""" object_list = object_meta['list'] object_id = object_meta['id'] @@ -328,15 +328,15 @@ class SwiftBackupDriver(BackupDriver): def backup(self, backup, volume_file): """Backup the given volume to swift using the given backup metadata.""" - object_meta, container = self.prepare_backup(backup) + object_meta, container = self._prepare_backup(backup) while True: data = volume_file.read(self.data_block_size_bytes) data_offset = volume_file.tell() if data == '': break - self.backup_chunk(backup, container, data, - data_offset, object_meta) - self.finalize_backup(backup, container, object_meta) + self._backup_chunk(backup, container, data, + data_offset, object_meta) + self._finalize_backup(backup, container, object_meta) def _restore_v1(self, backup, volume_id, metadata, volume_file): """Restore a v1 swift volume backup from swift.""" -- 2.45.2