Example #1
0
    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)
Example #2
0
    def test_processUpdatesException(self):
        self.mock.StubOutWithMock(api, 'storage_volume_delete_by_ids')

        api.storage_volume_delete_by_ids(mox.IgnoreArg(),
                                         mox.IgnoreArg()).MultipleTimes().AndReturn(None)
        mock_libvirtSV = LibvirtStorageVolume(self.connection, '1')
        self.mock.StubOutWithMock(mock_libvirtSV, 'processStorageDeletes')
        mock_libvirtSV.processStorageDeletes([], []).AndRaise(Exception)
        self.mock.ReplayAll()
        self.assertEquals(self.LibvirtStorageVolume.processUpdates(),
                          None)
        self.assertRaises(Exception, LibvirtStorageVolume)
        self.mock.stubs.UnsetAll()
Example #3
0
 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()