Re: Pure Python binding?

2023-09-05 Thread Peter Krempa
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.



Pure Python binding?

2023-09-05 Thread Philipp Hahn

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 ;-)


Philipp
--
Philipp Hahn
Open Source Software Engineer

Univention GmbH
Mary-Somerville-Str. 1
28359 Bremen
Germany | Deutschland
Phone: +49 (0)421 22232-0 | E-Mail: i...@univention.de

https://www.univention.de | https://www.univention.com

Managing Directors: Peter H. Ganten, Stefan Gohmann
Local court: Amtsgericht Bremen
HRB 20755 | Ust-ID: DE220051310