Skip to content

[release-1.32] [cinder-csi-plugin] Don't report topology capability when --with-topology=False #2871

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: release-1.32
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/csi/cinder/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ func NewDriver(o *DriverOpts) *Driver {
klog.Info("Driver: ", d.name)
klog.Info("Driver version: ", d.fqVersion)
klog.Info("CSI Spec version: ", specVersion)
klog.Infof("Topology awareness: %T", d.withTopology)
klog.Infof("Topology awareness: %t", d.withTopology)

d.AddControllerServiceCapabilities(
[]csi.ControllerServiceCapability_RPC_Type{
Expand Down
51 changes: 27 additions & 24 deletions pkg/csi/cinder/identityserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,36 +53,39 @@ func (ids *identityServer) Probe(ctx context.Context, req *csi.ProbeRequest) (*c

func (ids *identityServer) GetPluginCapabilities(ctx context.Context, req *csi.GetPluginCapabilitiesRequest) (*csi.GetPluginCapabilitiesResponse, error) {
klog.V(5).Infof("GetPluginCapabilities called with req %+v", req)
return &csi.GetPluginCapabilitiesResponse{
Capabilities: []*csi.PluginCapability{
{
Type: &csi.PluginCapability_Service_{
Service: &csi.PluginCapability_Service{
Type: csi.PluginCapability_Service_CONTROLLER_SERVICE,
},
caps := []*csi.PluginCapability{
{
Type: &csi.PluginCapability_Service_{
Service: &csi.PluginCapability_Service{
Type: csi.PluginCapability_Service_CONTROLLER_SERVICE,
},
},
{
Type: &csi.PluginCapability_Service_{
Service: &csi.PluginCapability_Service{
Type: csi.PluginCapability_Service_VOLUME_ACCESSIBILITY_CONSTRAINTS,
},
},
{
Type: &csi.PluginCapability_VolumeExpansion_{
VolumeExpansion: &csi.PluginCapability_VolumeExpansion{
Type: csi.PluginCapability_VolumeExpansion_ONLINE,
},
},
{
Type: &csi.PluginCapability_VolumeExpansion_{
VolumeExpansion: &csi.PluginCapability_VolumeExpansion{
Type: csi.PluginCapability_VolumeExpansion_ONLINE,
},
},
{
Type: &csi.PluginCapability_VolumeExpansion_{
VolumeExpansion: &csi.PluginCapability_VolumeExpansion{
Type: csi.PluginCapability_VolumeExpansion_OFFLINE,
},
},
{
Type: &csi.PluginCapability_VolumeExpansion_{
VolumeExpansion: &csi.PluginCapability_VolumeExpansion{
Type: csi.PluginCapability_VolumeExpansion_OFFLINE,
},
},
}

if ids.Driver.withTopology {
caps = append(caps, &csi.PluginCapability{
Type: &csi.PluginCapability_Service_{
Service: &csi.PluginCapability_Service{
Type: csi.PluginCapability_Service_VOLUME_ACCESSIBILITY_CONSTRAINTS,
},
},
},
}, nil
})
}

return &csi.GetPluginCapabilitiesResponse{Capabilities: caps}, nil
}
2 changes: 1 addition & 1 deletion pkg/csi/manila/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ 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)
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)
Expand Down
8 changes: 8 additions & 0 deletions pkg/csi/manila/identityserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"github.com/container-storage-interface/spec/lib/go/csi"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
"k8s.io/klog/v2"
)

type identityServer struct {
Expand All @@ -30,10 +31,16 @@ type identityServer struct {
}

func (ids *identityServer) GetPluginInfo(ctx context.Context, req *csi.GetPluginInfoRequest) (*csi.GetPluginInfoResponse, error) {
klog.V(5).Infof("Using default GetPluginInfo")

if ids.d.name == "" {
return nil, status.Error(codes.Unavailable, "Driver name not configured")
}

if ids.d.fqVersion == "" {
return nil, status.Error(codes.Unavailable, "Driver is missing version")
}

return &csi.GetPluginInfoResponse{
Name: ids.d.name,
VendorVersion: ids.d.fqVersion,
Expand All @@ -51,6 +58,7 @@ func (ids *identityServer) Probe(ctx context.Context, req *csi.ProbeRequest) (*c
}

func (ids *identityServer) GetPluginCapabilities(ctx context.Context, req *csi.GetPluginCapabilitiesRequest) (*csi.GetPluginCapabilitiesResponse, error) {
klog.V(5).Infof("GetPluginCapabilities called with req %+v", req)
caps := []*csi.PluginCapability{
{
Type: &csi.PluginCapability_Service_{
Expand Down