bootstrap_gnocchi error log: ImportError: No module named 'rados' nor 'cradox'

Bug #1832306 reported by Eddie Yen
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
kolla
Fix Released
Medium
Eddie Yen
Rocky
Fix Released
Medium
Eddie Yen

Bug Description

I met an issue when trying to deploy OpenStack.
Using kolla-ansible downloaded from git with stable/rocky branch.

And below is few informations from globals.yml:
kolla_base_distro: "ubuntu"
kolla_install_type: "binary"
openstack_release: rocky

enable_aodh: yes
enable_ceilometer: yes
enable_ceph: yes
enable_cinder: yes
enable_gnocchi: yes
enable_grafana: yes
enable_neutron_dvr: yes
enable_neutron_lbaas: yes
enable_neutron_fwaas: yes
enable_prometheus: yes
...
glance_backend_ceph: yes
glance_backend_file: no

Other settings not shows is set as default.

During deployment, it stuck at "TASK: Running gnocchi bootstrap container" and need to stop manually.

And I check that container's log (docker logs bootstrap_gnocchi),it shows below error repeatedly.

2019-06-11 10:59:17,707 [19] ERROR gnocchi.utils: Unable to initialize storage driver
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/tenacity/__init__.py", line 333, in call
    result = fn(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/gnocchi/storage/__init__.py", line 102, in get_driver
    conf.storage)
  File "/usr/lib/python3/dist-packages/gnocchi/storage/ceph.py", line 52, in __init__
    self.rados, self.ioctx = ceph.create_rados_connection(conf)
  File "/usr/lib/python3/dist-packages/gnocchi/common/ceph.py", line 51, in create_rados_connection
    raise ImportError("No module named 'rados' nor 'cradox'")
ImportError: No module named 'rados' nor 'cradox'

This error not only occurred on image from Docker Hub, but also the image built by kolla-build.

But if I change install type to source, then everything is fine.

This issue has already happening about 3~4 weeks.

Eddie Yen (aksn74)
description: updated
description: updated
Revision history for this message
Eddie Yen (aksn74) wrote :

Found the issue that the gnocchi deb package on Ubuntu will install gnocchi-api & gnocchi-upgrade which using python3 as python execution application.
To fix this, need to build the image which installed require python packages in Python3 method. But it caused another issue from apache2 that port 8041 already in use after launch gnocchi-api and keep restarting container.

So there're two approaches to fix:
1. Build the image with require packages in python3, then check why default port has already in use.
2. Change gnocchi binary to use python2 or virtual env.

Eddie Yen (aksn74)
tags: added: in-stable-rocky
removed: rocky
Revision history for this message
Mark Goddard (mgoddard) wrote :

Is this something that you can fix Eddie?

Revision history for this message
Eddie Yen (aksn74) wrote :

Hi Mark,

Sorry but I'm too busy to keep trying fix this issue in present. I believe it caused by the Ubuntu repository has updated gnocchi binary that required python3 dependency in Bionic.
I think using python3 packages is the best way to fix, but I still have no clue and wonder know why apache2 said the port already in use during gnocchi deployment. And I can't access into container to see what's going on because it keep restarting.

Do you have any possibilities about port conflict issue? It's really hard to think this happen caused by install python3 dependencies instead of python2's.

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

Eddie, sometimes the distro packages install their own config files which include the port, and conflict with those generated by kolla-ansible. Could you look inside the container image for that?

Revision history for this message
Eddie Yen (aksn74) wrote :

Hi Mark,

I done the comparison between Docker Hub binary image and the binary image built by Kolla-build. Both gnocchi-api images has already got gnocchi-api.conf at /etc/apache2/sites-available inside, and this config file already set default port number of gnocchi.

Perhaps that's a root cause but still need to do the test based on re-build image. I'll try to add the command to remove this file in the Dockerfile, the rebuild is necessary because python3 dependencies is known required.

Revision history for this message
Eddie Yen (aksn74) wrote :

I finally tested the gnocchi-api image with gnocchi-api.conf deleted. The result is clear. The gnocchi-api has successfully running after its bootstrap. And no error occur during ceilometer deployment.

For modification, I do the code comparison between rocky and stein. Let it install python3 packages when building the rocky image, and delete the file I said in gnocchi-api Dockerfile. Also I modified wsgi-gnocchi.conf.j2 in Kolla-ansible so that to make sure it running with python3 based.

One more thing. I also found the aodh-api has a same issue about port conflict. And found that the distro package also create its own aodh-api conf file in the same direction.

Since the images from Docker Hub may all built by Kolla-build, I think these issue need to be fix. I'll upload my diff text to Pastebin.

But I have another question. Since we already found port conflict issue on gnocchi-api binary and aodh-api binary, is that better to replace the distro config rather than delete? Like just let wsgi-gnocchi.conf to replace /etc/apache2/sites-available/gnocchi-api.conf. If so, we can just change the dest for wsgi-gnocchi.conf in gnocchi-api.json.j2

Revision history for this message
Eddie Yen (aksn74) wrote :

Here's my modification. Already using diff to comparison.

Kolla gnocchi deploy fix (rocky) - wsgi-gnocchi -> https://pastebin.com/Sbjz0bkb
Kolla gnocchi deploy fix (rocky) - Dockerfile-gnocchi_api -> https://pastebin.com/4Z9rvbDn
Kolla gnocchi deploy fix (rocky) - Dockerfile-gnocchi_api -> https://pastebin.com/kpzx4Tj8
Kolla gnocchi deploy fix (rocky) - kolla-build macros -> https://pastebin.com/M6gV0W1L

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

Thanks for investigating Eddie, will you be pushing patches with these fixes?

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

About this:

> But I have another question. Since we already found port conflict issue on gnocchi-api binary and aodh-api binary, is that better to replace the distro config rather than delete? Like just let wsgi-gnocchi.conf to replace /etc/apache2/sites-available/gnocchi-api.conf. If so, we can just change the dest for wsgi-gnocchi.conf in gnocchi-api.json.j2

the config files might be named differently in different distros, so makes sense to just start with nothing, agree?

Revision history for this message
Eddie Yen (aksn74) wrote :

> The config files might be named differently in different distros, so makes sense to just start with nothing, agree?

Hmm, sounds make sense. Let's keep the deletion instead of replacement.

I will push. But I'm not sure where to push and how. Will appreciate tell me how to.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to kolla (master)

Related fix proposed to branch: master
Review: https://review.opendev.org/670832

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix merged to kolla (stable/rocky)

Reviewed: https://review.opendev.org/670425
Committed: https://git.openstack.org/cgit/openstack/kolla/commit/?id=330fc3698df0bddeea0e56f6c75623ff4dd88414
Submitter: Zuul
Branch: stable/rocky

commit 330fc3698df0bddeea0e56f6c75623ff4dd88414
Author: Eddie Yen <email address hidden>
Date: Fri Jul 12 01:29:10 2019 +0000

    Change to use Python3 dependencies for gnocchi on Ubuntu binary.

    Since Ubuntu Bionic distro has updated gnocchi binary that require
    python3, we need to install its python dependences based on python3.
    Especially 'cradox', this module is necessary for gnocchi to access Ceph.
    Wrong package version install will cause error during container
    bootstrapping.

    Related-Bug: 1832306

    Change-Id: I639564ce35d72ad9d16c191620a53481ef5920db

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix merged to kolla (master)

Reviewed: https://review.opendev.org/670832
Committed: https://git.openstack.org/cgit/openstack/kolla/commit/?id=5eb780d0b0d12186c57b828320c3421b98b97840
Submitter: Zuul
Branch: master

commit 5eb780d0b0d12186c57b828320c3421b98b97840
Author: Eddie Yen <email address hidden>
Date: Mon Jul 15 13:20:39 2019 +0000

    Delete default gnocchi & aodh wsgi conf in Ubuntu binary

    Ubuntu distro package will create default wsgi conf in apache
    during gnocchi-api and aodh-api installation. We need to delete
    them since we only use the conf that pushed by kolla-ansible.

    Change-Id: Ib31e733eba12deebdf469c306dfba4191a1b89f5
    Related-Bug: 1832306
    Related-Bug: 1836520

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to kolla (stable/stein)

Related fix proposed to branch: stable/stein
Review: https://review.opendev.org/676616

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix merged to kolla (stable/stein)

Reviewed: https://review.opendev.org/676616
Committed: https://git.openstack.org/cgit/openstack/kolla/commit/?id=cc6694dbc8907bad5085f9129fccd5b682e72b66
Submitter: Zuul
Branch: stable/stein

commit cc6694dbc8907bad5085f9129fccd5b682e72b66
Author: Eddie Yen <email address hidden>
Date: Mon Jul 15 13:20:39 2019 +0000

    Delete default gnocchi & aodh wsgi conf in Ubuntu binary

    Ubuntu distro package will create default wsgi conf in apache
    during gnocchi-api and aodh-api installation. We need to delete
    them since we only use the conf that pushed by kolla-ansible.

    Change-Id: Ib31e733eba12deebdf469c306dfba4191a1b89f5
    Related-Bug: 1832306
    Related-Bug: 1836520
    (cherry picked from commit 5eb780d0b0d12186c57b828320c3421b98b97840)

tags: added: in-stable-stein
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to kolla (stable/rocky)

Related fix proposed to branch: stable/rocky
Review: https://review.opendev.org/679617

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix merged to kolla (stable/rocky)

Reviewed: https://review.opendev.org/679617
Committed: https://git.openstack.org/cgit/openstack/kolla/commit/?id=69e46f78aff21ecad5f7793fb9aa79b56da87747
Submitter: Zuul
Branch: stable/rocky

commit 69e46f78aff21ecad5f7793fb9aa79b56da87747
Author: Eddie Yen <email address hidden>
Date: Mon Jul 15 13:20:39 2019 +0000

    Delete default gnocchi & aodh wsgi conf in Ubuntu binary

    Ubuntu distro package will create default wsgi conf in apache
    during gnocchi-api and aodh-api installation. We need to delete
    them since we only use the conf that pushed by kolla-ansible.

    Change-Id: Ib31e733eba12deebdf469c306dfba4191a1b89f5
    Related-Bug: 1832306
    Related-Bug: 1836520
    (cherry picked from commit 5eb780d0b0d12186c57b828320c3421b98b97840)
    (cherry picked from commit cc6694dbc8907bad5085f9129fccd5b682e72b66)

Mark Goddard (mgoddard)
Changed in kolla:
importance: Undecided → Medium
status: New → Fix Released
assignee: nobody → Eddie Yen (aksn74)
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.