client-relation-joined fails when relating ceph-proxy to gnocchi or nova-compute

Bug #1862487 reported by Przemyslaw Hausman
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Ceph-Proxy Charm
Fix Released
High
Chris MacNaughton

Bug Description

Relating gnocchi (or nova-compute) with ceph-proxy ends up with ceph-proxy in error state due to failed client-relation-joined:

unit-ceph-proxy-0: 23:24:56 WARNING unit.ceph-proxy/0.juju-log client:354: Support for use of upstream ``apt_pkg`` module in conjunctionwith charm-helpers is deprecated since 2019-06-25
unit-ceph-proxy-0: 23:24:56 DEBUG unit.ceph-proxy/0.client-relation-joined exported keyring for client.gnocchi
unit-ceph-proxy-0: 23:24:56 WARNING unit.ceph-proxy/0.juju-log client:354: Support for use of upstream ``apt_pkg`` module in conjunctionwith charm-helpers is deprecated since 2019-06-25
unit-ceph-proxy-0: 23:24:57 DEBUG unit.ceph-proxy/0.juju-log client:354: Processing request 28605292-4aca-11ea-9c17-00163e4e5dd8
unit-ceph-proxy-0: 23:24:57 INFO unit.ceph-proxy/0.juju-log client:354: Processing 1 ceph broker requests
unit-ceph-proxy-0: 23:24:57 DEBUG unit.ceph-proxy/0.juju-log client:354: Processing op='create-pool'
unit-ceph-proxy-0: 23:24:57 WARNING unit.ceph-proxy/0.juju-log client:354: Support for use of upstream ``apt_pkg`` module in conjunctionwith charm-helpers is deprecated since 2019-06-25
unit-ceph-proxy-0: 23:24:57 DEBUG unit.ceph-proxy/0.juju-log client:354: Pool 'gnocchi' already exists - skipping create
unit-ceph-proxy-0: 23:24:57 DEBUG unit.ceph-proxy/0.client-relation-joined Traceback (most recent call last):
unit-ceph-proxy-0: 23:24:57 DEBUG unit.ceph-proxy/0.client-relation-joined File "/var/lib/juju/agents/unit-ceph-proxy-0/charm/hooks/client-relation-joined", line 292, in <module>
unit-ceph-proxy-0: 23:24:57 DEBUG unit.ceph-proxy/0.client-relation-joined hooks.execute(sys.argv)
unit-ceph-proxy-0: 23:24:57 DEBUG unit.ceph-proxy/0.client-relation-joined File "/var/lib/juju/agents/unit-ceph-proxy-0/charm/charmhelpers/core/hookenv.py", line 914, in execute
unit-ceph-proxy-0: 23:24:57 DEBUG unit.ceph-proxy/0.client-relation-joined self._hooks[hook_name]()
unit-ceph-proxy-0: 23:24:57 DEBUG unit.ceph-proxy/0.client-relation-joined File "/var/lib/juju/agents/unit-ceph-proxy-0/charm/hooks/client-relation-joined", line 209, in client_relation_joined
unit-ceph-proxy-0: 23:24:57 DEBUG unit.ceph-proxy/0.client-relation-joined unit_id = unit.replace('/', '-')
unit-ceph-proxy-0: 23:24:57 DEBUG unit.ceph-proxy/0.client-relation-joined AttributeError: 'NoneType' object has no attribute 'replace'
unit-ceph-proxy-0: 23:24:57 ERROR juju.worker.uniter.operation hook "client-relation-joined" failed: exit status 1

DEPLOYMENT
bionic-stein

CHARM REVISIONS
ceph-proxy: Revision 26
gnocchi: Revision 32, Version 4.3.2

ADDITIONAL INFORMATION
I have added a few debug printouts in client-relation-joined code and gathered the data passed to the function.

relid: None
unit: None
units: ['gnocchi/2']
settings: {'broker_req': '{"api-version": 1, "ops": [{"op": "create-pool", "name": "gnocchi", "replicas": 3, "pg_num": null, "weight": null, "group": null, "group-namespace": null, "app-name": null, "max-bytes": null, "max-objects": null}], "request-id": "79847532-4ace-11ea-9c17-00163e4e5dd8"}', 'egress-subnets': '10.127.1.10/32', 'ingress-address': '10.127.1.10', 'private-address': '10.127.1.10'}

The code fails because 'settings' is not None and 'unit' is None.

When applied the following patch, the relation has been successfully executed:

diff --git a/ceph_hooks.py.orig b/ceph_hooks.py
index a637ff6..ab126d8 100755
--- a/ceph_hooks.py.orig
+++ b/ceph_hooks.py
@@ -206,7 +206,7 @@ def client_relation_joined(relid=None, unit=None):
             data_update = {}
             if 'broker_req' in settings:
                 rsp = process_requests(settings['broker_req'])
- unit_id = unit.replace('/', '-')
+ unit_id = units[0].replace('/', '-')
                 unit_response_key = 'broker-rsp-' + unit_id
                 data_update[unit_response_key] = rsp
             data.update(data_update)

summary: - client-relation-joined fails when relating ceph-proxy to gnocchi
+ client-relation-joined fails when relating ceph-proxy to gnocchi or
+ nova-compute
description: updated
Revision history for this message
Pedro Guimarães (pguimaraes) wrote :

Hi, we are seeing the same issue with ceph-proxy: https://pastebin.canonical.com/p/WTcf7s6Pw5/

Changed in charm-ceph-proxy:
status: New → Confirmed
Revision history for this message
Chris MacNaughton (chris.macnaughton) wrote :

A fix has been proposed at https://review.opendev.org/#/c/707353

Changed in charm-ceph-proxy:
assignee: nobody → Chris MacNaughton (chris.macnaughton)
Liam Young (gnuoy)
Changed in charm-ceph-proxy:
importance: Undecided → High
Changed in charm-ceph-proxy:
milestone: none → 20.02
status: In Progress → Fix Committed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to charm-ceph-proxy (master)

Reviewed: https://review.opendev.org/707353
Committed: https://git.openstack.org/cgit/openstack/charm-ceph-proxy/commit/?id=649bdb4683578c7bd5bff235dd1e4551d3b91a45
Submitter: Zuul
Branch: master

commit 649bdb4683578c7bd5bff235dd1e4551d3b91a45
Author: Chris MacNaughton <email address hidden>
Date: Wed Feb 12 11:26:46 2020 +0100

    Ensure that we define `unit` before use

    When ceph-proxy is configured prior to being related
    to clients, it is possible for the units to go into
    a hook error because of an undefined variable. This
    change ensures that we do correctly define the unit
    before we use it.

    Change-Id: Ic6e28783bde4fc342d7c5ef1d733e69a03b702fe
    Closes-Bug: #1862487

Liam Young (gnuoy)
Changed in charm-ceph-proxy:
status: Fix Committed → Fix Released
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.