libvirt-python 4.1.0 consumes undeclared variables

Bug #1753539 reported by Victor Morales
14
This bug affects 3 people
Affects Status Importance Assigned to Milestone
OpenStack Global Requirements
Fix Released
Undecided
Victor Morales

Bug Description

During Bifrost execution this installs the latest virtualbmc[1]. One of the dependencies of this python module is libvirt-python. The 4.1.0 version[2] consumes undeclared variables resulting in the following pip install error.

   /usr/bin/pkg-config --atleast-version=1.0.2 libvirt
    /usr/bin/python2 generator.py libvirt-lxc /usr/share/libvirt/api/libvirt-lxc-api.xml
    Found 3 functions in /usr/share/libvirt/api/libvirt-lxc-api.xml
    Found 0 functions in libvirt-lxc-override-api.xml
    Generated 1 wrapper functions
    running build_py
    creating build/lib.linux-x86_64-2.7
    copying build/libvirt.py -> build/lib.linux-x86_64-2.7
    copying build/libvirt_qemu.py -> build/lib.linux-x86_64-2.7
    copying build/libvirt_lxc.py -> build/lib.linux-x86_64-2.7
    running build_ext
    building 'libvirtmod' extension
    creating build/temp.linux-x86_64-2.7
    creating build/temp.linux-x86_64-2.7/build
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I. -I/usr/include/python2.7 -c libvirt-override.c -o build/temp.linux-x86_64-2.7/libvirt-override.o
    libvirt-override.c:7746:7: error: ‘VIR_MIGRATE_PARAM_PERSIST_XML’ undeclared here (not in a function)
         { VIR_MIGRATE_PARAM_PERSIST_XML, VIR_TYPED_PARAM_STRING },
           ^
    libvirt-override.c:7751:7: error: ‘VIR_MIGRATE_PARAM_DISKS_PORT’ undeclared here (not in a function)
         { VIR_MIGRATE_PARAM_DISKS_PORT, VIR_TYPED_PARAM_INT },
           ^
    libvirt-override.c:7752:7: error: ‘VIR_MIGRATE_PARAM_COMPRESSION’ undeclared here (not in a function)
         { VIR_MIGRATE_PARAM_COMPRESSION, VIR_TYPED_PARAM_STRING },
           ^
    libvirt-override.c:7753:7: error: ‘VIR_MIGRATE_PARAM_COMPRESSION_MT_LEVEL’ undeclared here (not in a function)
         { VIR_MIGRATE_PARAM_COMPRESSION_MT_LEVEL, VIR_TYPED_PARAM_INT },
           ^
    libvirt-override.c:7754:7: error: ‘VIR_MIGRATE_PARAM_COMPRESSION_MT_THREADS’ undeclared here (not in a function)
         { VIR_MIGRATE_PARAM_COMPRESSION_MT_THREADS, VIR_TYPED_PARAM_INT },
           ^
    libvirt-override.c:7755:7: error: ‘VIR_MIGRATE_PARAM_COMPRESSION_MT_DTHREADS’ undeclared here (not in a function)
         { VIR_MIGRATE_PARAM_COMPRESSION_MT_DTHREADS, VIR_TYPED_PARAM_INT },
           ^
    libvirt-override.c:7756:7: error: ‘VIR_MIGRATE_PARAM_COMPRESSION_XBZRLE_CACHE’ undeclared here (not in a function)
         { VIR_MIGRATE_PARAM_COMPRESSION_XBZRLE_CACHE, VIR_TYPED_PARAM_ULLONG },
           ^
    libvirt-override.c:7757:7: error: ‘VIR_MIGRATE_PARAM_AUTO_CONVERGE_INITIAL’ undeclared here (not in a function)
         { VIR_MIGRATE_PARAM_AUTO_CONVERGE_INITIAL, VIR_TYPED_PARAM_INT },
           ^
    libvirt-override.c:7758:7: error: ‘VIR_MIGRATE_PARAM_AUTO_CONVERGE_INCREMENT’ undeclared here (not in a function)
         { VIR_MIGRATE_PARAM_AUTO_CONVERGE_INCREMENT, VIR_TYPED_PARAM_INT },
           ^
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

    ----------------------------------------
  Rolling back uninstall of libvirt-python
Command "/usr/bin/python2 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-ZzN0Jr/libvirt-python/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-3jFAJD-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-ZzN0Jr/libvirt-python/

[1] http://git.openstack.org/cgit/openstack/bifrost/tree/playbooks/roles/bifrost-create-vm-nodes/tasks/prepare_libvirt.yml#n134
[2] https://github.com/libvirt/libvirt-python/releases/tag/v4.1.0

Changed in openstack-requirements:
assignee: nobody → Victor Morales (electrocucaracha)
status: New → In Progress
Revision history for this message
Victor Morales (electrocucaracha) wrote :

Apparently this only affects Ubuntu systems, more likely this is a consequence of a mismatch of versions between libvirt-python and libvirt0

Revision history for this message
Victor Morales (electrocucaracha) wrote :

The undeclared variables were defined for libvirt versions > 2.0.0 [1], but the checker function includes 1.1.0 [2][3]. Modifying the arguments of LIBVIR_CHECK_VERSION to 2.0.0 works

diff --git a/libvirt-override.c b/libvirt-override.c
index 580c259..a7077f2 100644
--- a/libvirt-override.c
+++ b/libvirt-override.c
@@ -7738,7 +7738,7 @@ libvirt_virDomainMigrateGetMaxDowntime(PyObject *self ATTRIBUTE_UNUSED,
 }
 #endif /* LIBVIR_CHECK_VERSION(3, 7, 0) */

-#if LIBVIR_CHECK_VERSION(1, 1, 0)
+#if LIBVIR_CHECK_VERSION(2, 0, 0)
 static virPyTypedParamsHint virPyDomainMigrate3Params[] = {
     { VIR_MIGRATE_PARAM_URI, VIR_TYPED_PARAM_STRING },
     { VIR_MIGRATE_PARAM_DEST_NAME, VIR_TYPED_PARAM_STRING },
@@ -9845,7 +9845,7 @@ static PyMethodDef libvirtMethods[] = {
     {(char *) "virDomainMigrateGetMaxDowntime", libvirt_virDomainMigrateGetMaxDowntime, METH_VARARGS, NULL},
 #endif /* LIBVIR_CHECK_VERSION(3, 7, 0) */
     {(char *) "virDomainMigrateGetMaxSpeed", libvirt_virDomainMigrateGetMaxSpeed, METH_VARARGS, NULL},
-#if LIBVIR_CHECK_VERSION(1, 1, 0)
+#if LIBVIR_CHECK_VERSION(2, 0, 0)
     {(char *) "virDomainMigrate3", libvirt_virDomainMigrate3, METH_VARARGS, NULL},
     {(char *) "virDomainMigrateToURI3", libvirt_virDomainMigrateToURI3, METH_VARARGS, NULL},
 #endif /* LIBVIR_CHECK_VERSION(1, 1, 0) */

I'm going to send the patch to libvirt community

[1] https://github.com/libvirt/libvirt/commit/f6e12b40295b1601b9911f6ccb46e09bf8e47e85
[2] https://github.com/libvirt/libvirt-python/blob/master/libvirt-override.c#L7741
[3] https://github.com/libvirt/libvirt-python/blob/master/libvirt-override.c#L9848

Revision history for this message
Mark Goddard (mgoddard) wrote :

Thanks for investigating this Victor. Bifrost was not applying U-C when installing the virtualbmc package with the libvirt-python dependency. This is why 4.1.0 was installed. I've proposed a patch [1] to honour U-C when installing virtualbmc, which should limit libvirt-python to 4.0.0.

[1] https://review.openstack.org/#/c/550219/

Changed in openstack-requirements:
status: In Progress → Fix Committed
Changed in openstack-requirements:
status: Fix Committed → Fix Released
Revision history for this message
Popescu Catalin (capopescu) wrote :

Apparently this bug still exists.
I have on my PC:

libvirt-dev/xenial-updates,now 1.3.1-1ubuntu10.21 amd64 [installed]
libvirt0/xenial-updates,now 1.3.1-1ubuntu10.21 amd64 [installed]

When I try to install libvirt-python through pip I'll encountered the same error.

The fast solution is to install on Local PC a older version of libvirt-python. In this moment in pip repo' you can find libvirt-python version 4.2

So a quick fix is:
pip install libvirt-python==4.0

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/requirements queens-eol

This issue was fixed in the openstack/requirements queens-eol release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/requirements rocky-eol

This issue was fixed in the openstack/requirements rocky-eol release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/requirements stein-eol

This issue was fixed in the openstack/requirements stein-eol release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/requirements yoga-eom

This issue was fixed in the openstack/requirements yoga-eom release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/requirements train-eol

This issue was fixed in the openstack/requirements train-eol release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/requirements ussuri-eol

This issue was fixed in the openstack/requirements ussuri-eol release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/requirements victoria-eom

This issue was fixed in the openstack/requirements victoria-eom release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/requirements wallaby-eom

This issue was fixed in the openstack/requirements wallaby-eom release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/requirements xena-eom

This issue was fixed in the openstack/requirements xena-eom release.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.