Skip to content

Commit 924d450

Browse files
authored
manila-csi-plugin: Trivial fixups (#2745)
As highlighted at [1]. [1] #2743 Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
1 parent bfc2ab8 commit 924d450

File tree

2 files changed

+11
-14
lines changed

2 files changed

+11
-14
lines changed

pkg/csi/manila/driver.go

+1-6
Original file line numberDiff line numberDiff line change
@@ -130,16 +130,11 @@ func NewDriver(o *DriverOpts) (*Driver, error) {
130130
klog.Info("Driver: ", d.name)
131131
klog.Info("Driver version: ", d.fqVersion)
132132
klog.Info("CSI spec version: ", specVersion)
133+
klog.Infof("Topology awareness: %T", d.withTopology)
133134

134135
getShareAdapter(d.shareProto) // The program will terminate with a non-zero exit code if the share protocol selector is wrong
135136
klog.Infof("Operating on %s shares", d.shareProto)
136137

137-
if d.withTopology {
138-
klog.Infof("Topology awareness enabled")
139-
} else {
140-
klog.Info("Topology awareness disabled")
141-
}
142-
143138
serverProto, serverAddr, err := parseGRPCEndpoint(o.ServerCSIEndpoint)
144139
if err != nil {
145140
return nil, fmt.Errorf("failed to parse server endpoint address %s: %v", o.ServerCSIEndpoint, err)

pkg/csi/manila/nodeserver.go

+10-8
Original file line numberDiff line numberDiff line change
@@ -335,15 +335,17 @@ func (ns *nodeServer) NodeGetInfo(ctx context.Context, req *csi.NodeGetInfoReque
335335
NodeId: nodeID,
336336
}
337337

338-
if ns.d.withTopology {
339-
zone, err := ns.metadata.GetAvailabilityZone()
340-
if err != nil {
341-
return nil, status.Errorf(codes.Internal, "[NodeGetInfo] Unable to retrieve availability zone of node %v", err)
342-
}
338+
if !ns.d.withTopology {
339+
return nodeInfo, nil
340+
}
343341

344-
nodeInfo.AccessibleTopology = &csi.Topology{
345-
Segments: map[string]string{topologyKey: zone},
346-
}
342+
zone, err := ns.metadata.GetAvailabilityZone()
343+
if err != nil {
344+
return nil, status.Errorf(codes.Internal, "[NodeGetInfo] Unable to retrieve availability zone of node %v", err)
345+
}
346+
347+
nodeInfo.AccessibleTopology = &csi.Topology{
348+
Segments: map[string]string{topologyKey: zone},
347349
}
348350

349351
return nodeInfo, nil

0 commit comments

Comments
 (0)