On Tue, Sep 05, 2023 at 09:00:45 +0200, Philipp Hahn wrote:
Hello,
"pip install libvirt-python" does not work in several cases as that requires
the low-level C library, compilers, tools, and Python header files to be
installed. This prevents the use of "libvirt" in scenarios, where
"root"
privileges are not available to install these dependencies, e.g. running
"libvirt" inside a JupyterHub notebook for gathering statistics. This also
breaks the adoption on Windows, see
<
https://gitlab.com/libvirt/libvirt-python/-/issues/7> and
<
https://gitlab.com/libvirt/libvirt-python/-/issues/6>
Looking at <
https://libvirt.org/bindings.html> and
<
https://gitlab.com/libvirt> I only see "bindings" for the low-level C
library.
Does someone know of a "pure Python binding" for talking to a remote
"libvirtd", either via "+ssh" or "+tls"?
Or is there another "trick" to talk to libvirtd? And no, parsing the output
of subprocess.run("ssh ... virsh ...") is not an option ;-)
Technically our RPC protocol is considered stable:
https://libvirt.org/support.html#rpc-protocol
so it would be possible (and in fact exists in one form of Golang
bindings) to create bindings using directly the RPC protocol rather than
libvirt.so to talk to the daemon.
Nevertheless, as documented, we suggest everybody to use libvirt.so to
communicate with libvirt.
In addition, when using RPC directly you must only use features provided
by the daemon. Hypervisors not using the daemon or e.g. the embedded
mode of the qemu driver will not work without libvirt.so
As of such, there is no plan for "official" libvirt bindings to use the
protocol directly.