本文整理汇总了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']
)
示例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'
示例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)
示例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()
示例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 = []
示例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)
示例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()
示例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 = []
示例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()
示例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()
示例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 = []
示例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()