From d90aa407e7ed5cb271166738d2c067ee702f5daf Mon Sep 17 00:00:00 2001 From: "Shang,Oliver" Date: Wed, 21 Sep 2022 16:18:12 +0800 Subject: [PATCH] fix bug for incorrect volumeAZ in restoration --- velero-plugin-for-alibabacloud/volume_snapshotter.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/velero-plugin-for-alibabacloud/volume_snapshotter.go b/velero-plugin-for-alibabacloud/volume_snapshotter.go index 19428f9e..bd16e9d3 100644 --- a/velero-plugin-for-alibabacloud/volume_snapshotter.go +++ b/velero-plugin-for-alibabacloud/volume_snapshotter.go @@ -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 @@ -166,6 +167,7 @@ func (b *VolumeSnapshotter) CreateSnapshot(volumeID, volumeAZ string, tags map[s req := ecs.CreateCreateSnapshotRequest() req.DiskId = volumeID + tags["volumeAZ"] = volumeInfo.ZoneId newTags := getTags(tags, volumeInfo.Tags.Tag) if len(tags) > 0 {