mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-07-28 11:02:43 +00:00
block uploader restore implementation
Signed-off-by: Lyndon-Li <lyonghui@vmware.com>
This commit is contained in:
@@ -121,7 +121,10 @@ func snapshotSource(
|
||||
return "", 0, errors.Wrapf(err, "Failed to run uploader backup for si %v", source)
|
||||
}
|
||||
|
||||
snap.Tags = make(map[string]string)
|
||||
if snap.Tags == nil {
|
||||
snap.Tags = make(map[string]string)
|
||||
}
|
||||
|
||||
snap.Tags[uploader.CBTChangeIDTag] = cbtSource.ChangeID
|
||||
snap.Tags[uploader.CBTVolumeIDTag] = cbtSource.VolumeID
|
||||
if snapshotTags != nil {
|
||||
|
||||
@@ -155,7 +155,7 @@ func (blkup *blockUploader) Restore(snapshot udmrepo.Snapshot, dest destInfo, bi
|
||||
}
|
||||
|
||||
if len(meta.SubObjects) != 1 {
|
||||
return 0, errors.Wrapf(err, "unexpected number of bdev object (%d) for snapshot %s", len(meta.SubObjects), snapshot.Description)
|
||||
return 0, errors.Errorf("unexpected number of bdev object (%d) for snapshot %s", len(meta.SubObjects), snapshot.Description)
|
||||
}
|
||||
|
||||
sourceSize, err := getSourceSize(snapshot)
|
||||
|
||||
@@ -483,7 +483,7 @@ func TestGetSourceSize(t *testing.T) {
|
||||
name: "invalid tag value",
|
||||
snapshot: udmrepo.Snapshot{
|
||||
Tags: map[string]string{
|
||||
"bdev-source-size": "abc",
|
||||
bdevSourceSizeTag: "abc",
|
||||
},
|
||||
},
|
||||
expectErr: true,
|
||||
@@ -492,7 +492,7 @@ func TestGetSourceSize(t *testing.T) {
|
||||
name: "valid tag value",
|
||||
snapshot: udmrepo.Snapshot{
|
||||
Tags: map[string]string{
|
||||
"bdev-source-size": "1048576",
|
||||
bdevSourceSizeTag: "1048576",
|
||||
},
|
||||
},
|
||||
expectErr: false,
|
||||
@@ -667,7 +667,7 @@ func TestBlockUploaderRestore(t *testing.T) {
|
||||
Description: "test snapshot",
|
||||
RootObject: udmrepo.ObjectMetadata{ID: "root-id"},
|
||||
Tags: map[string]string{
|
||||
"bdev-source-size": "1048576",
|
||||
bdevSourceSizeTag: "1048576",
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user