Avoid wrapping failed PVB status with empty message.
Also change "get" to "found" as requested in issue #7857. Signed-off-by: Matthew Arnold <marnold@redhat.com>pull/8028/head
parent
55e027897c
commit
c8a0c345dc
|
@ -412,7 +412,7 @@ func (s *nodeAgentServer) markInProgressPVBsFailed(client ctrlclient.Client) {
|
|||
}
|
||||
|
||||
if err := controller.UpdatePVBStatusToFailed(s.ctx, client, &pvbs.Items[i],
|
||||
fmt.Errorf("get a podvolumebackup with status %q during the server starting, mark it as %q", velerov1api.PodVolumeBackupPhaseInProgress, velerov1api.PodVolumeBackupPhaseFailed),
|
||||
fmt.Errorf("found a podvolumebackup with status %q during the server starting, mark it as %q", velerov1api.PodVolumeBackupPhaseInProgress, velerov1api.PodVolumeBackupPhaseFailed),
|
||||
"", time.Now(), s.logger); err != nil {
|
||||
s.logger.WithError(errors.WithStack(err)).Errorf("failed to patch podvolumebackup %q", pvb.GetName())
|
||||
continue
|
||||
|
|
|
@ -19,6 +19,7 @@ package controller
|
|||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
|
@ -373,7 +374,11 @@ func UpdatePVBStatusToFailed(ctx context.Context, c client.Client, pvb *velerov1
|
|||
if dataPathError, ok := errOut.(datapath.DataPathError); ok {
|
||||
pvb.Status.SnapshotID = dataPathError.GetSnapshotID()
|
||||
}
|
||||
pvb.Status.Message = errors.WithMessage(errOut, msg).Error()
|
||||
if len(strings.TrimSpace(msg)) == 0 {
|
||||
pvb.Status.Message = errOut.Error()
|
||||
} else {
|
||||
pvb.Status.Message = errors.WithMessage(errOut, msg).Error()
|
||||
}
|
||||
err := c.Patch(ctx, pvb, client.MergeFrom(original))
|
||||
if err != nil {
|
||||
log.WithError(err).Error("error updating PodVolumeBackup status")
|
||||
|
|
Loading…
Reference in New Issue