On 12/04/2015 02:30 PM, Pavel Hrdina wrote:
The current code was a little bit odd.
Understatement of the Week :-) (also you get bonus points for being polite!)
At first we've removed all
possible implicit input devices from domain definition to add them later
back if there was any graphics device defined while parsing XML
description. That's not all, while formating domain definition to XML
description we at first ignore any input devices with bus different to
USB and VIRTIO and few lines later we add implicit input devices to XML.
Looking back at the history, it seems that the bit that ignores
particular input devices when there is a graphics device present was
included in the original commit of domain parsing code; I guess at the
time we didn't think all guest hardware should be represented in the
config. At some later time we decided that "if it's in the guest, it
needs to be in the config", and the 2nd bit that adds in the implicit
devices was added without noticed the earlier bit. Does seem pretty
pointless though :-P
This seems to me as a lot of code for nothing. This patch could seems
to be more complicated than original approach, but this is a preferred
way to modify/add driver specific staff only in those drivers and not
deal with them in common parsing/formating functions.
The update is to add those implicit input devices only into running XML
and don't put them automatically to offline XML. In addition we won't
remove any input devices specified by user.
I haven't looked at the code yet, but if my understanding of this
description is correct, your changes cause the implicitly added devices
to *not* be stored in the config as written to disk? Sometime a few
years ago, based on problems that users had with OSes complaining of
"hardware changed" I think, we started down the path of "every device
that is in the guest should be represented in the config" in order to
guarantee that those same devices will still be there the next time the
domain is started, even if libvirt changes what it adds implicitly.
Or am I jumping to incorrect conclusions about what the patch does?
I think that whatever hardware is in the guest needs to be represented
in the config, not just in the live XML.
There was also inconsistence between our behavior and QEMU's in
the way,
that in QEMU there is no way how to disable those implicit input devices
and they are available always, even without graphics device.
Is this the case for every version of qemu that we support?
This
applies also to XEN hypervisor. VZ driver already does its part by
putting correct implicit devices into live XML.