コード例 #1
0
ファイル: filter_scheduler.py プロジェクト: openstack/higgins
 def get_all_host_state(self, nodes, services):
     host_states = []
     for node in nodes:
         host_state = HostState(node.hostname)
         host_state.update(compute_node=node,
                           service=services.get(node.hostname))
         host_states.append(host_state)
     return host_states
コード例 #2
0
ファイル: filter_scheduler.py プロジェクト: zukobronja/zun
 def get_all_host_state(self, nodes, services):
     host_states = []
     for node in nodes:
         host_state = HostState(node.hostname)
         host_state.update(compute_node=node,
                           service=services.get(node.hostname))
         host_states.append(host_state)
     return host_states
コード例 #3
0
 def test_ram_filter_pass(self):
     self.filt_cls = ram_filter.RamFilter()
     container = objects.Container(self.context)
     container.memory = '1024M'
     host = HostState('testhost')
     host.mem_total = 1024 * 128
     host.mem_used = 1024
     extra_spec = {}
     self.assertTrue(self.filt_cls.host_passes(host, container, extra_spec))
コード例 #4
0
ファイル: test_cpu_filter.py プロジェクト: zwphit/zun
 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))
コード例 #5
0
 def test_pci_passthrough_with_pci_stats_none(self):
     request = objects.ContainerPCIRequest(
         count=1, spec=[{'vendor_id': '8086'}])
     requests = objects.ContainerPCIRequests(requests=[request])
     container = objects.Container(self.context)
     host = HostState('testhost')
     host.pci_stats = None
     extra_spec = {'pci_requests': requests}
     self.assertFalse(self.filt_cls.host_passes(host, container,
                                                extra_spec))
コード例 #6
0
ファイル: test_cpu_filter.py プロジェクト: zwphit/zun
 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))
コード例 #7
0
 def test_pci_passthrough_pass(self):
     pci_stats_mock = mock.MagicMock()
     pci_stats_mock.support_requests.return_value = True
     request = objects.ContainerPCIRequest(
         count=1, spec=[{'vendor_id': '8086'}])
     requests = objects.ContainerPCIRequests(requests=[request])
     container = objects.Container(self.context)
     host = HostState('testhost')
     host.pci_stats = pci_stats_mock
     extra_spec = {'pci_requests': requests}
     self.assertTrue(self.filt_cls.host_passes(host, container, extra_spec))
     pci_stats_mock.support_requests.assert_called_once_with(
         requests.requests)
コード例 #8
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
コード例 #9
0
 def test_pci_passthrough_empty_pci_request_obj(self):
     requests = objects.ContainerPCIRequests(requests=[])
     container = objects.Container(self.context)
     host = HostState('testhost')
     extra_spec = {'pci_requests': requests}
     self.assertTrue(self.filt_cls.host_passes(host, container, extra_spec))
コード例 #10
0
 def test_pci_passthrough_no_pci_request(self):
     container = objects.Container(self.context)
     host = HostState('testhost')
     extra_spec = {'pci_requests': None}
     self.assertTrue(self.filt_cls.host_passes(host, container, extra_spec))