Merge pull request #10146 from blackpiglet/jxun/modify_parent_snapshot_in_data_mover_when_is_none

Modify the ParentSnapshot to "" and ForceFull to true when ParentSnapshot is "none".
This commit is contained in:
Shubham Pampattiwar
2026-08-03 09:59:48 -07:00
committed by GitHub
+13 -6
View File
@@ -23,15 +23,16 @@ import (
"github.com/cockroachdb/errors"
"github.com/sirupsen/logrus"
apierrors "k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/types"
"k8s.io/apimachinery/pkg/util/wait"
"k8s.io/client-go/kubernetes"
"sigs.k8s.io/controller-runtime/pkg/client"
cachetool "k8s.io/client-go/tools/cache"
"sigs.k8s.io/controller-runtime/pkg/cache"
"sigs.k8s.io/controller-runtime/pkg/client"
"github.com/vmware-tanzu/velero/internal/credentials"
veleroshared "github.com/vmware-tanzu/velero/pkg/apis/velero/shared"
velerov1api "github.com/vmware-tanzu/velero/pkg/apis/velero/v1"
velerov2alpha1api "github.com/vmware-tanzu/velero/pkg/apis/velero/v2alpha1"
"github.com/vmware-tanzu/velero/pkg/cbtservice"
@@ -39,8 +40,6 @@ import (
"github.com/vmware-tanzu/velero/pkg/repository"
"github.com/vmware-tanzu/velero/pkg/uploader"
"github.com/vmware-tanzu/velero/pkg/util/kube"
apierrors "k8s.io/apimachinery/pkg/api/errors"
)
const (
@@ -205,10 +204,18 @@ func (r *BackupMicroService) RunCancelableDataPath(ctx context.Context) (string,
velerov1api.AsyncOperationIDLabel: du.Labels[velerov1api.AsyncOperationIDLabel],
}
// Modify the ParentSnapshot to "" and ForceFull to true when ParentSnapshot is "none".
parentSnapshot := du.Spec.ParentSnapshot
forceFull := false
if du.Spec.ParentSnapshot == veleroshared.DataUploadParentSnapshotNone {
parentSnapshot = ""
forceFull = true
}
if err := dp.StartBackup(r.sourceTargetPath, du.Spec.DataMoverConfig, &datapath.BackupStartParam{
RealSource: GetRealSource(du.Spec.SourceNamespace, du.Spec.SourcePVC),
ParentSnapshot: du.Spec.ParentSnapshot,
ForceFull: false,
ParentSnapshot: parentSnapshot,
ForceFull: forceFull,
Tags: tags,
VolumeID: r.volumeID,
ChangeID: r.changeID,