Skip to content

Commit

Permalink
manila-csi-plugin: Trivial fixups (#2745)
Browse files Browse the repository at this point in the history
As highlighted at [1].

[1] #2743

Signed-off-by: Stephen Finucane <[email protected]>
  • Loading branch information
stephenfin authored Dec 11, 2024
1 parent bfc2ab8 commit 924d450
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 14 deletions.
7 changes: 1 addition & 6 deletions pkg/csi/manila/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,16 +130,11 @@ func NewDriver(o *DriverOpts) (*Driver, error) {
klog.Info("Driver: ", d.name)
klog.Info("Driver version: ", d.fqVersion)
klog.Info("CSI spec version: ", specVersion)
klog.Infof("Topology awareness: %T", d.withTopology)

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

if d.withTopology {
klog.Infof("Topology awareness enabled")
} else {
klog.Info("Topology awareness disabled")
}

serverProto, serverAddr, err := parseGRPCEndpoint(o.ServerCSIEndpoint)
if err != nil {
return nil, fmt.Errorf("failed to parse server endpoint address %s: %v", o.ServerCSIEndpoint, err)
Expand Down
18 changes: 10 additions & 8 deletions pkg/csi/manila/nodeserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -335,15 +335,17 @@ func (ns *nodeServer) NodeGetInfo(ctx context.Context, req *csi.NodeGetInfoReque
NodeId: nodeID,
}

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

nodeInfo.AccessibleTopology = &csi.Topology{
Segments: map[string]string{topologyKey: zone},
}
zone, err := ns.metadata.GetAvailabilityZone()
if err != nil {
return nil, status.Errorf(codes.Internal, "[NodeGetInfo] Unable to retrieve availability zone of node %v", err)
}

nodeInfo.AccessibleTopology = &csi.Topology{
Segments: map[string]string{topologyKey: zone},
}

return nodeInfo, nil
Expand Down

0 comments on commit 924d450

Please sign in to comment.