mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-11-17 20:00:23 +00:00
csiaddons: register volumegroup controller
Register the volumegroup controller as part of rbd controller server to serve the volume group RPC spec. Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
parent
6e5de23674
commit
2dd2ac8e91
@ -96,6 +96,24 @@ func (is *IdentityServer) GetCapabilities(
|
||||
Type: identity.Capability_VolumeReplication_VOLUME_REPLICATION,
|
||||
},
|
||||
},
|
||||
}, &identity.Capability{
|
||||
Type: &identity.Capability_VolumeGroup_{
|
||||
VolumeGroup: &identity.Capability_VolumeGroup{
|
||||
Type: identity.Capability_VolumeGroup_VOLUME_GROUP,
|
||||
},
|
||||
},
|
||||
}, &identity.Capability{
|
||||
Type: &identity.Capability_VolumeGroup_{
|
||||
VolumeGroup: &identity.Capability_VolumeGroup{
|
||||
Type: identity.Capability_VolumeGroup_MODIFY_VOLUME_GROUP,
|
||||
},
|
||||
},
|
||||
}, &identity.Capability{
|
||||
Type: &identity.Capability_VolumeGroup_{
|
||||
VolumeGroup: &identity.Capability_VolumeGroup{
|
||||
Type: identity.Capability_VolumeGroup_LIMIT_VOLUME_TO_ONE_VOLUME_GROUP,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
|
46
internal/csi-addons/rbd/volumegroup.go
Normal file
46
internal/csi-addons/rbd/volumegroup.go
Normal file
@ -0,0 +1,46 @@
|
||||
/*
|
||||
Copyright 2024 The Ceph-CSI Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package rbd
|
||||
|
||||
import (
|
||||
corerbd "github.com/ceph/ceph-csi/internal/rbd"
|
||||
|
||||
"github.com/csi-addons/spec/lib/go/volumegroup"
|
||||
"google.golang.org/grpc"
|
||||
)
|
||||
|
||||
// VolumeGroupServer struct of rbd CSI driver with supported methods of VolumeGroup
|
||||
// controller server spec.
|
||||
type VolumeGroupServer struct {
|
||||
// added UnimplementedControllerServer as a member of
|
||||
// ControllerServer. if volumegroup spec add more RPC services in the proto
|
||||
// file, then we don't need to add all RPC methods leading to forward
|
||||
// compatibility.
|
||||
*volumegroup.UnimplementedControllerServer
|
||||
// Embed ControllerServer as it implements helper functions
|
||||
*corerbd.ControllerServer
|
||||
}
|
||||
|
||||
// NewVolumeGroupServer creates a new VolumeGroupServer which handles
|
||||
// the VolumeGroup Service requests from the CSI-Addons specification.
|
||||
func NewVolumeGroupServer(c *corerbd.ControllerServer) *VolumeGroupServer {
|
||||
return &VolumeGroupServer{ControllerServer: c}
|
||||
}
|
||||
|
||||
func (vs *VolumeGroupServer) RegisterService(server grpc.ServiceRegistrar) {
|
||||
volumegroup.RegisterControllerServer(server, vs)
|
||||
}
|
@ -221,6 +221,9 @@ func (r *Driver) setupCSIAddonsServer(conf *util.Config) error {
|
||||
|
||||
rcs := casrbd.NewReplicationServer(NewControllerServer(r.cd))
|
||||
r.cas.RegisterService(rcs)
|
||||
|
||||
vgcs := casrbd.NewVolumeGroupServer(NewControllerServer(r.cd))
|
||||
r.cas.RegisterService(vgcs)
|
||||
}
|
||||
|
||||
if conf.IsNodeServer {
|
||||
|
1180
vendor/github.com/csi-addons/spec/lib/go/volumegroup/volumegroup.pb.go
generated
vendored
Normal file
1180
vendor/github.com/csi-addons/spec/lib/go/volumegroup/volumegroup.pb.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
269
vendor/github.com/csi-addons/spec/lib/go/volumegroup/volumegroup_grpc.pb.go
generated
vendored
Normal file
269
vendor/github.com/csi-addons/spec/lib/go/volumegroup/volumegroup_grpc.pb.go
generated
vendored
Normal file
@ -0,0 +1,269 @@
|
||||
// Code generated by make; DO NOT EDIT.
|
||||
|
||||
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||||
// versions:
|
||||
// - protoc-gen-go-grpc v1.3.0
|
||||
// - protoc v3.20.2
|
||||
// source: volumegroup/volumegroup.proto
|
||||
|
||||
package volumegroup
|
||||
|
||||
import (
|
||||
context "context"
|
||||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
status "google.golang.org/grpc/status"
|
||||
)
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the grpc package it is being compiled against.
|
||||
// Requires gRPC-Go v1.32.0 or later.
|
||||
const _ = grpc.SupportPackageIsVersion7
|
||||
|
||||
const (
|
||||
Controller_CreateVolumeGroup_FullMethodName = "/volumegroup.Controller/CreateVolumeGroup"
|
||||
Controller_ModifyVolumeGroupMembership_FullMethodName = "/volumegroup.Controller/ModifyVolumeGroupMembership"
|
||||
Controller_DeleteVolumeGroup_FullMethodName = "/volumegroup.Controller/DeleteVolumeGroup"
|
||||
Controller_ListVolumeGroups_FullMethodName = "/volumegroup.Controller/ListVolumeGroups"
|
||||
Controller_ControllerGetVolumeGroup_FullMethodName = "/volumegroup.Controller/ControllerGetVolumeGroup"
|
||||
)
|
||||
|
||||
// ControllerClient is the client API for Controller service.
|
||||
//
|
||||
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
|
||||
type ControllerClient interface {
|
||||
// CreateVolumeGroup RPC call to create a volume group.
|
||||
CreateVolumeGroup(ctx context.Context, in *CreateVolumeGroupRequest, opts ...grpc.CallOption) (*CreateVolumeGroupResponse, error)
|
||||
// ModifyVolumeGroupMembership RPC call to modify a volume group.
|
||||
ModifyVolumeGroupMembership(ctx context.Context, in *ModifyVolumeGroupMembershipRequest, opts ...grpc.CallOption) (*ModifyVolumeGroupMembershipResponse, error)
|
||||
// DeleteVolumeGroup RPC call to delete a volume group.
|
||||
DeleteVolumeGroup(ctx context.Context, in *DeleteVolumeGroupRequest, opts ...grpc.CallOption) (*DeleteVolumeGroupResponse, error)
|
||||
// ListVolumeGroups RPC call to list volume groups.
|
||||
ListVolumeGroups(ctx context.Context, in *ListVolumeGroupsRequest, opts ...grpc.CallOption) (*ListVolumeGroupsResponse, error)
|
||||
// CreateVolumeGroup RPC call to get a volume group.
|
||||
ControllerGetVolumeGroup(ctx context.Context, in *ControllerGetVolumeGroupRequest, opts ...grpc.CallOption) (*ControllerGetVolumeGroupResponse, error)
|
||||
}
|
||||
|
||||
type controllerClient struct {
|
||||
cc grpc.ClientConnInterface
|
||||
}
|
||||
|
||||
func NewControllerClient(cc grpc.ClientConnInterface) ControllerClient {
|
||||
return &controllerClient{cc}
|
||||
}
|
||||
|
||||
func (c *controllerClient) CreateVolumeGroup(ctx context.Context, in *CreateVolumeGroupRequest, opts ...grpc.CallOption) (*CreateVolumeGroupResponse, error) {
|
||||
out := new(CreateVolumeGroupResponse)
|
||||
err := c.cc.Invoke(ctx, Controller_CreateVolumeGroup_FullMethodName, in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *controllerClient) ModifyVolumeGroupMembership(ctx context.Context, in *ModifyVolumeGroupMembershipRequest, opts ...grpc.CallOption) (*ModifyVolumeGroupMembershipResponse, error) {
|
||||
out := new(ModifyVolumeGroupMembershipResponse)
|
||||
err := c.cc.Invoke(ctx, Controller_ModifyVolumeGroupMembership_FullMethodName, in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *controllerClient) DeleteVolumeGroup(ctx context.Context, in *DeleteVolumeGroupRequest, opts ...grpc.CallOption) (*DeleteVolumeGroupResponse, error) {
|
||||
out := new(DeleteVolumeGroupResponse)
|
||||
err := c.cc.Invoke(ctx, Controller_DeleteVolumeGroup_FullMethodName, in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *controllerClient) ListVolumeGroups(ctx context.Context, in *ListVolumeGroupsRequest, opts ...grpc.CallOption) (*ListVolumeGroupsResponse, error) {
|
||||
out := new(ListVolumeGroupsResponse)
|
||||
err := c.cc.Invoke(ctx, Controller_ListVolumeGroups_FullMethodName, in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *controllerClient) ControllerGetVolumeGroup(ctx context.Context, in *ControllerGetVolumeGroupRequest, opts ...grpc.CallOption) (*ControllerGetVolumeGroupResponse, error) {
|
||||
out := new(ControllerGetVolumeGroupResponse)
|
||||
err := c.cc.Invoke(ctx, Controller_ControllerGetVolumeGroup_FullMethodName, in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// ControllerServer is the server API for Controller service.
|
||||
// All implementations must embed UnimplementedControllerServer
|
||||
// for forward compatibility
|
||||
type ControllerServer interface {
|
||||
// CreateVolumeGroup RPC call to create a volume group.
|
||||
CreateVolumeGroup(context.Context, *CreateVolumeGroupRequest) (*CreateVolumeGroupResponse, error)
|
||||
// ModifyVolumeGroupMembership RPC call to modify a volume group.
|
||||
ModifyVolumeGroupMembership(context.Context, *ModifyVolumeGroupMembershipRequest) (*ModifyVolumeGroupMembershipResponse, error)
|
||||
// DeleteVolumeGroup RPC call to delete a volume group.
|
||||
DeleteVolumeGroup(context.Context, *DeleteVolumeGroupRequest) (*DeleteVolumeGroupResponse, error)
|
||||
// ListVolumeGroups RPC call to list volume groups.
|
||||
ListVolumeGroups(context.Context, *ListVolumeGroupsRequest) (*ListVolumeGroupsResponse, error)
|
||||
// CreateVolumeGroup RPC call to get a volume group.
|
||||
ControllerGetVolumeGroup(context.Context, *ControllerGetVolumeGroupRequest) (*ControllerGetVolumeGroupResponse, error)
|
||||
mustEmbedUnimplementedControllerServer()
|
||||
}
|
||||
|
||||
// UnimplementedControllerServer must be embedded to have forward compatible implementations.
|
||||
type UnimplementedControllerServer struct {
|
||||
}
|
||||
|
||||
func (UnimplementedControllerServer) CreateVolumeGroup(context.Context, *CreateVolumeGroupRequest) (*CreateVolumeGroupResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method CreateVolumeGroup not implemented")
|
||||
}
|
||||
func (UnimplementedControllerServer) ModifyVolumeGroupMembership(context.Context, *ModifyVolumeGroupMembershipRequest) (*ModifyVolumeGroupMembershipResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method ModifyVolumeGroupMembership not implemented")
|
||||
}
|
||||
func (UnimplementedControllerServer) DeleteVolumeGroup(context.Context, *DeleteVolumeGroupRequest) (*DeleteVolumeGroupResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method DeleteVolumeGroup not implemented")
|
||||
}
|
||||
func (UnimplementedControllerServer) ListVolumeGroups(context.Context, *ListVolumeGroupsRequest) (*ListVolumeGroupsResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method ListVolumeGroups not implemented")
|
||||
}
|
||||
func (UnimplementedControllerServer) ControllerGetVolumeGroup(context.Context, *ControllerGetVolumeGroupRequest) (*ControllerGetVolumeGroupResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method ControllerGetVolumeGroup not implemented")
|
||||
}
|
||||
func (UnimplementedControllerServer) mustEmbedUnimplementedControllerServer() {}
|
||||
|
||||
// UnsafeControllerServer may be embedded to opt out of forward compatibility for this service.
|
||||
// Use of this interface is not recommended, as added methods to ControllerServer will
|
||||
// result in compilation errors.
|
||||
type UnsafeControllerServer interface {
|
||||
mustEmbedUnimplementedControllerServer()
|
||||
}
|
||||
|
||||
func RegisterControllerServer(s grpc.ServiceRegistrar, srv ControllerServer) {
|
||||
s.RegisterService(&Controller_ServiceDesc, srv)
|
||||
}
|
||||
|
||||
func _Controller_CreateVolumeGroup_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(CreateVolumeGroupRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ControllerServer).CreateVolumeGroup(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Controller_CreateVolumeGroup_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ControllerServer).CreateVolumeGroup(ctx, req.(*CreateVolumeGroupRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Controller_ModifyVolumeGroupMembership_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(ModifyVolumeGroupMembershipRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ControllerServer).ModifyVolumeGroupMembership(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Controller_ModifyVolumeGroupMembership_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ControllerServer).ModifyVolumeGroupMembership(ctx, req.(*ModifyVolumeGroupMembershipRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Controller_DeleteVolumeGroup_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(DeleteVolumeGroupRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ControllerServer).DeleteVolumeGroup(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Controller_DeleteVolumeGroup_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ControllerServer).DeleteVolumeGroup(ctx, req.(*DeleteVolumeGroupRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Controller_ListVolumeGroups_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(ListVolumeGroupsRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ControllerServer).ListVolumeGroups(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Controller_ListVolumeGroups_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ControllerServer).ListVolumeGroups(ctx, req.(*ListVolumeGroupsRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Controller_ControllerGetVolumeGroup_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(ControllerGetVolumeGroupRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ControllerServer).ControllerGetVolumeGroup(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Controller_ControllerGetVolumeGroup_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ControllerServer).ControllerGetVolumeGroup(ctx, req.(*ControllerGetVolumeGroupRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
// Controller_ServiceDesc is the grpc.ServiceDesc for Controller service.
|
||||
// It's only intended for direct use with grpc.RegisterService,
|
||||
// and not to be introspected or modified (even as a copy)
|
||||
var Controller_ServiceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "volumegroup.Controller",
|
||||
HandlerType: (*ControllerServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
MethodName: "CreateVolumeGroup",
|
||||
Handler: _Controller_CreateVolumeGroup_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "ModifyVolumeGroupMembership",
|
||||
Handler: _Controller_ModifyVolumeGroupMembership_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "DeleteVolumeGroup",
|
||||
Handler: _Controller_DeleteVolumeGroup_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "ListVolumeGroups",
|
||||
Handler: _Controller_ListVolumeGroups_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "ControllerGetVolumeGroup",
|
||||
Handler: _Controller_ControllerGetVolumeGroup_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "volumegroup/volumegroup.proto",
|
||||
}
|
1
vendor/modules.txt
vendored
1
vendor/modules.txt
vendored
@ -242,6 +242,7 @@ github.com/csi-addons/spec/lib/go/fence
|
||||
github.com/csi-addons/spec/lib/go/identity
|
||||
github.com/csi-addons/spec/lib/go/reclaimspace
|
||||
github.com/csi-addons/spec/lib/go/replication
|
||||
github.com/csi-addons/spec/lib/go/volumegroup
|
||||
# github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc
|
||||
## explicit
|
||||
github.com/davecgh/go-spew/spew
|
||||
|
Loading…
Reference in New Issue
Block a user