Пример #1
0
 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()
Пример #2
0
 def test__process_updates_for_updated_domain(self):
     self.mock.StubOutClassWithMocks(libvirt_inventorymonitor, 'LibvirtVM')
     mocked_libvirtVM = libvirt_inventorymonitor.LibvirtVM(None, None)
     mocked_libvirtVM.process_updates_for_updated_VM(
         mox.IgnoreArg()).AndReturn(None)
     self.mock.ReplayAll()
     libvirtEvents = libvirt_event_monitor.LibvirtEvents()
     libvirtEvents._process_updates_for_updated_domain(None)
     self.mock.VerifyAll()
Пример #3
0
 def test_domain_event_callback(self):
     libvirt_event_monitor.pool_for_processing_updated_vm = eventlet.greenpool.GreenPool(200)
     self.mock.StubOutWithMock(
         libvirt_event_monitor.pool_for_processing_updated_vm, 'spawn_n')
     libvirt_event_monitor.pool_for_processing_updated_vm.spawn_n(
         mox.IgnoreArg(), mox.IgnoreArg()).AndReturn(None)
     self.mock.ReplayAll()
     libvirtEvents = libvirt_event_monitor.LibvirtEvents()
     libvirtEvents._domain_event_callback('DummyParam1', 'DummyParam2')
     self.mock.VerifyAll()
Пример #4
0
 def test_register_libvirt_events(self):
     libvirtEvents = libvirt_event_monitor.LibvirtEvents()
     libvirtEvents.compute_id = '1'
     connection = LibvirtConnection(False)
     connection.compute_rmcontext = \
         ComputeRMContext(rmType='fake', rmIpAddress='10.10.155.165',
                          rmUserName='******',
                          rmPassword='******')
     InventoryCacheManager.get_all_compute_inventory()['1'] = \
         ComputeInventory(connection.compute_rmcontext)
     libvirtEvents.register_libvirt_events()
     self.mock.VerifyAll()
Пример #5
0
 def test_register_libvirt_events_conn_none(self):
     libvirtEvents = libvirt_event_monitor.LibvirtEvents()
     libvirtEvents.compute_id = '1'
     connection = LibvirtConnection(False)
     connection.compute_rmcontext = \
         ComputeRMContext(rmType='fake', rmIpAddress='10.10.155.165',
                          rmUserName='******',
                          rmPassword='******')
     InventoryCacheManager.get_all_compute_inventory()['2'] = \
         ComputeInventory(connection.compute_rmcontext)
     from healthnmon.virt.fake import FakeConnection
     self.mock.StubOutWithMock(FakeConnection, 'get_new_connection')
     fc = FakeConnection()
     fc.get_new_connection(mox.IgnoreArg(), mox.IgnoreArg()).AndReturn(None)
     self.mock.ReplayAll()
     libvirtEvents.register_libvirt_events()
     self.mock.VerifyAll()
Пример #6
0
 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()
Пример #7
0
 def test_deregister_libvirt_events_Exception(self):
     libvirtEvents = libvirt_event_monitor.LibvirtEvents()
     libvirtEvents.registered = True
     libvirtEvents.call_back_ids['domain_events'] = [1, 2, 3]
     libvirtEvents.deregister_libvirt_events()
Пример #8
0
 def test__register_libvirt_domain_events(self):
     libvirt_event_monitor.libvirt = libvirt
     libvirtEvents = libvirt_event_monitor.LibvirtEvents()
     libvirtEvents.libvirt_con = libvirt.openReadOnly('fake:///system')
     libvirtEvents._register_libvirt_domain_events()
Пример #9
0
 def test_register_libvirt_eventsException(self):
     libvirtEvents = libvirt_event_monitor.LibvirtEvents()
     libvirtEvents.register_libvirt_events()
Пример #10
0
 def test__domain_event_callback_exception(self):
     libvirtEvents = libvirt_event_monitor.LibvirtEvents()
     libvirtEvents._domain_event_callback()