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'
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'] )
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='******', rmPassword='******') 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)
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()
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' ])
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='******', rmPassword='******') 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)
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="******", rmPassword="******" ) 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 = []
def setUpClass(cls): cls.connection = LibvirtConnection(False) cls.mox = mox.Mox() cls.connection._wrapped_conn = libvirt.open('qemu:///system') rm_context = ComputeRMContext( rmType='fake', rmIpAddress='host', rmUserName='******', rmPassword='******') cls.connection.init_rmcontext(rm_context) cls.connection.libvirt = libvirt cls.vm_id = '25f04dd3-e924-02b2-9eac-876e3c943262' cls.vmhost_id = '1'
def setUpClass(cls): cls.connection = LibvirtConnection(False) cls.mox = mox.Mox() cls.connection._wrapped_conn = libvirt.open('qemu:///system') rm_context = ComputeRMContext(rmType='fake', rmIpAddress='host', rmUserName='******', rmPassword='******') cls.connection.init_rmcontext(rm_context) cls.connection.libvirt = libvirt cls.vm_id = '25f04dd3-e924-02b2-9eac-876e3c943262' cls.vmhost_id = '1'
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)
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='******', rmPassword='******') self.mock = mox.Mox()
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='******', rmPassword='******') 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 = []
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='******', rmPassword='******') 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 = []
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='******', rmPassword='******') cfg.CONF.set_override('healthnmon_notification_drivers', ['healthnmon.notifier.log_notifier']) self.mock = mox.Mox()
def setUp(self): self.connection = LibvirtConnection(False) self.vmHost = VmHost() self.vmHost.set_virtualMachineIds([]) InventoryCacheManager.update_object_in_cache('1', self.vmHost) #self.connection.setUuid('34353438-3934-434e-3738-313630323543') self.connection._wrapped_conn = libvirt.open('qemu:///system') self.libvirtVM = LibvirtVM(self.connection._wrapped_conn, '1') self.libvirtVM.vmHost.set_id('1') self.connection.compute_rmcontext = \ ComputeRMContext(rmType='QEMU', rmIpAddress='10.10.155.165', rmUserName='******', rmPassword='******') self.mock = mox.Mox() cfg.CONF.set_override('healthnmon_notification_drivers', ['healthnmon.notifier.log_notifier'])
def setUp(self): self.connection = LibvirtConnection(False) vmHost = VmHost() vSwitch = VirtualSwitch() vSwitch.set_id('52:54:00:34:14:AE') vSwitch.set_name('default') vSwitch.set_switchType('nat') vmHost.set_virtualSwitches([vSwitch]) InventoryCacheManager.update_object_in_cache('1', vmHost) #self.connection.setUuid('34353438-3934-434e-3738-313630323543') self.connection._wrapped_conn = libvirt.open('qemu:///system') self.connection.compute_rmcontext = \ ComputeRMContext(rmType='KVM', rmIpAddress='10.10.155.165', rmUserName='******', rmPassword='******') self.LibvirtNetwork = LibvirtNetwork(self.connection, '1') self.mock = mox.Mox() cfg.CONF.set_override('healthnmon_notification_drivers', ['healthnmon.notifier.log_notifier'])
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='******', rmPassword='******') 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()
def setUp(self): self.connection = LibvirtConnection(False) vmHost = VmHost() vmHost.set_virtualMachineIds([]) rm_context = ComputeRMContext( rmType='QEMU', rmIpAddress='10.10.155.165', rmUserName='******', rmPassword='******') 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.mock = mox.Mox() cfg.CONF.set_override('healthnmon_notification_drivers', ['healthnmon.notifier.log_notifier'])
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='******', rmPassword='******') 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 = []
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='******', rmPassword='******') 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 = []
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()