On 1/7/20 10:36 AM, Kevin Wolf wrote:
The easy way out would be tying libvirt to a specific QEMU version. And
I'm only half joking.
If libvirt didn't exist yet and we needed a management library for QEMU,
what we would build now would probably not look much like libvirt looks
today. We wouldn't try to have basic support for every hypervisor out
there, but integrate it much closer with QEMU and avoid much of the
backwards compatibility requirements that the interface between QEMU and
libvirt has (which requires us to deal with compatibility twice for
everything).
By doing this, you would force your consumers to implement compatibility
layer each on their own. Freshly finished blockdev is a beautiful
example - OpenStack, oVirt and whatnot - they all are/can use blockdev
without even noticing, because the API provided by libvirt is stable and
provides abstraction, i.e. you don't need to change anything in your
domain XML to use blockdev.
Of course, you can apply the argument one more time and have mgmt
application tied to a specific version of qemu. But even that is not
good enough, because with backports version is just meaningless number.
Maybe it would even be part of the QEMU repository, allowing a single
patch series to implement a new feature in the system emulator and
expose it in the API immediately instead of waiting for the next QEMU
release before libvirt can even think about implementing support for it.
Thing is, it's not just qmp that a mgmt application has to master, it's
also process managing (and with growing number of helper binaries this
is not as trivial as fork() + exec()). This would need to be the bare
minimum your API layer has to provide to be consumable by anybody.
But then you have some advanced subsystems to take care of (CGroups,
SELinux, etc.) which are used heavily by OpenStack. oVirt and friends.
So should libvirt move in that direction? Do people actually still make
much use of its multi-hypervisor nature, or would it make sense to split
it into separate libraries for each hypervisor that can be much tighter
integrated with (a specific version of) the respective hypervisor?
Truth to be told, I don't think libvirt is held back by its attempts to
provide hypervisor agnostic APIs. Sure, it leads to some weirdness (e.g.
different naming in libvirt and qemu), but as a libvirt developer I
don't remember feeling blocked by this multi-hypervisor nature (not to
mention that this has saved us couple of times).
Also, it would be not correct to think that a feature is implemented for
all hypervisors in libvirt. I mean, when implementing a feature I
usually implement it only for qemu driver and don't even look at other
drivers (unless I'm doing a change in a core that causes build
failures). On the other hand, I do sometimes review patches posted by
developers from other companies which have interest in different
hypervisors (e.g. there is a SUSE guy working on LXC driver, and another
SUSE guy working on libxenlight (basically Xen)), so I do spend some
time not working on qemu driver, but I'd say it's negligible.
Michal