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))
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