Ejemplo n.º 1
0
 def test_cpu_filter_pass(self):
     self.filt_cls = cpu_filter.CPUFilter()
     container = objects.Container(self.context)
     container.cpu = 5.0
     host = HostState('testhost')
     host.cpus = 8
     host.cpu_used = 0.0
     extra_spec = {}
     self.assertTrue(self.filt_cls.host_passes(host, container, extra_spec))
Ejemplo n.º 2
0
 def test_cpu_filter_fail(self):
     self.filt_cls = cpu_filter.CPUFilter()
     container = objects.Container(self.context)
     container.cpu = 8.0
     host = HostState('testhost')
     host.cpus = 5
     host.cpu_used = 2.0
     extra_spec = {}
     self.assertFalse(self.filt_cls.host_passes(host, container,
                                                extra_spec))
Ejemplo n.º 3
0
 def get_all_host_state(self, nodes):
     host_states = []
     for node in nodes:
         host_state = HostState(node.hostname)
         host_state.mem_total = node.mem_total
         host_state.mem_used = node.mem_used
         host_state.cpus = node.cpus
         host_state.cpu_used = node.cpu_used
         host_state.numa_topology = node.numa_topology
         host_state.labels = node.labels
         host_states.append(host_state)
     return host_states