Repository navigation
Conversation
ba38ead to
ac70d41
Compare
ff3e96d to
5b9224f
Compare
Signed-off-by: guno327 <gunnar.hovik@canonical.com>
5b9224f to
3390e7b
Compare
| for secret_uuid, (key, usage) in desired.items(): | ||
| try: | ||
| _ensure_secret(secret_uuid, key, usage) | ||
| except libvirt.libvirtError: |
There was a problem hiding this comment.
If libvirt rejects the replacement, the old secret has already been undefined and this catch lets the configure hook succeed. I reproduced that with an injected libvirt error. Can we set the value in place when the UUID is unchanged and surface failed updates to the caller? A successful snap configuration change can otherwise leave the compute without the secret it needs. Secret replacement
| def _prune_ceph_secrets(keep: set[str]) -> None: | ||
| """Undefine per-backend secrets whose backend is gone.""" | ||
| libvirt = _get_libvirt() | ||
| conn = libvirt.open("qemu:///system") |
There was a problem hiding this comment.
This opens libvirt even when the host has no Ceph settings. I injected an unavailable libvirt socket with an empty Ceph config. The previous implementation returned without opening the socket, while this path raised before the configure hook could reach Masakari or SR-IOV. Can we handle cleanup failure here so unrelated configuration can still proceed?
| libvirt = _get_libvirt() | ||
| desired = _desired_ceph_secrets(snap) | ||
| # Prune first, then add to handle same app getting new UUID | ||
| _prune_ceph_secrets(keep=set(desired)) |
There was a problem hiding this comment.
When a backend changes UUID, this removes the old secret before trying to define the replacement. I injected a failure in that second step: the old secret was already gone and configure returned normally. Could we preserve the old secret if the UUID change fails and add a regression test for that path?
To support the OS121 remote ceph feature, this snap needs to support
multiple
ceph-accessbackends, which means storing one libvirt secret perbackend. During the development work I also found that stale libvirt secrets
were never pruned, so pruning was a necessary addition to this change.
Assisted-By: Claude Opus 5.5
QA steps
tox -e py3,tox -e pep8.ceph-accesskey: the configure hook succeeds.ceph-access.<backend>.uuidand.key):sudo openstack-hypervisor.virsh secret-listshows one secret perbackend, usage
ceph-access.<backend>.ceph-accesskey: its libvirt secret is removed,the other remains.
key: the secret value changes, the uuid does not.Tested
Live on Sunbeam 2026.1, driven by the openstack-hypervisor charm:
ceph-accesskey: configure succeeded;cluster over an offer, an external cluster through ceph-proxy), one
secret each;
external backends, with volumes attached.
Links
Jira card: OPEN-4850
Depends on #230, an existing bug found during development (this branch is based on it).