Skip to content

Commit c1dbebf

Browse files
committed
fix zone matching
1 parent d324cae commit c1dbebf

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

internal/provider/csi/controller/volume.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,14 @@ func (c *Controller) CreateVolume(ctx context.Context, request *csi.CreateVolume
3333
if violations := validateCapabilities(request.VolumeCapabilities); len(violations) > 0 {
3434
return nil, status.Error(codes.InvalidArgument, fmt.Sprintf("volume capabilities cannot be satisified: %s", strings.Join(violations, "; ")))
3535
}
36-
toppology := []*csi.Topology{}
36+
volumeTopology := []*csi.Topology{}
3737
zone := ""
3838
if request.AccessibilityRequirements != nil && request.AccessibilityRequirements.Preferred != nil {
3939
for _, topology := range request.AccessibilityRequirements.Preferred {
4040
if zoneSegment, ok := topology.Segments[c.Driver.Name+"/zone"]; ok && zoneSegment != "" {
4141
zone = zoneSegment
42-
toppology = request.AccessibilityRequirements.Preferred
42+
volumeTopology = []*csi.Topology{{Segments: map[string]string{c.Driver.Name + "/zone": zone}}}
43+
break
4344
}
4445
}
4546
}
@@ -92,7 +93,7 @@ func (c *Controller) CreateVolume(ctx context.Context, request *csi.CreateVolume
9293
c.Driver.Name + "/serial": serial,
9394
c.Driver.Name + "/zone": zone,
9495
},
95-
AccessibleTopology: toppology,
96+
AccessibleTopology: volumeTopology,
9697
},
9798
}, nil
9899
}

0 commit comments

Comments
 (0)