Ceph backup driver could not restore a volume other than ceph

Bug #1895035 reported by Sofia Enriquez
24
This bug affects 5 people
Affects Status Importance Assigned to Milestone
Cinder
Fix Committed
High
Sofia Enriquez

Bug Description

Steps to Reproduce:
   1. Setup the cinder backup driver to 'cinder.backup.drivers.ceph.CephBackupDriver'

      backup_driver=cinder.backup.drivers.ceph.CephBackupDriver

   2. Create 'LVM' volume.

     $ cinder create --volume-type lvm --name "lvm_vol" 1

   3. Create backup from 'LVM' volume.

     $ cinder backup-create lvm_vol --name "backup_from_lvm_vol"

   4. Create 'LVM' volume to restore the backup.

     $ cinder create --volume-type lvm --name "restore_backup_lvm" 1

   5. Restore from the backup to 4) volume.

     $ cinder backup-restore backup_from_lvm_vol --volume restore_backup_lvm

Actual results:
   Restoring from backup failed

Expected results:
   Restoring from backup success.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to cinder (master)

Fix proposed to branch: master
Review: https://review.opendev.org/750782

Changed in cinder:
assignee: nobody → Sofia Enriquez (lsofia-enriquez)
status: New → In Progress
tags: added: rbd
Revision history for this message
Sofia Enriquez (lsofia-enriquez) wrote :

Currently the Ceph Backend fails when restoring non-ceph volumes. This happens because the current code is generating the wrong base image when performing a full restore. If we are not using a RBD destination volume we need to specify the backup in the same way than If a source snapshot is provided.In order to locale the right base image used for the backup It should use  backup.service_metadata.

Changed in cinder:
importance: Undecided → High
tags: added: backup-service ceph restore
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on cinder (master)

Change abandoned by "Sofia Enriquez <email address hidden>" on branch: master
Review: https://review.opendev.org/c/openstack/cinder/+/750782
Reason: I have decided not to continue with the refactor of the Ceph backup driver for this bug. Instead, I am currently working on the bug mentioned in https://review.opendev.org/c/openstack/cinder/+/880965, and I plan to follow up with a refactor/cleaning of the code for this driver in another patch.

Revision history for this message
Brian Rosmaita (brian-rosmaita) wrote :

I don't know why this is still open. As far as I can tell, it's been addressed by these two patches:

880965: Ceph: Fix restore backups to diff backend | https://review.opendev.org/c/openstack/cinder/+/880965
(merged to master during 2023.2 development)

884526: Ceph: Fix restoring old backups to a different backend | https://review.opendev.org/c/openstack/cinder/+/884526
(merged to master during 2024.1 development)

884526 has been proposed to stable/2023.2, but not yet merged:
https://review.opendev.org/c/openstack/cinder/+/897229

Once both patches are in 2023.2, they should be squashed for backport to stable/2023.1 and stable/zed.

Changed in cinder:
status: In Progress → Fix Committed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to cinder (stable/2023.1)

Fix proposed to branch: stable/2023.1
Review: https://review.opendev.org/c/openstack/cinder/+/910366

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Fix proposed to branch: stable/2023.1
Review: https://review.opendev.org/c/openstack/cinder/+/910815

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on cinder (stable/2023.1)

Change abandoned by "Brian Rosmaita <email address hidden>" on branch: stable/2023.1
Review: https://review.opendev.org/c/openstack/cinder/+/910366
Reason: Abandoned in favor of https://review.opendev.org/c/openstack/cinder/+/910815

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to cinder (stable/2023.1)

Fix proposed to branch: stable/2023.1
Review: https://review.opendev.org/c/openstack/cinder/+/916836

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on cinder (stable/2023.1)

Change abandoned by "Tobias Urdin <email address hidden>" on branch: stable/2023.1
Review: https://review.opendev.org/c/openstack/cinder/+/916836

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to cinder (stable/2023.1)
Download full text (4.5 KiB)

Reviewed: https://review.opendev.org/c/openstack/cinder/+/910815
Committed: https://opendev.org/openstack/cinder/commit/c9330c6b6f17fb41d38fef38cbec49ad41b32714
Submitter: "Zuul (22348)"
Branch: stable/2023.1

commit c9330c6b6f17fb41d38fef38cbec49ad41b32714
Author: Sofia Enriquez <email address hidden>
Date: Thu Apr 20 12:50:17 2023 +0000

    Ceph: Fix restore backups to diff backend

    NOTE: this patch is a squash of the major fix plus a followup that
    addressed some cases not handled in the original patch.

    => Patch one:
    Ceph: Fix restore backups to diff backend
    change: Iff8e1e90ab3c7b519819577ec3aafff838e6934f
    (cherry picked from commit 7b635086cbf4c374d73e6915636cb1e44b10b77d)

    The current implementation of the `_full_restore` method in the Ceph
    backup driver is causing restoration to fail when restoring to another
    volume type. This is because the method generates an incorrect image
    name in the Ceph pool, resulting in the error message:

    ```
    rbd.ImageNotFound: [errno 2] error opening image
    b'volume-a91c11af-1147-4ac7-a5ce-61676736e076.backup.base' at snapshot
    None.
    ```
    Originally, the format `volume-<vol-uuid>.backup-<backup-uuid>` was used
    for every backup created on the Ceph pool. However, after the change
    introduced in commit Ia08c252d747148e624f8d9e8b0e43f94773421e0, the
    base name format was altered to volume-<uuid>.backup.base when
    creating backups from Cinder snapshots.

    This patch modifies the current if statement in _full_restore() to check
    for the presence of a snapshot_id attribute in the backup. If the
    attribute exists, the old base name format is used; otherwise, the new
    format is applied. The if block statement in _full_restore() should now
    match the format generated by the _full_backup() method.

    Additionally, src_snap is activated when the destination volume is RBD
    or if the backup is incremental. Currently, the Ceph backup driver only
    supports incremental RBD backups, so incremental backups from non-RBD
    volumes are not permitted.

    NOTE: This patch primarily mirrors the modifications in
    Ia08c252d747148e624f8d9e8b0e43f94773421e0, addressing it as a partial
    bug fix. There's a consequential patch that further strengthens the
    backup restore operations, which should be considered to fully resolve
    the bug. These two should be squashed and backported together for
    optimal implementation.

    => Patch two:
    Ceph: Fix restoring old backups to a different backend
    change: I074aeb222ca4566b630b5b76529454da4c8b493b
    (cherry picked from commit becf45c6cb5660fae59efe9c92ec7ebff0fcbce2)
    (cherry picked from commit 5d24ae2718520b5623eab23962097ecab5145614)

    There might be scenarios where a very old backup, created from a Cinder
    snapshot, was not handled correctly by my previous patch.

    This new patch addresses this corner case by adding a fallback
    mechanism.

    In Cinder, the base name of the backup volume is generated based either
    on the volume id alone or a combination of the volume id and backup id.
    Two differ...

Read more...

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/cinder 22.2.0

This issue was fixed in the openstack/cinder 22.2.0 release.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.