cpu-gather: Move qemu detection to new script

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Tim Wiederhake 2020-12-15 17:24:54 +01:00 committed by Michal Privoznik
parent 3e04b68ccd
commit 028fc10cb3
2 changed files with 17 additions and 8 deletions

View File

@ -77,9 +77,25 @@ def main():
metavar="PATH",
help="Path to 'cpuid' utility. "
"If unset, the first executable 'cpuid' in $PATH is used.")
parser.add_argument(
"--path-to-qemu",
metavar="PATH",
help="Path to qemu. "
"If unset, will try '/usr/bin/qemu-system-x86_64', "
"'/usr/bin/qemu-kvm', and '/usr/libexec/qemu-kvm'.")
args = parser.parse_args()
if not args.path_to_qemu:
args.path_to_qemu = "qemu-system-x86_64"
search = [
"/usr/bin/qemu-system-x86_64",
"/usr/bin/qemu-kvm",
"/usr/libexec/qemu-kvm"]
for f in search:
if os.path.isfile(f):
args.path_to_qemu = f
name = gather_name(args)
print("model name\t: {}".format(name))
@ -97,6 +113,7 @@ def main():
print(end="", flush=True)
os.environ["CPU_GATHER_PY"] = "true"
os.environ["qemu"] = args.path_to_qemu
subprocess.check_call("./cpu-gather.sh")

View File

@ -5,14 +5,6 @@ if [ -z "${CPU_GATHER_PY}" ]; then
exit 1
fi
qemu=qemu-system-x86_64
for cmd in /usr/bin/$qemu /usr/bin/qemu-kvm /usr/libexec/qemu-kvm; do
if [[ -x $cmd ]]; then
qemu=$cmd
break
fi
done
qom_get()
{
path='/machine/unattached/device[0]'