diff --git a/internal/volume/volumes_information.go b/internal/volume/volumes_information.go index 7d793425c4..9af6d7fe34 100644 --- a/internal/volume/volumes_information.go +++ b/internal/volume/volumes_information.go @@ -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, }, diff --git a/internal/volume/volumes_information_test.go b/internal/volume/volumes_information_test.go index 8afd44dde6..3233e98ce0 100644 --- a/internal/volume/volumes_information_test.go +++ b/internal/volume/volumes_information_test.go @@ -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", },