[backup] [ceph] Catch ImageNotFound for incremental backup

When doing an incremental backup and it gets scheduled to a node
that does not have access to the base backup we leak the entire
RBD message into the fail_reason field of the volume backup.

  [errno 2] RBD image not found (error opening image
  b'volume-e4cdd6d1-e5b5-4f86-b201-f6dace37432d.backup.f60c5a19-509c-4d8c-bb78-e11c7d3c5a3f'
  at snapshot None)

This changes so that we instead return a message that the base
backup image was not found.

Change-Id: Ic87a96c4502925a9f9a3d0a41aa852ac32843626
This commit is contained in:
Tobias Urdin 2024-04-22 14:44:59 +02:00
parent b36142602e
commit 820f31ec40

View File

@ -770,9 +770,16 @@ class CephBackupDriver(driver.BackupDriver):
with eventlet.tpool.Proxy(rbd_driver.RADOSClient(self, with eventlet.tpool.Proxy(rbd_driver.RADOSClient(self,
container)) as client: container)) as client:
base_rbd = eventlet.tpool.Proxy(self.rbd.Image(client.ioctx, try:
base_name, base_rbd = eventlet.tpool.Proxy(
read_only=True)) self.rbd.Image(client.ioctx, base_name, read_only=True))
except rbd.ImageNotFound:
msg = (_(
"Can't find base name image %(base)s.") %
{'base': base_name})
LOG.error(msg)
raise exception.BackupRBDOperationFailed(msg)
try: try:
from_snap = self._get_backup_snap_name(base_rbd, from_snap = self._get_backup_snap_name(base_rbd,
base_name, base_name,