def test_numa_cell_not_equivalent_different_pages(self): pt1 = objects.NUMAPagesTopology(size_kb=1024, total=32, used=0) pt2 = objects.NUMAPagesTopology(size_kb=1024, total=32, used=1) cell1 = objects.NUMACell(id=1, cpuset=set([1, 2]), memory=32, cpu_usage=10, pinned_cpus=set([3, 4]), siblings=[set([5, 6])], mempages=[pt1]) cell2 = objects.NUMACell(id=1, cpuset=set([1, 2]), memory=32, cpu_usage=10, pinned_cpus=set([3, 4]), siblings=[set([5, 6])], mempages=[pt2]) self.assertNotEqual(cell1, cell2)
def test_pages_topology_wipe(self): pages_topology = objects.NUMAPagesTopology(size_kb=2048, total=1024, used=512) self.assertEqual(2048, pages_topology.size_kb) self.assertEqual(1024, pages_topology.total) self.assertEqual(512, pages_topology.used) self.assertEqual(512, pages_topology.free) self.assertEqual(1048576, pages_topology.free_kb)
def test_can_fit_hugepages(self): cell = objects.NUMACell(id=0, cpuset=set([1, 2]), memory=1024, siblings=[], pinned_cpus=set([]), mempages=[ objects.NUMAPagesTopology(size_kb=4, total=1548736, used=0), objects.NUMAPagesTopology(size_kb=2048, total=513, used=0) ]) # 1,002G pagesize = 2048 self.assertTrue(cell.can_fit_hugepages(pagesize, 2**20)) self.assertFalse(cell.can_fit_hugepages(pagesize, 2**21)) self.assertFalse(cell.can_fit_hugepages(pagesize, 2**19 + 1)) self.assertRaises(exception.MemoryPageSizeNotSupported, cell.can_fit_hugepages, 12345, 2**20)
def test_numa_pages_not_equivalent_missing_b(self): pt1 = objects.NUMAPagesTopology(size_kb=1024, total=32, used=0) pt2 = objects.NUMAPagesTopology(size_kb=1024, used=0) self.assertNotEqual(pt1, pt2)