Skip to content

Commit

Permalink
fix(system backup/restore): disaster recovery (DR) volume
Browse files Browse the repository at this point in the history
longhorn/longhorn-9330

Signed-off-by: Chin-Ya Huang <chin-ya.huang@suse.com>
(cherry picked from commit 9b73085)
  • Loading branch information
c3y1huang authored and derekbit committed Aug 29, 2024
1 parent 8cae6bb commit cead92a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions controller/system_backup_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -731,6 +731,13 @@ func (c *SystemBackupController) backupVolumesAlways(systemBackup *longhorn.Syst

volumeBackups := make(map[string]*longhorn.Backup, len(volumes))
for _, volume := range volumes {
// Don't need to create volume data backup for DR volumes since it will
// be restored from the source volume's backup.
if volume.Status.IsStandby {
c.logger.Infof("Skip backup for standby volume %v", volume.Name)
continue
}

backup, err := c.createVolumeBackup(volume, systemBackup)
if err != nil {
return nil, err
Expand Down
2 changes: 1 addition & 1 deletion controller/system_rollout_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -1906,7 +1906,7 @@ func (c *SystemRolloutController) restoreVolumes() (err error) {
restore.ResourceVersion = ""
restore.Spec.NodeID = ""

if restore.Status.LastBackup != "" {
if restore.Status.LastBackup != "" && !restore.Status.IsStandby {
restore.Spec.FromBackup = backupstore.EncodeBackupURL(restore.Status.LastBackup, restore.Name, c.backupTargetURL)
log = log.WithField("fromBackup", restore.Spec.FromBackup)
}
Expand Down

0 comments on commit cead92a

Please sign in to comment.