[rev 38] ceph-dashboard fails hook "certificates-relation-changed"

Bug #2033886 reported by Bas de Bruijne
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Ceph Dashboard Charm
Fix Committed
Undecided
Unassigned

Bug Description

In test run https://solutions.qa.canonical.com/testruns/4d34da56-35f8-47eb-82ef-2020c2d8686b, which uses the following versions:

maas 3.2.9-
juju 2.9.44
ceph quincy/stable
charms yoga/stable
charm-ceph-dashboard latest/edge (rev 38)

ceph-dashboard fails installing on the "certificates-relation-changed" hook with the following message in the debug log:
==================
Traceback (most recent call last):
  File "/var/lib/juju/agents/unit-ceph-dashboard-0/charm/./src/charm.py", line 755, in <module>
    main(CephDashboardCharm)
  File "/var/lib/juju/agents/unit-ceph-dashboard-0/charm/venv/ops/main.py", line 431, in main
    _emit_charm_event(charm, dispatcher.event_name)
  File "/var/lib/juju/agents/unit-ceph-dashboard-0/charm/venv/ops/main.py", line 142, in _emit_charm_event
    event_to_emit.emit(*args, **kwargs)
  File "/var/lib/juju/agents/unit-ceph-dashboard-0/charm/venv/ops/framework.py", line 316, in emit
    framework._emit(event)
  File "/var/lib/juju/agents/unit-ceph-dashboard-0/charm/venv/ops/framework.py", line 784, in _emit
    self._reemit(event_path)
  File "/var/lib/juju/agents/unit-ceph-dashboard-0/charm/venv/ops/framework.py", line 857, in _reemit
    custom_handler(event)
  File "/var/lib/juju/agents/unit-ceph-dashboard-0/charm/venv/interface_tls_certificates/ca_client.py", line 687, in _on_relation_changed
    self.ready_events[request_type].emit()
  File "/var/lib/juju/agents/unit-ceph-dashboard-0/charm/venv/ops/framework.py", line 316, in emit
    framework._emit(event)
  File "/var/lib/juju/agents/unit-ceph-dashboard-0/charm/venv/ops/framework.py", line 784, in _emit
    self._reemit(event_path)
  File "/var/lib/juju/agents/unit-ceph-dashboard-0/charm/venv/ops/framework.py", line 857, in _reemit
    custom_handler(event)
  File "/var/lib/juju/agents/unit-ceph-dashboard-0/charm/./src/charm.py", line 751, in _enable_ssl_from_relation
    self._configure_tls_from_relation()
  File "/var/lib/juju/agents/unit-ceph-dashboard-0/charm/./src/charm.py", line 726, in _configure_tls_from_relation
    self._configure_tls(key, cert, ca_cert, self.TLS_VAULT_CA_CERT_PATH)
  File "/var/lib/juju/agents/unit-ceph-dashboard-0/charm/./src/charm.py", line 583, in _configure_tls
    ceph_utils.dashboard_set_ssl_certificate(
  File "/var/lib/juju/agents/unit-ceph-dashboard-0/charm/venv/charms_ceph/utils.py", line 3609, in _dashboard_set_ssl_artifact
    subprocess.check_call(cmd)
  File "/usr/lib/python3.10/subprocess.py", line 369, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['ceph', 'dashboard', 'set-ssl-certificate', 'juju-218f1e-1-lxd-1', '-i', PosixPath('/etc/ceph/ceph-dashboard.crt')]' returned non-zero exit status 95.
==================

Since it doesn't post the ceph commands stdout and stderr, I'm not sure what exactly went wrong in this command. Vault is initialized at this point, so the certificates should be present.

More logs and configs can be found here: https://oil-jenkins.canonical.com/artifacts/4d34da56-35f8-47eb-82ef-2020c2d8686b/index.html

tags: added: cdo-qa foundations-engine
Revision history for this message
utkarsh bhatt (utkarshbhatthere) wrote :

The root cause for this error is a race condition between mgr enablement and certificates relation handle:

Log Print:
2023-08-29T23:17:47.373+0000 7f168d179640 -1 mgr.server reply reply (95) Operation not supported Module 'dashboard' is not enabled (required by command 'dashboard set-ssl-certificate'): use ceph mgr module enable dashboard to enable it

The newly split event handlers require to defer the handling until dashboard mgr module is enabled.

Changed in charm-ceph-dashboard:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to charm-ceph-dashboard (master)

Reviewed: https://review.opendev.org/c/openstack/charm-ceph-dashboard/+/893479
Committed: https://opendev.org/openstack/charm-ceph-dashboard/commit/33f60aea0971cdf49a78f475d8469431b57b0b30
Submitter: "Zuul (22348)"
Branch: master

commit 33f60aea0971cdf49a78f475d8469431b57b0b30
Author: Utkarsh Bhatt <email address hidden>
Date: Fri Sep 1 13:11:41 2023 +0530

    Adds dashboard enablement/deferral logic improvements

    Closes-Bug: 2033886
    Change-Id: I2f4d4dfa890fc79f7f5d5b1273a11907b60e8255
    Signed-off-by: Utkarsh Bhatt <email address hidden>

Changed in charm-ceph-dashboard:
status: In Progress → Fix Committed
Revision history for this message
Karthik K (hikkart) wrote :
Download full text (6.5 KiB)

Team

Faced the same issue with charm-ceph-dashboard rev 40 as well on manually provisioned juju.

Please let me know, on which version the fix would be available to check again.
Thank you.

---

Traceback (most recent call last):
  File "/var/lib/juju/agents/unit-ceph-dashboard-4/charm/./src/charm.py", line 769, in <module>
    main(CephDashboardCharm)
.....
    custom_handler(event)
  File "/var/lib/juju/agents/unit-ceph-dashboard-4/charm/./src/charm.py", line 745, in _enable_ssl_from_config
    self._configure_tls_from_charm_config()
  File "/var/lib/juju/agents/unit-ceph-dashboard-4/charm/./src/charm.py", line 715, in _configure_tls_from_charm_config
    self._configure_tls(key, cert, ca_cert, self.TLS_CHARM_CA_CERT_PATH)
  File "/var/lib/juju/agents/unit-ceph-dashboard-4/charm/./src/charm.py", line 583, in _configure_tls
    ceph_utils.dashboard_set_ssl_certificate(
  File "/var/lib/juju/agents/unit-ceph-dashboard-4/charm/venv/charms_ceph/utils.py", line 3609, in _dashboard_set_ssl_artifact
    subprocess.check_call(cmd)
  File "/usr/lib/python3.10/subprocess.py", line 369, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['ceph', 'dashboard', 'set-ssl-certificate', 'ceph-2', '-i', PosixPath('/etc/ceph/ceph-dashboard.crt')]' returned non-zero exit status 22.
unit-ceph-dashboard-4: 22:33:37 ERROR juju.worker.uniter.operation hook "dashboard-relation-changed" (via hook dispatching script: dispatch) failed: exit status 1
unit-ceph-dashboard-4: 22:33:37 INFO juju.worker.uniter awaiting error resolution for "relation-changed" hook
unit-ceph-dashboard-7: 22:34:12 INFO juju.worker.uniter awaiting error resolution for "relation-changed" hook
unit-ceph-dashboard-7: 22:34:13 WARNING unit.ceph-dashboard/7.dashboard-relation-changed Error EINVAL: unrecognized config option 'mgr/dashboard/ceph-3/server_addr'
unit-ceph-dashboard-7: 22:34:13 ERROR unit.ceph-dashboard/7.juju-log dashboard:3: Uncaught exception while in charm code:

----
Traceback (most recent call last):
  File "/var/lib/juju/agents/unit-ceph-dashboard-7/charm/./src/charm.py", line 769, in <module>
    main(CephDashboardCharm)
  File "/var/lib/juju/agents/unit-ceph-dashboard-7/charm/venv/ops/main.py", line 431, in main
    _emit_charm_event(charm, dispatcher.event_name)
  File "/var/lib/juju/agents/unit-ceph-dashboard-7/charm/venv/ops/main.py", line 142, in _emit_charm_event
    event_to_emit.emit(*args, **kwargs)
  File "/var/lib/juju/agents/unit-ceph-dashboard-7/charm/venv/ops/framework.py", line 316, in emit
    framework._emit(event)
  File "/var/lib/juju/agents/unit-ceph-dashboard-7/charm/venv/ops/framework.py", line 784, in _emit
    self._reemit(event_path)
  File "/var/lib/juju/agents/unit-ceph-dashboard-7/charm/venv/ops/framework.py", line 857, in _reemit
    custom_handler(event)
  File "/var/lib/juju/agents/unit-ceph-dashboard-7/charm/src/interface_dashboard.py", line 50, in on_changed
    self.on.mon_ready.emit()
  File "/var/lib/juju/agents/unit-ceph-dashboard-7/charm/venv/ops/framework.py", line 316, in emit
    framework._emit(event)
  File "/var/lib/juju/agents/unit-ceph-dashboard-7/charm/venv/ops/framework.py", line 784, i...

Read more...

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to charm-ceph-dashboard (stable/quincy.2)

Fix proposed to branch: stable/quincy.2
Review: https://review.opendev.org/c/openstack/charm-ceph-dashboard/+/896527

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on charm-ceph-dashboard (stable/quincy.2)

Change abandoned by "Peter Sabaini <email address hidden>" on branch: stable/quincy.2
Review: https://review.opendev.org/c/openstack/charm-ceph-dashboard/+/896527
Reason: Wront cherry pick

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to charm-ceph-dashboard (stable/quincy.2)

Fix proposed to branch: stable/quincy.2
Review: https://review.opendev.org/c/openstack/charm-ceph-dashboard/+/896742

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on charm-ceph-dashboard (stable/quincy.2)

Change abandoned by "Peter Sabaini <email address hidden>" on branch: stable/quincy.2
Review: https://review.opendev.org/c/openstack/charm-ceph-dashboard/+/896527
Reason: Redo due to conflict

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to charm-ceph-dashboard (stable/quincy.2)

Reviewed: https://review.opendev.org/c/openstack/charm-ceph-dashboard/+/896742
Committed: https://opendev.org/openstack/charm-ceph-dashboard/commit/2f7c246e38e8148940502ac0bd0745da6b4f244c
Submitter: "Zuul (22348)"
Branch: stable/quincy.2

commit 2f7c246e38e8148940502ac0bd0745da6b4f244c
Author: Utkarsh Bhatt <email address hidden>
Date: Fri Sep 1 13:11:41 2023 +0530

    Adds dashboard enablement/deferral logic improvements

    Closes-Bug: 2033886
    cherry-picked from: I2f4d4dfa890fc79f7f5d5b1273a11907b60e8255

    Change-Id: I63fbe0776c92419d8b047bab151e01c4f1f3f45e

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.