On 04/04/2013 01:13 PM, Viktor Mihajlovski wrote:
On 04/04/2013 06:20 PM, Peter Krempa wrote:
> My question is: Is it worthwhile to do per machine type capability
> detection? It definitely isn't worth doing just for the get-cpu-max
> support, but it might be needed for Q35 or other stuff that may depend
> on the actual machine type used.
I am very sympathetic there because for s390 the machine type defines
the bus type and thus has an considerable impact on the device
configuration options. On the other hand QEMU unfortunately fails to
offer per-machine device capabilities today. See also
https://www.redhat.com/archives/libvir-list/2013-February/msg00537.html
and Dan's concerns with that approach.
In a better world the QMP interface might allow to query per machine type
(one can always dream...)
At one time we requested that of qemu, and learned that, due to the way
qemu is internally organized, that would be next to impossible to
provide (it turns out that type of information isn't available in a data
table, but is constructed on the fly as a machine is instantiated, and
one a machine is instantiated, qemu can't tear it down and instantiate a
new/different machine without completely shutting down).
However, as Dan pointed out in a previous message, relying on such
information for definition-time validation would be flawed anyway,
because there is no guarantee that what was available in the qemu binary
at the time of definition (on the host where the definition is done)
would be the same as what was available at runtime.
Now that pkrempa's patches to support domain post-parse callback
functions are going in, we can add in qemu-specific callbacks that do
extra validation of devices depending on the setting of machinetype.
This will be a big win not only for s390, but also for ARM and q35;
we'll be able to remove all of the x86 (i.e. "pc") specific stuff
that's
automatically added to domains from the generic parser, and put it in a
callback to only be added for pc-* machine types. Likewise you'll be
able to do the same thing for any devices/controllers specific to s390.
It won't allow *exact* validation for exactly what is supported by the
binary on the current machine, but it will at least allow getting
extremely close, and any final minute differences can be handled when
the guest is actually started up.