本文整理汇总了Python中cinder.backup.drivers.swift.SwiftBackupDriver.backup方法的典型用法代码示例。如果您正苦于以下问题:Python SwiftBackupDriver.backup方法的具体用法?Python SwiftBackupDriver.backup怎么用?Python SwiftBackupDriver.backup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cinder.backup.drivers.swift.SwiftBackupDriver
的用法示例。
在下文中一共展示了SwiftBackupDriver.backup方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_backup_zlib
# 需要导入模块: from cinder.backup.drivers.swift import SwiftBackupDriver [as 别名]
# 或者: from cinder.backup.drivers.swift.SwiftBackupDriver import backup [as 别名]
def test_backup_zlib(self):
self._create_backup_db_entry()
self.flags(backup_compression_algorithm='zlib')
service = SwiftBackupDriver(self.ctxt)
self.volume_file.seek(0)
backup = db.backup_get(self.ctxt, 123)
service.backup(backup, self.volume_file)
示例2: test_backup_default_container
# 需要导入模块: from cinder.backup.drivers.swift import SwiftBackupDriver [as 别名]
# 或者: from cinder.backup.drivers.swift.SwiftBackupDriver import backup [as 别名]
def test_backup_default_container(self):
self._create_backup_db_entry(container=None)
service = SwiftBackupDriver(self.ctxt)
self.volume_file.seek(0)
backup = db.backup_get(self.ctxt, 123)
service.backup(backup, self.volume_file)
backup = db.backup_get(self.ctxt, 123)
self.assertEqual(backup['container'], 'volumebackups')
示例3: test_backup_custom_container
# 需要导入模块: from cinder.backup.drivers.swift import SwiftBackupDriver [as 别名]
# 或者: from cinder.backup.drivers.swift.SwiftBackupDriver import backup [as 别名]
def test_backup_custom_container(self):
container_name = 'fake99'
self._create_backup_db_entry(container=container_name)
service = SwiftBackupDriver(self.ctxt)
self.volume_file.seek(0)
backup = db.backup_get(self.ctxt, 123)
service.backup(backup, self.volume_file)
backup = db.backup_get(self.ctxt, 123)
self.assertEqual(backup['container'], container_name)
示例4: test_backup_default_container_notify
# 需要导入模块: from cinder.backup.drivers.swift import SwiftBackupDriver [as 别名]
# 或者: from cinder.backup.drivers.swift.SwiftBackupDriver import backup [as 别名]
def test_backup_default_container_notify(self, _send_progress,
_send_progress_end):
self._create_backup_db_entry(container=None)
# If the backup_object_number_per_notification is set to 1,
# the _send_progress method will be called for sure.
CONF.set_override("backup_object_number_per_notification", 1)
CONF.set_override("backup_swift_enable_progress_timer", False)
service = SwiftBackupDriver(self.ctxt)
self.volume_file.seek(0)
backup = db.backup_get(self.ctxt, 123)
service.backup(backup, self.volume_file)
self.assertTrue(_send_progress.called)
self.assertTrue(_send_progress_end.called)
# If the backup_object_number_per_notification is increased to
# another value, the _send_progress method will not be called.
_send_progress.reset_mock()
_send_progress_end.reset_mock()
CONF.set_override("backup_object_number_per_notification", 10)
service = SwiftBackupDriver(self.ctxt)
self.volume_file.seek(0)
backup = db.backup_get(self.ctxt, 123)
service.backup(backup, self.volume_file)
self.assertFalse(_send_progress.called)
self.assertTrue(_send_progress_end.called)
# If the timer is enabled, the _send_progress will be called,
# since the timer can trigger the progress notification.
_send_progress.reset_mock()
_send_progress_end.reset_mock()
CONF.set_override("backup_object_number_per_notification", 10)
CONF.set_override("backup_swift_enable_progress_timer", True)
service = SwiftBackupDriver(self.ctxt)
self.volume_file.seek(0)
backup = db.backup_get(self.ctxt, 123)
service.backup(backup, self.volume_file)
self.assertTrue(_send_progress.called)
self.assertTrue(_send_progress_end.called)