Ejemplo n.º 1
0
 def test_free_cpus_numa(self):
     obj = objects.NUMATopology(cells=[
         objects.NUMANode(id=0, cpuset=set([1, 2]), pinned_cpus=set([1])),
         objects.NUMANode(id=1, cpuset=set([3, 4]), pinned_cpus=set([]))
     ])
     self.assertEqual(set([2]), obj.cells[0].free_cpus)
     self.assertEqual(set([3, 4]), obj.cells[1].free_cpus)
Ejemplo n.º 2
0
 def test_cpuset_filter_fail_dedicated_2(self):
     self.filt_cls = cpuset_filter.CpuSetFilter()
     container = objects.Container(self.context)
     container.cpu_policy = 'dedicated'
     container.cpu = 2.0
     container.memory = '1024'
     host = fakes.FakeHostState('testhost')
     host.cpus = 6
     host.cpu_used = 0.0
     host.numa_topology = objects.NUMATopology(nodes=[
         objects.NUMANode(id=0,
                          cpuset=set([1, 2, 3]),
                          pinned_cpus=set([]),
                          mem_total=32739,
                          mem_available=32739),
         objects.NUMANode(id=1,
                          cpuset=set([4, 5, 6]),
                          pinned_cpus=set([]),
                          mem_total=32739,
                          mem_available=32739)
     ])
     host.enable_cpu_pinning = False
     extra_spec = {}
     self.assertFalse(self.filt_cls.host_passes(host, container,
                                                extra_spec))
Ejemplo n.º 3
0
 def get_host_numa_topology(self):
     numa_topo_obj = objects.NUMATopology()
     os_capability_linux.LinuxHost().get_host_numa_topology(numa_topo_obj)
     return numa_topo_obj