On Sun, Jun 12, 2022 at 00:16:20 +0200, Gionatan Danti wrote:
Il 2022-06-11 19:32 Laine Stump ha scritto:
[...]
> I guess you'll need to do a "virsh dumpxml
--inactive" for each guest
> and parse it out of there.
It matches my results. However, virsh dumpxml is an expensive operation -
polkitd can easily burn >30% of a single core for 1s polling interval with
virsh dumpxml. I settled (for testing) with grepping "mode..vepa" in
/etc/libvirtd/qemu and it seems to work well (1s polling not even register
in top).
The unfortunate thing about using `virsh dumpxml $VM` as written is that
it opens a connection (which uses polkit to auth), gets the XML and then
closes the connection.
If you want it to be more optimized you can e.g. write a script using
python bindings for libvirt and simply keep the connection open ...
Does libvirt support calling some external script when a new virtual
machine
is defined?
... which additionally allows you to register 'domain lifecycle events'
[1] which give you a trigger when a new VM is defined.
https://www.libvirt.org/html/libvirt-libvirt-domain.html#virConnectDomain...
https://www.libvirt.org/html/libvirt-libvirt-domain.html#virDomainEventID