Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed bug for incorrect volumeAZ in restoration #49

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions velero-plugin-for-alibabacloud/volume_snapshotter.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,10 @@ func (b *VolumeSnapshotter) CreateVolumeFromSnapshot(snapshotID, volumeType, vol

tags := getTagsForCluster(snapRes.Snapshots.Snapshot[0].Tags.Tag)

volumeAZ, err = getMetaData(metadataZoneKey)
if err != nil {
return "", errors.Errorf("failed to get zone-id, got %v", err)
for _, tag := range snapRes.Snapshots.Snapshot[0].Tags.Tag {
if tag.TagKey == "volumeAZ" {
volumeAZ = tag.TagValue
}
}

// filter tags through getTagsForCluster() function in order to apply
Expand Down Expand Up @@ -166,6 +167,7 @@ func (b *VolumeSnapshotter) CreateSnapshot(volumeID, volumeAZ string, tags map[s
req := ecs.CreateCreateSnapshotRequest()
req.DiskId = volumeID

tags["volumeAZ"] = volumeInfo.ZoneId
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Snapshots are not necessarily restored in the same zone that where they were created. Snapshots themselves are regionalized.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there should be more thoughts. @AlbeeSo. any comments?

newTags := getTags(tags, volumeInfo.Tags.Tag)

if len(tags) > 0 {
Expand Down