internal/volumes_information.go: reuse constants from pkg/apis/velero/v1 (#8446)

Signed-off-by: Tiger Kaovilai <tkaovila@redhat.com>
pull/8455/head
Tiger Kaovilai 2024-11-24 23:40:10 -05:00 committed by GitHub
parent 9f0026d7dc
commit 2bf98d3965
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 14 deletions

View File

@ -49,13 +49,7 @@ const (
const (
FieldValueIsUnknown string = "unknown"
kopia string = "kopia"
veleroDatamover string = "velero"
//TODO reuse these constants from csi-plugin-for-velero after it's merged into the same repo
CSIDriverNameAnnotation = "velero.io/csi-driver-name"
VolumeSnapshotHandleAnnotation = "velero.io/csi-volumesnapshot-handle"
)
type BackupVolumeInfo struct {
@ -647,7 +641,7 @@ func (v *BackupVolumesInformation) generateVolumeInfoFromDataUpload() {
},
SnapshotDataMovementInfo: &SnapshotDataMovementInfo{
DataMover: dataMover,
UploaderType: kopia,
UploaderType: velerov1api.BackupRepositoryTypeKopia,
OperationID: operation.Spec.OperationID,
Phase: dataUpload.Status.Phase,
},
@ -850,9 +844,9 @@ func (t *RestoreVolumeInfoTracker) Result() []*RestoreVolumeInfo {
SnapshotDataMoved: false,
RestoreMethod: CSISnapshot,
CSISnapshotInfo: &CSISnapshotInfo{
SnapshotHandle: csiSnapshot.Annotations[VolumeSnapshotHandleAnnotation],
SnapshotHandle: csiSnapshot.Annotations[velerov1api.VolumeSnapshotHandleAnnotation],
Size: restoreSize,
Driver: csiSnapshot.Annotations[CSIDriverNameAnnotation],
Driver: csiSnapshot.Annotations[velerov1api.DriverNameAnnotation],
VSCName: vscName,
},
}
@ -889,7 +883,7 @@ func (t *RestoreVolumeInfoTracker) Result() []*RestoreVolumeInfo {
RestoreMethod: CSISnapshot,
SnapshotDataMovementInfo: &SnapshotDataMovementInfo{
DataMover: dataMover,
UploaderType: kopia,
UploaderType: velerov1api.BackupRepositoryTypeKopia,
SnapshotHandle: dd.Spec.SnapshotID,
OperationID: operationID,
},

View File

@ -1170,8 +1170,8 @@ func TestRestoreVolumeInfoResult(t *testing.T) {
pvcCSISnapshotMap: map[string]snapshotv1api.VolumeSnapshot{
"testNS/testPVC": *builder.ForVolumeSnapshot("sourceNS", "testCSISnapshot").
ObjectMeta(
builder.WithAnnotations(VolumeSnapshotHandleAnnotation, "csi-snap-001",
CSIDriverNameAnnotation, "test-csi-driver"),
builder.WithAnnotations(velerov1api.VolumeSnapshotHandleAnnotation, "csi-snap-001",
velerov1api.DriverNameAnnotation, "test-csi-driver"),
).SourceVolumeSnapshotContentName("test-vsc-001").
Status().RestoreSize("1Gi").Result(),
},
@ -1269,7 +1269,7 @@ func TestRestoreVolumeInfoResult(t *testing.T) {
SnapshotDataMoved: true,
SnapshotDataMovementInfo: &SnapshotDataMovementInfo{
DataMover: "velero",
UploaderType: kopia,
UploaderType: velerov1api.BackupRepositoryTypeKopia,
SnapshotHandle: "dd-snap-001",
OperationID: "dd-operation-001",
},
@ -1282,7 +1282,7 @@ func TestRestoreVolumeInfoResult(t *testing.T) {
SnapshotDataMoved: true,
SnapshotDataMovementInfo: &SnapshotDataMovementInfo{
DataMover: "velero",
UploaderType: kopia,
UploaderType: velerov1api.BackupRepositoryTypeKopia,
SnapshotHandle: "dd-snap-002",
OperationID: "dd-operation-002",
},