azure: restore volumes with zone (#1298)

Signed-off-by: Sylvain Rabot <sylvain@abstraction.fr>
pull/1407/head
Sylvain Rabot 2019-04-25 20:25:57 +02:00 committed by KubeKween
parent dda76b05a8
commit 011db15f1c
2 changed files with 7 additions and 0 deletions

View File

@ -0,0 +1 @@
azure: restore volumes in the original region's zone

View File

@ -162,6 +162,12 @@ func (b *VolumeSnapshotter) CreateVolumeFromSnapshot(snapshotID, volumeType, vol
Tags: snapshotInfo.Tags,
}
// Restore the disk in the correct zone
regionParts := strings.Split(volumeAZ, "-")
if len(regionParts) >= 2 {
disk.Zones = &[]string{regionParts[len(regionParts)-1]}
}
ctx, cancel := context.WithTimeout(context.Background(), b.apiTimeout)
defer cancel()