remove backup.status.volumeBackups and all related code

Signed-off-by: Steve Kriss <krisss@vmware.com>
This commit is contained in:
Steve Kriss
2019-04-11 13:57:17 -06:00
parent 6ed4e1f147
commit c59544cb79
12 changed files with 27 additions and 471 deletions

View File

@@ -329,26 +329,6 @@ func (c *restoreController) validateAndComplete(restore *api.Restore, pluginMana
return backupInfo{}
}
// Ensure that we have either .status.volumeBackups (for pre-v0.10 backups) OR a
// volumesnapshots.json.gz file in obj storage (for v0.10+ backups), but not both.
// If we have .status.volumeBackups, ensure that there's only one volume snapshot
// location configured.
if info.backup.Status.VolumeBackups != nil {
snapshots, err := info.backupStore.GetBackupVolumeSnapshots(info.backup.Name)
if err != nil {
restore.Status.ValidationErrors = append(restore.Status.ValidationErrors, errors.Wrap(err, "Error checking for volumesnapshots file").Error())
} else if len(snapshots) > 0 {
restore.Status.ValidationErrors = append(restore.Status.ValidationErrors, "Backup must not have both .status.volumeBackups and a volumesnapshots.json.gz file in object storage")
} else {
locations, err := c.snapshotLocationLister.VolumeSnapshotLocations(restore.Namespace).List(labels.Everything())
if err != nil {
restore.Status.ValidationErrors = append(restore.Status.ValidationErrors, errors.Wrap(err, "Error listing volume snapshot locations").Error())
} else if len(locations) > 1 {
restore.Status.ValidationErrors = append(restore.Status.ValidationErrors, "Cannot restore backup with .status.volumeBackups when more than one volume snapshot location exists")
}
}
}
// Fill in the ScheduleName so it's easier to consume for metrics.
if restore.Spec.ScheduleName == "" {
restore.Spec.ScheduleName = info.backup.GetLabels()[velerov1api.ScheduleNameLabel]