'Tests that _host_state_obj_to_dict properly converts a
NUMATopologyLimits object in the HostState.limits if found and
that other unexpected objects aren\'t converted.'

def test_host_state_obj_to_dict_numa_topology_limits_conversion(self):

    host_state = host_manager.HostState('fake-host', 'fake-node', uuids.cell_uuid)
    numa_limits = objects.NUMATopologyLimits(cpu_allocation_ratio=CONF.cpu_allocation_ratio, ram_allocation_ratio=CONF.ram_allocation_ratio)
    host_state.limits['numa_topology'] = numa_limits
    ignored_limits = objects.SchedulerLimits()
    host_state.limits['ignored'] = ignored_limits
    result = manager._host_state_obj_to_dict(host_state)
    expected = {'host': 'fake-host', 'nodename': 'fake-node', 'limits': {'numa_topology': numa_limits.obj_to_primitive(), 'ignored': ignored_limits}}
    self.assertDictEqual(expected, result)
    self.assertIsInstance(host_state.limits['numa_topology'], objects.NUMATopologyLimits)
