mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-09-19 22:44:21 +00:00
add PartiallyFailed phase for backups, log+continue on errors (#1386)
Signed-off-by: Steve Kriss <krisss@vmware.com>
This commit is contained in:
@@ -50,7 +50,10 @@ func NewLogsCommand(f client.Factory) *cobra.Command {
|
||||
cmd.Exit("Error checking for backup %q: %v", backupName, err)
|
||||
}
|
||||
|
||||
if backup.Status.Phase != v1.BackupPhaseCompleted && backup.Status.Phase != v1.BackupPhaseFailed {
|
||||
switch backup.Status.Phase {
|
||||
case v1.BackupPhaseCompleted, v1.BackupPhasePartiallyFailed, v1.BackupPhaseFailed:
|
||||
// terminal phases, do nothing.
|
||||
default:
|
||||
cmd.Exit("Logs for backup %q are not available until it's finished processing. Please wait "+
|
||||
"until the backup has a phase of Completed or Failed and try again.", backupName)
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2017 the Velero contributors.
|
||||
Copyright 2017, 2019 the Velero contributors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
@@ -47,7 +47,13 @@ func DescribeBackup(
|
||||
if phase == "" {
|
||||
phase = velerov1api.BackupPhaseNew
|
||||
}
|
||||
d.Printf("Phase:\t%s\n", phase)
|
||||
|
||||
logsNote := ""
|
||||
if backup.Status.Phase == velerov1api.BackupPhaseFailed || backup.Status.Phase == velerov1api.BackupPhasePartiallyFailed {
|
||||
logsNote = fmt.Sprintf(" (run `velero backup logs %s` for more information)", backup.Name)
|
||||
}
|
||||
|
||||
d.Printf("Phase:\t%s%s\n", phase, logsNote)
|
||||
|
||||
status := backup.Status
|
||||
if len(status.ValidationErrors) > 0 {
|
||||
@@ -58,6 +64,12 @@ func DescribeBackup(
|
||||
}
|
||||
}
|
||||
|
||||
if status.Phase == velerov1api.BackupPhasePartiallyFailed {
|
||||
d.Println()
|
||||
d.Printf("Errors:\t%d\n", status.Errors)
|
||||
d.Printf("Warnings:\t%d\n", status.Warnings)
|
||||
}
|
||||
|
||||
d.Println()
|
||||
DescribeBackupSpec(d, backup.Spec)
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2017 the Velero contributors.
|
||||
Copyright 2017, 2019 the Velero contributors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
@@ -85,13 +85,21 @@ func printBackup(backup *velerov1api.Backup, w io.Writer, options printers.Print
|
||||
expiration = backup.CreationTimestamp.Add(backup.Spec.TTL.Duration)
|
||||
}
|
||||
|
||||
status := backup.Status.Phase
|
||||
status := string(backup.Status.Phase)
|
||||
if status == "" {
|
||||
status = velerov1api.BackupPhaseNew
|
||||
status = string(velerov1api.BackupPhaseNew)
|
||||
}
|
||||
if backup.DeletionTimestamp != nil && !backup.DeletionTimestamp.Time.IsZero() {
|
||||
status = "Deleting"
|
||||
}
|
||||
if status == string(velerov1api.BackupPhasePartiallyFailed) {
|
||||
if backup.Status.Errors == 1 {
|
||||
status = fmt.Sprintf("%s (1 error)", status)
|
||||
} else {
|
||||
status = fmt.Sprintf("%s (%d errors)", status, backup.Status.Errors)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
location := backup.Spec.StorageLocation
|
||||
|
||||
|
||||
Reference in New Issue
Block a user