env_process: Try to find the best possible CPU model for qemu v2

When auto_cpu_model = yes, we'll try to find the best
CPU model to be used by qemu, the process being:

1) Find the host CPU model
2) Try to pass it to qemu

We used to ignore invalid CPU models passed to qemu
in qemu_vm code, but we had to change that to allow
negative CPU model testing. So the sanity check of
whether the CPU model is valid has to be made way
earlier in the code.

Therefore, introduce get_qemu_best_cpu_model, that
will find the host CPU model and then check this
value against the valid CPU models on qemu. In case
there's no such cpu model in qemu, chose a sensible
default value (default_cpu_model if it is defined
in the params dict, or 'qemu64').

The new functions introduced to utils_misc are:
 * get_host_cpu_models -> Rename of get_cpu_model
 * get_qemu_cpu_models
 * extract_qemu_cpu_models
 * get_qemu_best_cpu_model

Some of the functions were extracted from the
cpuid test. In the next patch, we make the
test to use the new functions.

Changes from v1:
 * Refactor code to get qemu cpu models to its
   own function on utils_misc
 * Make the code actually work, by making
   involved functions to return lists

CC: Eduardo Habkost <ehabkost@redhat.com>
CC: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: NLucas Meneghel Rodrigues <lmr@redhat.com>
上级 fee28796
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册