Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(system-backup): support backup backing image #2710

Conversation

ChanYiLin
Copy link
Contributor

ref: longhorn/longhorn#5085

  1. Backup all BackingImages after backing up Volumes and their yaml when taking system-backup
    • After backing up Volumes: Because now we already backup BackingImage when backing up Volumes, In this stage, we only backup those BackingImages not being used.
  2. Restore BackingImages before restoring Volumes, so the Volumes with BackingImages can restore successfully.
    • Before restoring Volumes: Because Volume with BackingImage creation will fail if there is no BackingImage in the cluster
    • If the BackingImage already exists, update the tag last-skipped-system-restored and last-skipped-system-restored-at
    • If the BackingImage does not exist, restore it by creating restore type BackingImage
      • use Checksum: restore.Status.Checksum, to verify the BackingImage (checksum from the yaml system-backup stored)
      • update the tag last-system-restored and last-system-restored-at

@ChanYiLin ChanYiLin self-assigned this Mar 26, 2024
@ChanYiLin ChanYiLin force-pushed the LH5085_support_system_backup_backingimage branch 6 times, most recently from aed6527 to 42619ff Compare April 15, 2024 06:33
@ChanYiLin ChanYiLin marked this pull request as ready for review April 15, 2024 06:34
@ChanYiLin
Copy link
Contributor Author

Manual Test

  1. Create a BackingImage and a volume using it
  2. Create a system-backup
  3. kubectl get lhbbi, lhb -n longhorn-system will see the backup of the Volume and the Backingimage
  4. Delete the Volume and the BackingImage
  5. Restore the system-backup
  6. The BackingImage and the Volume will be restored. The BackingImage source type will be restored and the checksum will be verified.

@c3y1huang
Copy link
Contributor

c3y1huang commented Apr 17, 2024

ref: longhorn/longhorn#5085

  1. Backup all BackingImages after backing up Volumes and their yaml when taking system-backup

    • After backing up Volumes: Because now we already backup BackingImage when backing up Volumes, In this stage, we only backup those BackingImages not being used.
  2. Restore BackingImages before restoring Volumes, so the Volumes with BackingImages can restore successfully.

    • Before restoring Volumes: Because Volume with BackingImage creation will fail if there is no BackingImage in the cluster

    • If the BackingImage already exists, update the tag last-skipped-system-restored and last-skipped-system-restored-at

    • If the BackingImage does not exist, restore it by creating restore type BackingImage

      • use Checksum: restore.Status.Checksum, to verify the BackingImage (checksum from the yaml system-backup stored)
      • update the tag last-system-restored and last-system-restored-at

Could you also help to update the LEP?

@c3y1huang
Copy link
Contributor

Manual Test

  1. Create a BackingImage and a volume using it
  2. Create a system-backup
  3. kubectl get lhbbi, lhb -n longhorn-system will see the backup of the Volume and the Backingimage
  4. Delete the Volume and the BackingImage
  5. Restore the system-backup
  6. The BackingImage and the Volume will be restored. The BackingImage source type will be restored and the checksum will be verified.

Can this be automated?
https://github.com/longhorn/longhorn-tests/blob/master/manager/integration/tests/test_system_backup_restore.py

@ChanYiLin
Copy link
Contributor Author

Hi @c3y1huang
Sure, I will update the LEP and the e2e tests.
Thanks for the reminder.

@ChanYiLin
Copy link
Contributor Author

Hi @c3y1huang
Here is the update of the lep: longhorn/longhorn#8389
PTAL, thanks!

@derekbit derekbit requested a review from shuo-wu April 18, 2024 07:27
@ChanYiLin
Copy link
Contributor Author

Hi @c3y1huang
Here is the e2e test: longhorn/longhorn-tests#1864
Thanks!

Copy link

mergify bot commented Apr 23, 2024

This pull request is now in conflict. Could you fix it @ChanYiLin? 🙏

1 similar comment
Copy link

mergify bot commented Apr 24, 2024

This pull request is now in conflict. Could you fix it @ChanYiLin? 🙏

@ChanYiLin ChanYiLin force-pushed the LH5085_support_system_backup_backingimage branch from 42619ff to 746b733 Compare April 30, 2024 03:40
@ChanYiLin
Copy link
Contributor Author

This pull request is now in conflict. Could you fix it @ChanYiLin? 🙏

Fixed.

@ChanYiLin ChanYiLin force-pushed the LH5085_support_system_backup_backingimage branch from 746b733 to c6965b1 Compare April 30, 2024 09:57
c3y1huang
c3y1huang previously approved these changes May 2, 2024
@ChanYiLin ChanYiLin force-pushed the LH5085_support_system_backup_backingimage branch 3 times, most recently from b5add36 to ce7c71b Compare May 6, 2024 09:43
ref: longhorn/longhorn 5085

Signed-off-by: Jack Lin <jack.lin@suse.com>
@derekbit derekbit force-pushed the LH5085_support_system_backup_backingimage branch from ce7c71b to c253ee2 Compare May 7, 2024 06:01
Copy link
Member

@derekbit derekbit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@derekbit derekbit merged commit 1f86d76 into longhorn:master May 7, 2024
7 checks passed
@ChanYiLin
Copy link
Contributor Author

@mergify backport v1.6.x

Copy link

mergify bot commented May 27, 2024

backport v1.6.x

✅ Backports have been created

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants