当前位置: 首页>>代码示例>>Python>>正文


Python SwiftBackupDriver.backup方法代码示例

本文整理汇总了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)
开发者ID:Qeas,项目名称:cinder,代码行数:9,代码来源:test_backup_swift.py

示例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')
开发者ID:Qeas,项目名称:cinder,代码行数:10,代码来源:test_backup_swift.py

示例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)
开发者ID:Qeas,项目名称:cinder,代码行数:11,代码来源:test_backup_swift.py

示例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)
开发者ID:Qeas,项目名称:cinder,代码行数:40,代码来源:test_backup_swift.py


注:本文中的cinder.backup.drivers.swift.SwiftBackupDriver.backup方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。