[Libguestfs] python 3 bindings on libguestfs

abinaya.manikandan at wipro.com abinaya.manikandan at wipro.com
Tue Jan 30 14:05:51 UTC 2018


Hi,

Finally on our RHEL7 machine we are able to bind python with libguestfs.
Please find below log:

checking for PYTHON... yes
checking Python prefix... /opt/python/x86_64/3.6.3-1
configure: Python install dir /opt/libguestfs/x86_64/1.32.10-1.el7/lib/python3.6/site-packages
checking for Python extension suffix (PEP-3149)... .cpython-36m-x86_64-linux-gnu.so

also python bindings turned as YES like below:

This is how we have configured the optional components for you today:

Daemon .............................. no
Appliance ........................... no
QEMU ................................ /opt/qemu/x86_64/2.4.0/bin-wrapped/qemu-kvm
guestfish and C-based virt tools .... yes
FUSE filesystem ..................... no
GNU gettext for i18n ................ yes
virt-p2v ............................ no
OCaml bindings ...................... yes
OCaml-based virt tools .............. yes
Perl bindings ....................... no
Perl-based virt tools ............... no
Python bindings ..................... yes
Ruby bindings ....................... no
Java bindings ....................... no
Haskell bindings .................... no
PHP bindings ........................ no
Erlang bindings ..................... no
Lua bindings ........................ no
Go bindings ......................... no
gobject bindings .................... no
gobject introspection ............... no
bash completion ..................... yes

:)

But next problem seems to be import is not working as expected, please find below issue:

[root at euca-172-31-8-98 lib]$ python
Python 3.6.3 (default, Nov 29 2017, 09:19:34)
[GCC 4.8.2 20140120 (Red Hat 4.8.2-16)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import guestfs
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/libguestfs/x86_64/1.32.10/lib/python3.6/site-packages/guestfs.py", line 73, in <module>
    import libguestfsmod
ImportError: /opt/libguestfs/x86_64/1.32.10/lib/python3.6/site-packages/libguestfsmod.cpython-36m-x86_64-linux-gnu.so: undefined symbol: PyString_FromStringAndSize
>>>

Please share any idea to fix the above issue it would be grateful.

Regards,
Abinaya

-----Original Message-----
From: Abinaya Sandhiya Manikandan (GIS)
Sent: Tuesday, January 30, 2018 3:34 PM
To: libguestfs at redhat.com
Subject: RE: [Libguestfs] python 3 bindings on libguestfs

Hi,

Our RHEL6 machine default OS python version is 2.6.6 and also  we have installed following python versions:

[root at euca-10-254-18-174 rpmbuild_13210]$ rpm -qa | grep python
python-2.6.6-66.el6_8.x86_64
libvirt-python-0.10.2-62.el6_9.1.x86_6
python-devel-2.6.6-66.el6_8.x86_64

So we are trying to build libguestfs-1.32.10 with python 2.6.6 atleast.
But still the log is same like below:

checking for python... /usr/bin/python2.6 checking Python version... 2.6 checking for PYTHON... no checking for PYTHON... no checking Python prefix... /usr checking for Python site-packages path... /usr/lib64/python2.6/site-packages

Please find below line which we are using in our SPEC:
PYTHON=/usr/bin/python2.6 ./configure --disable-appliance --disable-daemon --without-libvirt --with-qemu="qemu-kvm qemu-system-x86_64 qemu" --prefix=%{_prefix}  --enable-python

I have tried a lot but no luck.
Could you please let me know that whether you are trying this libguestfs on any RHEL machines .
if yes please provide some sample spec of libguestfs for RHEL machines.

Regards,
Abinaya sandhiya

-----Original Message-----
From: Richard W.M. Jones [mailto:rjones at redhat.com]
Sent: Monday, January 29, 2018 8:38 PM
To: Abinaya Sandhiya Manikandan (GIS) <abinaya.manikandan at wipro.com>
Cc: libguestfs at redhat.com
Subject: Re: [Libguestfs] python 3 bindings on libguestfs

** This mail has been sent from an external source **

The logs here:

> checking for python... /opt/python/x86_64/3.1.1/bin/python3
> checking Python version... 3.1
> checking for PYTHON... no
> checking for PYTHON... no
> checking Python prefix... /opt/python/x86_64/3.1.1 checking for Python
> site-packages path...
> /opt/python/x86_64/3.1.1/lib/python3.1/site-packages
> checking for Python extension suffix (PEP-3149)... .so checking for
> PyCapsule_New in -lc... no checking for PyString_AsString in -lc... no

are generated by this code:

https://clicktime.symantec.com/a/1/20jQKuR48Iaz7qM7c72Ewa-TzVtjx7eH6HhmcxNNNYI=?d=H4W9t6FfxUiZ8T1irhoCuVS2xPDMVwOgUrMYur8bItWGJYeDUJyMXb96d4Zed3r93KHmbWax8NNbxcYqw7yxWKoTJ41A4GD9a8lV6_LoDd3hrAuO9ttr0XbNaYWkZ3LYd-OdEer7Bfdlenhqr4TziTuhv7dryTj4Z5vT6k2Ryf-n8ldYK_5jLHZXGd_cPnYiyvvqtLFisQUX1gmNRj494EjI8YQ3DgMybUuNb4QRGcHnYwjRN6rm90QSn8AbfwMpV2Nd1JOY8Q7lrZUYUW7hh7TZFvnxfJk4_RI9Kc-lHY9jgux7BwR-YdxR7B85aDAreGVDhl2ClQrOyYGPwxIbbXizZzZ6gri9u1c6UMdaKI65Vxx95wAFcuQ%3D&u=https%3A%2F%2Fgithub.com%2Flibguestfs%2Flibguestfs%2Fblob%2F7021a234aa1496ca552ec82ff73747a302a1b80b%2Fm4%2Fguestfs-python.m4%23L28

As you can see from the output above you are missing all of the Python development libraries (eg. ‘python3-devel’ on Fedora).

On my machine with Python 3.6.2 and the correct development libraries installed I see:

...
checking for python... /usr/bin/python3
checking Python version... 3.6
checking for PYTHON... yes
checking Python prefix... /usr
checking for Python site-packages path... /usr/lib64/python3.6/site-packages
checking for Python extension suffix (PEP-3149)... .cpython-36m-x86_64-linux-gnu.so checking for PyCapsule_New in -lc... yes checking for PyString_AsString in -lc... no ...

Rich.

--
Richard Jones, Virtualization Group, Red Hat https://clicktime.symantec.com/a/1/pbGjVmX_MV0No5eIvfDfHfOGlwgS3qHzvLmtIwbyrW8=?d=H4W9t6FfxUiZ8T1irhoCuVS2xPDMVwOgUrMYur8bItWGJYeDUJyMXb96d4Zed3r93KHmbWax8NNbxcYqw7yxWKoTJ41A4GD9a8lV6_LoDd3hrAuO9ttr0XbNaYWkZ3LYd-OdEer7Bfdlenhqr4TziTuhv7dryTj4Z5vT6k2Ryf-n8ldYK_5jLHZXGd_cPnYiyvvqtLFisQUX1gmNRj494EjI8YQ3DgMybUuNb4QRGcHnYwjRN6rm90QSn8AbfwMpV2Nd1JOY8Q7lrZUYUW7hh7TZFvnxfJk4_RI9Kc-lHY9jgux7BwR-YdxR7B85aDAreGVDhl2ClQrOyYGPwxIbbXizZzZ6gri9u1c6UMdaKI65Vxx95wAFcuQ%3D&u=http%3A%2F%2Fpeople.redhat.com%2F~rjones
Read my programming and virtualization blog: https://clicktime.symantec.com/a/1/Q748QYQlOrpG_SFxGqzVPNDbEFzkHwm9hScaG-WtMpQ=?d=H4W9t6FfxUiZ8T1irhoCuVS2xPDMVwOgUrMYur8bItWGJYeDUJyMXb96d4Zed3r93KHmbWax8NNbxcYqw7yxWKoTJ41A4GD9a8lV6_LoDd3hrAuO9ttr0XbNaYWkZ3LYd-OdEer7Bfdlenhqr4TziTuhv7dryTj4Z5vT6k2Ryf-n8ldYK_5jLHZXGd_cPnYiyvvqtLFisQUX1gmNRj494EjI8YQ3DgMybUuNb4QRGcHnYwjRN6rm90QSn8AbfwMpV2Nd1JOY8Q7lrZUYUW7hh7TZFvnxfJk4_RI9Kc-lHY9jgux7BwR-YdxR7B85aDAreGVDhl2ClQrOyYGPwxIbbXizZzZ6gri9u1c6UMdaKI65Vxx95wAFcuQ%3D&u=http%3A%2F%2Frwmj.wordpress.com
virt-df lists disk usage of guests without needing to install any software inside the virtual machine.  Supports Linux and Windows.
https://clicktime.symantec.com/a/1/nsJASd71EwZ9UJnYK2H5yvz81DfowBOXiZ2B4oqXXts=?d=H4W9t6FfxUiZ8T1irhoCuVS2xPDMVwOgUrMYur8bItWGJYeDUJyMXb96d4Zed3r93KHmbWax8NNbxcYqw7yxWKoTJ41A4GD9a8lV6_LoDd3hrAuO9ttr0XbNaYWkZ3LYd-OdEer7Bfdlenhqr4TziTuhv7dryTj4Z5vT6k2Ryf-n8ldYK_5jLHZXGd_cPnYiyvvqtLFisQUX1gmNRj494EjI8YQ3DgMybUuNb4QRGcHnYwjRN6rm90QSn8AbfwMpV2Nd1JOY8Q7lrZUYUW7hh7TZFvnxfJk4_RI9Kc-lHY9jgux7BwR-YdxR7B85aDAreGVDhl2ClQrOyYGPwxIbbXizZzZ6gri9u1c6UMdaKI65Vxx95wAFcuQ%3D&u=http%3A%2F%2Fpeople.redhat.com%2F~rjones%2Fvirt-df%2F

______________________________________________________________________
This email has been scanned by the Symantec Email Security.cloud service.
For more information please visit http://www.symanteccloud.com ______________________________________________________________________
The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments. WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email. www.wipro.com

______________________________________________________________________
This email has been scanned by the Symantec Email Security.cloud service.
For more information please visit http://www.symanteccloud.com
______________________________________________________________________




More information about the Libguestfs mailing list