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


Python FakeLibvirt.open方法代码示例

本文整理汇总了Python中healthnmon.tests.FakeLibvirt.open方法的典型用法代码示例。如果您正苦于以下问题:Python FakeLibvirt.open方法的具体用法?Python FakeLibvirt.open怎么用?Python FakeLibvirt.open使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在healthnmon.tests.FakeLibvirt的用法示例。


在下文中一共展示了FakeLibvirt.open方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: setUp

# 需要导入模块: from healthnmon.tests import FakeLibvirt [as 别名]
# 或者: from healthnmon.tests.FakeLibvirt import open [as 别名]
 def setUp(self):
     self.fakeConn = libvirt.open('qemu:///system')
     self.libvirt_connection_cls = connection.LibvirtConnection
     super(Test_virt_connection, self).setUp()
     self.flags(
         healthnmon_notification_drivers=['healthnmon.notifier.log_notifier']
     )
开发者ID:emonty,项目名称:healthnmon,代码行数:9,代码来源:test_libvirt_connection.py

示例2: setUpClass

# 需要导入模块: from healthnmon.tests import FakeLibvirt [as 别名]
# 或者: from healthnmon.tests.FakeLibvirt import open [as 别名]
 def setUpClass(cls):
     cls.connection = LibvirtConnection(False)
     cls.mox = mox.Mox()
     cls.connection._wrapped_conn = libvirt.open('qemu:///system')
     cls.connection.libvirt = libvirt
     cls.vm_id = '25f04dd3-e924-02b2-9eac-876e3c943262'
     cls.vmhost_id = '1'
开发者ID:emonty,项目名称:healthnmon,代码行数:9,代码来源:test_libvirt_perfdata.py

示例3: setUp

# 需要导入模块: from healthnmon.tests import FakeLibvirt [as 别名]
# 或者: from healthnmon.tests.FakeLibvirt import open [as 别名]
    def setUp(self):
        super(StorageVolumeEventsTest, self).setUp()
        self.connection = LibvirtConnection(False)
        vmHost = VmHost()
        vmHost.set_storageVolumeIds([])
        InventoryCacheManager.update_object_in_cache('1', vmHost)
        self.connection._wrapped_conn = libvirt.open('qemu:///system')
        self.LibvirtStorageVolume = \
            LibvirtStorageVolume(self.connection._wrapped_conn, '1')
        self.LibvirtStorageVolume.vmHost = vmHost
        self.LibvirtStorageVolume.cur_total_storage_size = 0
        self.LibvirtStorageVolume.curr_storage_free = 0
        self.LibvirtStorageVolume.old_total_storage_size = 0
        self.LibvirtStorageVolume.old_storage_free = 0
        self.LibvirtStorageVolume.vmHost.set_id('1')
        self.connection.compute_rmcontext = \
            ComputeRMContext(rmType='KVM', rmIpAddress='10.10.155.165',
                             rmUserName='openstack',
                             rmPassword='password')
        self.flags(healthnmon_notification_drivers=[
            'nova.notifier.test_notifier'])
        test_notifier.NOTIFICATIONS = []
        self.mox.StubOutWithMock(nova_db, 'service_get_all_by_topic')

        nova_db.service_get_all_by_topic(
            mox.IgnoreArg(),
            mox.IgnoreArg()).MultipleTimes().AndReturn(None)
开发者ID:rakrup,项目名称:healthnmon,代码行数:29,代码来源:test_storage_events.py

示例4: test_deregister_libvirt_events

# 需要导入模块: from healthnmon.tests import FakeLibvirt [as 别名]
# 或者: from healthnmon.tests.FakeLibvirt import open [as 别名]
 def test_deregister_libvirt_events(self):
     libvirtEvents = libvirt_event_monitor.LibvirtEvents()
     libvirtEvents.registered = True
     libvirtEvents.call_back_ids['domain_events'] = [1]
     libvirtEvents.libvirt_con = libvirt.open("fake:///system")
     libvirtEvents.deregister_libvirt_events()
     self.mock.VerifyAll()
开发者ID:emonty,项目名称:healthnmon,代码行数:9,代码来源:test_libvirt_events.py

示例5: setUp

# 需要导入模块: from healthnmon.tests import FakeLibvirt [as 别名]
# 或者: from healthnmon.tests.FakeLibvirt import open [as 别名]
 def setUp(self):
     super(NetworkEventsTest, self).setUp()
     self.connection = LibvirtConnection(False)
     self.connection._wrapped_conn = libvirt.open("qemu:///system")
     rm_context = ComputeRMContext(
         rmType="QEMU", rmIpAddress="10.10.155.165", rmUserName="openstack", rmPassword="password"
     )
     InventoryCacheManager.get_all_compute_inventory()["1"] = ComputeInventory(rm_context)
     self.libvirtNetwork = LibvirtNetwork(self.connection._wrapped_conn, "1")
     self.flags(healthnmon_notification_drivers=["nova.notifier.test_notifier"])
     test_notifier.NOTIFICATIONS = []
开发者ID:jessegonzalez,项目名称:healthnmon,代码行数:13,代码来源:test_network_events.py

示例6: setUp

# 需要导入模块: from healthnmon.tests import FakeLibvirt [as 别名]
# 或者: from healthnmon.tests.FakeLibvirt import open [as 别名]
 def setUp(self):
     self.fakeConn = libvirt.open('qemu:///system')
     self.libvirt_connection_cls = connection.LibvirtConnection
     super(Test_virt_connection, self).setUp()
     self.flags(
         healthnmon_notification_drivers=[
             'healthnmon.notifier.log_notifier']
     )
     vmHost = VmHost()
     vmHost.id = '1'
     vmHost.uuid = '1'
     InventoryCacheManager.update_object_in_cache('1', vmHost)
开发者ID:jessegonzalez,项目名称:healthnmon,代码行数:14,代码来源:test_libvirt_connection.py

示例7: setUp

# 需要导入模块: from healthnmon.tests import FakeLibvirt [as 别名]
# 或者: from healthnmon.tests.FakeLibvirt import open [as 别名]
 def setUp(self):
     self.connection = LibvirtConnection(False)
     vmHost = VmHost()
     vmHost.set_storageVolumeIds([])
     InventoryCacheManager.update_object_in_cache('1', vmHost)
     self.connection._wrapped_conn = libvirt.open('qemu:///system')
     self.LibvirtStorageVolume = \
         LibvirtStorageVolume(self.connection._wrapped_conn, '1')
     self.connection.compute_rmcontext = \
         ComputeRMContext(rmType='KVM', rmIpAddress='10.10.155.165',
                          rmUserName='openstack',
                          rmPassword='password')
     self.mock = mox.Mox()
开发者ID:rakrup,项目名称:healthnmon,代码行数:15,代码来源:test_Inventory.py

示例8: setUp

# 需要导入模块: from healthnmon.tests import FakeLibvirt [as 别名]
# 或者: from healthnmon.tests.FakeLibvirt import open [as 别名]
 def setUp(self):
     super(NetworkEventsTest, self).setUp()
     self.connection = LibvirtConnection(False)
     self.connection._wrapped_conn = libvirt.open("qemu:///system")
     rm_context = ComputeRMContext(
         rmType='QEMU', rmIpAddress='10.10.155.165',
         rmUserName='openstack',
         rmPassword='password')
     InventoryCacheManager.get_all_compute_inventory()['1'] = \
         ComputeInventory(rm_context)
     self.libvirtNetwork = LibvirtNetwork(
         self.connection._wrapped_conn, '1')
     self.flags(
         healthnmon_notification_drivers=['nova.notifier.test_notifier'])
     test_notifier.NOTIFICATIONS = []
开发者ID:emonty,项目名称:healthnmon,代码行数:17,代码来源:test_network_events.py

示例9: setUp

# 需要导入模块: from healthnmon.tests import FakeLibvirt [as 别名]
# 或者: from healthnmon.tests.FakeLibvirt import open [as 别名]
 def setUp(self):
     super(test_LibvirtStorage, self).setUp()
     self.connection = LibvirtConnection(False)
     vmHost = VmHost()
     vmHost.set_storageVolumeIds([])
     InventoryCacheManager.update_object_in_cache('1', vmHost)
     self.connection._wrapped_conn = libvirt.open('qemu:///system')
     self.LibvirtStorageVolume = \
         LibvirtStorageVolume(self.connection._wrapped_conn, '1')
     self.connection.compute_rmcontext = \
         ComputeRMContext(rmType='KVM', rmIpAddress='10.10.155.165',
                          rmUserName='openstack',
                          rmPassword='password')
     cfg.CONF.set_override('healthnmon_notification_drivers',
                           ['healthnmon.notifier.log_notifier'])
     self.mock = mox.Mox()
开发者ID:jessegonzalez,项目名称:healthnmon,代码行数:18,代码来源:test_Inventory.py

示例10: setUp

# 需要导入模块: from healthnmon.tests import FakeLibvirt [as 别名]
# 或者: from healthnmon.tests.FakeLibvirt import open [as 别名]
    def setUp(self):
        self.mock = mox.Mox()
        self.connection = LibvirtConnection(False)
        self.connection._wrapped_conn = libvirt.open('qemu:///system')
        vmHost = VmHost()
        InventoryCacheManager.update_object_in_cache('1', vmHost)
        self.connection.compute_rmcontext = \
            ComputeRMContext(rmType='fake', rmIpAddress='10.10.155.165',
                             rmUserName='openstack',
                             rmPassword='password')
        InventoryCacheManager.get_all_compute_inventory()['1'] = \
            ComputeInventory(self.connection.compute_rmcontext)
        self.mock.StubOutWithMock(LibvirtConnection, '_connect')

        self.connection._connect(mox.IgnoreArg(),
                                 mox.IgnoreArg()).AndRaise(libvirt.libvirtError)
        self.mock.ReplayAll()
        self.inventoryMonitor = LibvirtInventoryMonitor()
#        self.libvirtVmHost = LibvirtVmHost(self.connection, '1')
        cfg.CONF.set_override('healthnmon_notification_drivers',
                              ['healthnmon.notifier.log_notifier'])
        self.libvirtInventoryMonitor = LibvirtInventoryMonitor()
开发者ID:emonty,项目名称:healthnmon,代码行数:24,代码来源:test_Inventory.py

示例11: setUp

# 需要导入模块: from healthnmon.tests import FakeLibvirt [as 别名]
# 或者: from healthnmon.tests.FakeLibvirt import open [as 别名]
    def setUp(self):
        super(VmHostEventsTest, self).setUp()
        self.connection = LibvirtConnection(False)
        vmHost = VmHost()
        vmHost.set_virtualMachineIds([])
        InventoryCacheManager.update_object_in_cache('1', vmHost)

        rm_context = ComputeRMContext(
            rmType='QEMU', rmIpAddress='10.10.155.165',
            rmUserName='openstack',
            rmPassword='password')

        InventoryCacheManager.update_object_in_cache('1', vmHost)
        InventoryCacheManager.get_all_compute_inventory()['1'] = \
            ComputeInventory(rm_context)

        self.connection._wrapped_conn = libvirt.open('qemu:///system')
        libvirtEvents = LibvirtEvents()
        self.libvirtVmHost = LibvirtVmHost(
            self.connection._wrapped_conn, '1', libvirtEvents)
        self.connection.compute_rmcontext = rm_context
        self.flags(healthnmon_notification_drivers=[
            'nova.notifier.test_notifier'])
        test_notifier.NOTIFICATIONS = []
开发者ID:rakrup,项目名称:healthnmon,代码行数:26,代码来源:test_host_events.py

示例12: test_deregister_libvirt_domain_events

# 需要导入模块: from healthnmon.tests import FakeLibvirt [as 别名]
# 或者: from healthnmon.tests.FakeLibvirt import open [as 别名]
 def test_deregister_libvirt_domain_events(self):
     libvirtEvents = libvirt_event_monitor.LibvirtEvents()
     libvirtEvents.call_back_ids['domain_events'] = [1]
     libvirtEvents.libvirt_con = libvirt.open("fake:///system")
     libvirtEvents._deregister_libvirt_domain_events()
开发者ID:emonty,项目名称:healthnmon,代码行数:7,代码来源:test_libvirt_events.py


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