Querying possible -cpu variants
Hello.
We are making GUI for QEMU (which also should allow convenient record/replay command line generation): https://github.com/ispras/qemu-gui
To fill the combo box in CPU selection form we run QEMU with "-cpu help" command and parse its output.
The format of this list depends on target. Therefore our parsing code does not look good (and also may corrupt someday).
Is there a better way of requesting this information?
Or we should do one of the following:
1. Patch all targets and make the uniform "-cpu help" output format
2. Add QMP command for requesting this list.
Pavel Dovgalyuk
Quoted 7 lines · Pavel Dovgalyuk
To fill the combo box in CPU selection form we run QEMU with "-cpu help" command and parse its output.
The format of this list depends on target. Therefore our parsing code does not look good (and also may corrupt someday).
Is there a better way of requesting this information?
Yes, and you list it below...
Quoted 5 lines
Or we should do one of the following:
1. Patch all targets and make the uniform "-cpu help" output format
2. Add QMP command for requesting this list.
...you should use QMP. The whole point of that protocol is to be a guaranteed-not-to-break-or-change-format machine readable way to query properties of QEMU. Don't try to hand-parse the human-readable help output, please.
thanks
-- PMM
Quoted 17 lines · Pavel Dovgalyuk
Hello.
We are making GUI for QEMU (which also should allow convenient record/replay command line generation): https://github.com/ispras/qemu-gui
To fill the combo box in CPU selection form we run QEMU with "-cpu help" command and parse its output.
The format of this list depends on target. Therefore our parsing code does not look good (and also may corrupt someday).
Quoted 7 lines
Is there a better way of requesting this information?
Or we should do one of the following:
1. Patch all targets and make the uniform "-cpu help" output format
Machine parsing of "help" output is not supported by the QEMU project. This must all be done via the QMP interfaces.
Quoted 1 line
2. Add QMP command for requesting this list.
This already exists as the 'query-cpu-definitions' command
Regards,
Daniel
Signature · 3 lines
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
Quoted 13 lines
From: Daniel P. Berrangé [mailto:[email protected]]
Quoted 7 lines · Pavel Dovgalyuk
We are making GUI for QEMU (which also should allow convenient record/replay command line generation): https://github.com/ispras/qemu-gui
To fill the combo box in CPU selection form we run QEMU with "-cpu help" command and parse
its
Quoted 3 lines
output.
The format of this list depends on target. Therefore our parsing code does not look good
Quoted 8 lines
(and also
Quoted 5 lines
may corrupt someday).
2. Add QMP command for requesting this list.
This already exists as the 'query-cpu-definitions' command
Thank you!
Pavel Dovgalyuk
Quoted 4 lines · Daniel P. Berrangé
Quoted 2 lines
2. Add QMP command for requesting this list.
This already exists as the 'query-cpu-definitions' command
What's more, you can use libvirt code as an example of how to parse QMP commands to see what features are present. And if the existing QMP commands don't answer a question you need answered, enhancing QMP is a worthwhile patch (other projects, like libvirt, will probably also end up using those enhancements). Among other things, we know that our command-line parameters are not yet fully queryable by QMP.
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226 Virtualization: qemu.org | libvirt.org