diff --git a/csi/deployment.go b/csi/deployment.go index 0e2fd285c1..5a5efca449 100644 --- a/csi/deployment.go +++ b/csi/deployment.go @@ -418,6 +418,14 @@ func NewPluginDeployment(namespace, serviceAccount, nodeDriverRegistrarImage, li Name: "CSI_ENDPOINT", Value: GetCSIEndpoint(), }, + { + Name: "POD_NAMESPACE", + ValueFrom: &corev1.EnvVarSource{ + FieldRef: &corev1.ObjectFieldSelector{ + FieldPath: "metadata.namespace", + }, + }, + }, }, VolumeMounts: []corev1.VolumeMount{ { diff --git a/csi/node_server.go b/csi/node_server.go index cb9baeeebf..de31558858 100644 --- a/csi/node_server.go +++ b/csi/node_server.go @@ -16,18 +16,23 @@ import ( "google.golang.org/grpc/codes" "google.golang.org/grpc/status" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/client-go/rest" "k8s.io/mount-utils" corev1 "k8s.io/api/core/v1" + clientset "k8s.io/client-go/kubernetes" utilexec "k8s.io/utils/exec" "github.com/longhorn/longhorn-manager/csi/crypto" + "github.com/longhorn/longhorn-manager/engineapi" "github.com/longhorn/longhorn-manager/types" lhns "github.com/longhorn/go-common-libs/ns" longhornclient "github.com/longhorn/longhorn-manager/client" longhorn "github.com/longhorn/longhorn-manager/k8s/pkg/apis/longhorn/v1beta2" + lhclientset "github.com/longhorn/longhorn-manager/k8s/pkg/client/clientset/versioned" ) const ( @@ -690,11 +695,66 @@ func (ns *NodeServer) NodeGetVolumeStats(ctx context.Context, req *csi.NodeGetVo }, nil } +// NodeExpandShared Volume is designed to expand the file system in an RWX volume for ONLINE expansion. +// It does so with a gRPC call into the share-manager pod. +func (ns *NodeServer) NodeExpandSharedVolume(volumeName string) error { + log := ns.log.WithFields(logrus.Fields{"function": "NodeExpandSharedVolume"}) + + lhNamespace := os.Getenv(types.EnvPodNamespace) + if lhNamespace == "" { + return fmt.Errorf("failed to detect pod namespace, environment variable %v is missing", types.EnvPodNamespace) + } + + config, err := rest.InClusterConfig() + if err != nil { + return errors.Wrap(err, "failed to get client config") + } + + kubeClient, err := clientset.NewForConfig(config) + if err != nil { + return errors.Wrap(err, "failed to get k8s client") + } + + lhClient, err := lhclientset.NewForConfig(config) + if err != nil { + return errors.Wrap(err, "failed to get longhorn clientset") + } + + sm, err := lhClient.LonghornV1beta2().ShareManagers(lhNamespace).Get(context.TODO(), volumeName, metav1.GetOptions{}) + if err != nil { + return errors.Wrap(err, "failed to get ShareManager CR") + } + + podName := types.GetShareManagerPodNameFromShareManagerName(sm.Name) + pod, err := kubeClient.CoreV1().Pods(lhNamespace).Get(context.TODO(), podName, metav1.GetOptions{}) + if err != nil { + return errors.Wrap(err, "failed to get ShareManager pod") + } + + client, err := engineapi.NewShareManagerClient(sm, pod) + if err != nil { + return errors.Wrapf(err, "failed to launch gRPC client for share manager before resizing volume %v", volumeName) + } + defer client.Close() + + // Each node with a workload pod will send an RPC request. The first will win, and the others are no-ops. + err = client.FilesystemResize() + if status.Code(err) == codes.Unimplemented { + // This is a downrev longhorn-share-manager image. It will be necessary either to kill the share-manager pod + // and let it restart with the new image, or scale the workload down and back up to accomplish the same thing. + // It might be tempting to delete the pod here, but there will be one of these calls for each workload pod, + // and it would be messy to have multiple kill requests at once. So the kill will need to be done by the user. + log.WithError(err).Warn("Share Manager image is down-rev, does not implement RPC FilesystemResize. Share Manager pod must be restarted with current image.") + } + + return err +} + // NodeExpandVolume is designed to expand the file system for ONLINE expansion, func (ns *NodeServer) NodeExpandVolume(ctx context.Context, req *csi.NodeExpandVolumeRequest) (*csi.NodeExpandVolumeResponse, error) { log := ns.log.WithFields(logrus.Fields{"function": "NodeExpandVolume"}) - log.Infof("NodeNodeExpandVolume is called with req %+v", req) + log.Infof("NodeExpandVolume is called with req %+v", req) if req.CapacityRange == nil { return nil, status.Error(codes.InvalidArgument, "capacity range missing in request") @@ -729,6 +789,20 @@ func (ns *NodeServer) NodeExpandVolume(ctx context.Context, req *csi.NodeExpandV if volume.State != string(longhorn.VolumeStateAttached) { return nil, status.Errorf(codes.FailedPrecondition, "invalid state %v for volume %v node expansion", volume.State, volumeID) } + + if requiresSharedAccess(volume, volumeCapability) && !volume.Migratable { + if volume.AccessMode != string(longhorn.AccessModeReadWriteMany) { + return nil, status.Errorf(codes.FailedPrecondition, "volume %s requires shared access but is not marked for shared use", volumeID) + } + + if err := ns.NodeExpandSharedVolume(volumeID); err != nil { + log.WithError(err).Info("NodeExpandSharedVolume returned error.") + return nil, err + } + + return &csi.NodeExpandVolumeResponse{CapacityBytes: requestedSize}, nil + } + devicePath := volume.Controllers[0].Endpoint mounter := &mount.SafeFormatAndMount{Interface: mount.New(""), Exec: utilexec.New()} diff --git a/engineapi/share_manager.go b/engineapi/share_manager.go index 4fbecb95ac..083129da42 100644 --- a/engineapi/share_manager.go +++ b/engineapi/share_manager.go @@ -39,6 +39,10 @@ func (c *ShareManagerClient) FilesystemTrim(encryptedDevice bool) error { return c.grpcClient.FilesystemTrim(encryptedDevice) } +func (c *ShareManagerClient) FilesystemResize() error { + return c.grpcClient.FilesystemResize() +} + func (c *ShareManagerClient) Unmount() error { return c.grpcClient.Unmount() } diff --git a/go.mod b/go.mod index 50e753fa9e..be5a1b24d4 100644 --- a/go.mod +++ b/go.mod @@ -226,3 +226,7 @@ require ( sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect sigs.k8s.io/yaml v1.4.0 // indirect ) + +replace github.com/longhorn/types => github.com/james-munson/types v0.0.0-20241106234456-f7f62e977be0 + +replace github.com/longhorn/longhorn-share-manager => github.com/james-munson/longhorn-share-manager v1.4.0-rc1.0.20241111220442-c3b1b0d80797 diff --git a/go.sum b/go.sum index 71bcf61216..a2108060b0 100644 --- a/go.sum +++ b/go.sum @@ -130,6 +130,10 @@ github.com/imdario/mergo v0.3.13 h1:lFzP57bqS/wsqKssCGmtLAb8A0wKjLGrve2q3PPVcBk= github.com/imdario/mergo v0.3.13/go.mod h1:4lJ1jqUDcsbIECGy0RUJAXNIhg+6ocWgb1ALK2O4oXg= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= +github.com/james-munson/longhorn-share-manager v1.4.0-rc1.0.20241111220442-c3b1b0d80797 h1:lE4iOD+gHB5by2MniYHw7XH16+tFZqBrdRl34Ihtpsw= +github.com/james-munson/longhorn-share-manager v1.4.0-rc1.0.20241111220442-c3b1b0d80797/go.mod h1:ziXm1g8gS3eRt/jLDJHQYNRf1yCK7n7y4uPxIy7Ull8= +github.com/james-munson/types v0.0.0-20241106234456-f7f62e977be0 h1:RykCSQrMsQXzyjy99IXsgF+BVlvt3TOYfJBfuo+ObSk= +github.com/james-munson/types v0.0.0-20241106234456-f7f62e977be0/go.mod h1:IpV+1bctQgBgp3brj0nsHmnBDFkd5IrzTgBtVAloJuw= github.com/jinzhu/copier v0.4.0 h1:w3ciUoD19shMCRargcpm0cm91ytaBhDvuRpz1ODO/U8= github.com/jinzhu/copier v0.4.0/go.mod h1:DfbEm0FYsaqBcKcFuvmOZb218JkPGtvSHsKg8S8hyyg= github.com/jonboulle/clockwork v0.4.0 h1:p4Cf1aMWXnXAUh8lVfewRBx1zaTSYKrKMF2g3ST4RZ4= @@ -171,10 +175,6 @@ github.com/longhorn/longhorn-engine v1.8.0-dev-20241117 h1:2sW/dPj69/XrMDjsh2LBZ github.com/longhorn/longhorn-engine v1.8.0-dev-20241117/go.mod h1:3VnMqI8YqJ76XdRvnMWJNp1U1ITAyOwOjKtbYPqLqQw= github.com/longhorn/longhorn-instance-manager v1.8.0-dev-20241117 h1:dReWXt6gh5mpL27fEhDFCLVK7iZwGWCNK3rH4BGP29M= github.com/longhorn/longhorn-instance-manager v1.8.0-dev-20241117/go.mod h1:HCh2gA5CNMpZ+b2j7uUgV8RMJ8BwB22cjiTbjWeQ5p4= -github.com/longhorn/longhorn-share-manager v1.7.0-rc1 h1:LsSkSajhG8tCfORKKfwK+8XHVrT/8rI9DRWb7fuoVls= -github.com/longhorn/longhorn-share-manager v1.7.0-rc1/go.mod h1:R6+NscPU4lAV5ueO7//lBCAO3en0aDbZi5KkkOSUJvk= -github.com/longhorn/types v0.0.0-20241110123431-85dca7039c42 h1:zMSuk0V/sVfgvdd+CpxfqJAB0yKQaWFglOFCyrHU3xc= -github.com/longhorn/types v0.0.0-20241110123431-85dca7039c42/go.mod h1:3A0asFlVzaBCvQHhqEY+HsnFnNBUFZ5onYKI2Qq9u74= github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= diff --git a/vendor/github.com/longhorn/longhorn-share-manager/pkg/client/share_manager_client.go b/vendor/github.com/longhorn/longhorn-share-manager/pkg/client/share_manager_client.go index 32e7781e75..f6f2810663 100644 --- a/vendor/github.com/longhorn/longhorn-share-manager/pkg/client/share_manager_client.go +++ b/vendor/github.com/longhorn/longhorn-share-manager/pkg/client/share_manager_client.go @@ -3,12 +3,13 @@ package client import ( "context" - rpc "github.com/longhorn/types/pkg/generated/smrpc" "github.com/pkg/errors" "google.golang.org/grpc" "google.golang.org/grpc/credentials/insecure" "google.golang.org/protobuf/types/known/emptypb" + rpc "github.com/longhorn/types/pkg/generated/smrpc" + "github.com/longhorn/longhorn-share-manager/pkg/types" ) @@ -47,6 +48,14 @@ func (c *ShareManagerClient) FilesystemTrim(encryptedDevice bool) error { return err } +func (c *ShareManagerClient) FilesystemResize() error { + ctx, cancel := context.WithTimeout(context.Background(), types.GRPCServiceTimeout) + defer cancel() + + _, err := c.client.FilesystemResize(ctx, &emptypb.Empty{}) + return err +} + func (c *ShareManagerClient) Unmount() error { ctx, cancel := context.WithTimeout(context.Background(), types.GRPCServiceTimeout) defer cancel() diff --git a/vendor/github.com/longhorn/types/pkg/generated/smrpc/smrpc.pb.go b/vendor/github.com/longhorn/types/pkg/generated/smrpc/smrpc.pb.go index 8e67a17c74..894496c4bc 100644 --- a/vendor/github.com/longhorn/types/pkg/generated/smrpc/smrpc.pb.go +++ b/vendor/github.com/longhorn/types/pkg/generated/smrpc/smrpc.pb.go @@ -78,24 +78,28 @@ var file_smrpc_smrpc_proto_rawDesc = []byte{ 0x69, 0x6d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x29, 0x0a, 0x10, 0x65, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x65, 0x64, 0x5f, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0f, 0x65, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x65, 0x64, 0x44, 0x65, - 0x76, 0x69, 0x63, 0x65, 0x32, 0xd1, 0x01, 0x0a, 0x13, 0x53, 0x68, 0x61, 0x72, 0x65, 0x4d, 0x61, - 0x6e, 0x61, 0x67, 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x42, 0x0a, 0x0e, - 0x46, 0x69, 0x6c, 0x65, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x54, 0x72, 0x69, 0x6d, 0x12, 0x16, - 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x54, 0x72, 0x69, 0x6d, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x00, - 0x12, 0x3b, 0x0a, 0x07, 0x55, 0x6e, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x16, 0x2e, 0x67, 0x6f, - 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, - 0x70, 0x74, 0x79, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x00, 0x12, 0x39, 0x0a, - 0x05, 0x4d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x16, - 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, - 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x00, 0x42, 0x2f, 0x5a, 0x2d, 0x67, 0x69, 0x74, 0x68, - 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6c, 0x6f, 0x6e, 0x67, 0x68, 0x6f, 0x72, 0x6e, 0x2f, - 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, - 0x74, 0x65, 0x64, 0x2f, 0x73, 0x6d, 0x72, 0x70, 0x63, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x33, + 0x76, 0x69, 0x63, 0x65, 0x32, 0x97, 0x02, 0x0a, 0x13, 0x53, 0x68, 0x61, 0x72, 0x65, 0x4d, 0x61, + 0x6e, 0x61, 0x67, 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x44, 0x0a, 0x10, + 0x46, 0x69, 0x6c, 0x65, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x52, 0x65, 0x73, 0x69, 0x7a, 0x65, + 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, + 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, + 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, + 0x22, 0x00, 0x12, 0x42, 0x0a, 0x0e, 0x46, 0x69, 0x6c, 0x65, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, + 0x54, 0x72, 0x69, 0x6d, 0x12, 0x16, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x73, 0x79, 0x73, 0x74, 0x65, + 0x6d, 0x54, 0x72, 0x69, 0x6d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, + 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, + 0x6d, 0x70, 0x74, 0x79, 0x22, 0x00, 0x12, 0x3b, 0x0a, 0x07, 0x55, 0x6e, 0x6d, 0x6f, 0x75, 0x6e, + 0x74, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, + 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, + 0x79, 0x22, 0x00, 0x12, 0x39, 0x0a, 0x05, 0x4d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x16, 0x2e, 0x67, + 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, + 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x00, 0x42, 0x2f, + 0x5a, 0x2d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6c, 0x6f, 0x6e, + 0x67, 0x68, 0x6f, 0x72, 0x6e, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x70, 0x6b, 0x67, 0x2f, + 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2f, 0x73, 0x6d, 0x72, 0x70, 0x63, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -116,14 +120,16 @@ var file_smrpc_smrpc_proto_goTypes = []interface{}{ (*emptypb.Empty)(nil), // 1: google.protobuf.Empty } var file_smrpc_smrpc_proto_depIdxs = []int32{ - 0, // 0: ShareManagerService.FilesystemTrim:input_type -> FilesystemTrimRequest - 1, // 1: ShareManagerService.Unmount:input_type -> google.protobuf.Empty - 1, // 2: ShareManagerService.Mount:input_type -> google.protobuf.Empty - 1, // 3: ShareManagerService.FilesystemTrim:output_type -> google.protobuf.Empty - 1, // 4: ShareManagerService.Unmount:output_type -> google.protobuf.Empty - 1, // 5: ShareManagerService.Mount:output_type -> google.protobuf.Empty - 3, // [3:6] is the sub-list for method output_type - 0, // [0:3] is the sub-list for method input_type + 1, // 0: ShareManagerService.FilesystemResize:input_type -> google.protobuf.Empty + 0, // 1: ShareManagerService.FilesystemTrim:input_type -> FilesystemTrimRequest + 1, // 2: ShareManagerService.Unmount:input_type -> google.protobuf.Empty + 1, // 3: ShareManagerService.Mount:input_type -> google.protobuf.Empty + 1, // 4: ShareManagerService.FilesystemResize:output_type -> google.protobuf.Empty + 1, // 5: ShareManagerService.FilesystemTrim:output_type -> google.protobuf.Empty + 1, // 6: ShareManagerService.Unmount:output_type -> google.protobuf.Empty + 1, // 7: ShareManagerService.Mount:output_type -> google.protobuf.Empty + 4, // [4:8] is the sub-list for method output_type + 0, // [0:4] is the sub-list for method input_type 0, // [0:0] is the sub-list for extension type_name 0, // [0:0] is the sub-list for extension extendee 0, // [0:0] is the sub-list for field type_name diff --git a/vendor/github.com/longhorn/types/pkg/generated/smrpc/smrpc_grpc.pb.go b/vendor/github.com/longhorn/types/pkg/generated/smrpc/smrpc_grpc.pb.go index 26492c8f33..c49df1a9a6 100644 --- a/vendor/github.com/longhorn/types/pkg/generated/smrpc/smrpc_grpc.pb.go +++ b/vendor/github.com/longhorn/types/pkg/generated/smrpc/smrpc_grpc.pb.go @@ -20,15 +20,17 @@ import ( const _ = grpc.SupportPackageIsVersion7 const ( - ShareManagerService_FilesystemTrim_FullMethodName = "/ShareManagerService/FilesystemTrim" - ShareManagerService_Unmount_FullMethodName = "/ShareManagerService/Unmount" - ShareManagerService_Mount_FullMethodName = "/ShareManagerService/Mount" + ShareManagerService_FilesystemResize_FullMethodName = "/ShareManagerService/FilesystemResize" + ShareManagerService_FilesystemTrim_FullMethodName = "/ShareManagerService/FilesystemTrim" + ShareManagerService_Unmount_FullMethodName = "/ShareManagerService/Unmount" + ShareManagerService_Mount_FullMethodName = "/ShareManagerService/Mount" ) // ShareManagerServiceClient is the client API for ShareManagerService 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 ShareManagerServiceClient interface { + FilesystemResize(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*emptypb.Empty, error) FilesystemTrim(ctx context.Context, in *FilesystemTrimRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) Unmount(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*emptypb.Empty, error) Mount(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*emptypb.Empty, error) @@ -42,6 +44,15 @@ func NewShareManagerServiceClient(cc grpc.ClientConnInterface) ShareManagerServi return &shareManagerServiceClient{cc} } +func (c *shareManagerServiceClient) FilesystemResize(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*emptypb.Empty, error) { + out := new(emptypb.Empty) + err := c.cc.Invoke(ctx, ShareManagerService_FilesystemResize_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *shareManagerServiceClient) FilesystemTrim(ctx context.Context, in *FilesystemTrimRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { out := new(emptypb.Empty) err := c.cc.Invoke(ctx, ShareManagerService_FilesystemTrim_FullMethodName, in, out, opts...) @@ -73,6 +84,7 @@ func (c *shareManagerServiceClient) Mount(ctx context.Context, in *emptypb.Empty // All implementations must embed UnimplementedShareManagerServiceServer // for forward compatibility type ShareManagerServiceServer interface { + FilesystemResize(context.Context, *emptypb.Empty) (*emptypb.Empty, error) FilesystemTrim(context.Context, *FilesystemTrimRequest) (*emptypb.Empty, error) Unmount(context.Context, *emptypb.Empty) (*emptypb.Empty, error) Mount(context.Context, *emptypb.Empty) (*emptypb.Empty, error) @@ -83,6 +95,9 @@ type ShareManagerServiceServer interface { type UnimplementedShareManagerServiceServer struct { } +func (UnimplementedShareManagerServiceServer) FilesystemResize(context.Context, *emptypb.Empty) (*emptypb.Empty, error) { + return nil, status.Errorf(codes.Unimplemented, "method FilesystemResize not implemented") +} func (UnimplementedShareManagerServiceServer) FilesystemTrim(context.Context, *FilesystemTrimRequest) (*emptypb.Empty, error) { return nil, status.Errorf(codes.Unimplemented, "method FilesystemTrim not implemented") } @@ -105,6 +120,24 @@ func RegisterShareManagerServiceServer(s grpc.ServiceRegistrar, srv ShareManager s.RegisterService(&ShareManagerService_ServiceDesc, srv) } +func _ShareManagerService_FilesystemResize_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(emptypb.Empty) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ShareManagerServiceServer).FilesystemResize(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: ShareManagerService_FilesystemResize_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ShareManagerServiceServer).FilesystemResize(ctx, req.(*emptypb.Empty)) + } + return interceptor(ctx, in, info, handler) +} + func _ShareManagerService_FilesystemTrim_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(FilesystemTrimRequest) if err := dec(in); err != nil { @@ -166,6 +199,10 @@ var ShareManagerService_ServiceDesc = grpc.ServiceDesc{ ServiceName: "ShareManagerService", HandlerType: (*ShareManagerServiceServer)(nil), Methods: []grpc.MethodDesc{ + { + MethodName: "FilesystemResize", + Handler: _ShareManagerService_FilesystemResize_Handler, + }, { MethodName: "FilesystemTrim", Handler: _ShareManagerService_FilesystemTrim_Handler, diff --git a/vendor/modules.txt b/vendor/modules.txt index 1e2cfc2788..386ca451dd 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -285,12 +285,12 @@ github.com/longhorn/longhorn-instance-manager/pkg/client github.com/longhorn/longhorn-instance-manager/pkg/meta github.com/longhorn/longhorn-instance-manager/pkg/types github.com/longhorn/longhorn-instance-manager/pkg/util -# github.com/longhorn/longhorn-share-manager v1.7.0-rc1 -## explicit; go 1.22.2 +# github.com/longhorn/longhorn-share-manager v1.7.0-rc1 => github.com/james-munson/longhorn-share-manager v1.4.0-rc1.0.20241111220442-c3b1b0d80797 +## explicit; go 1.22.7 github.com/longhorn/longhorn-share-manager/pkg/client github.com/longhorn/longhorn-share-manager/pkg/types -# github.com/longhorn/types v0.0.0-20241110123431-85dca7039c42 -## explicit; go 1.22.7 +# github.com/longhorn/types v0.0.0-20241110123431-85dca7039c42 => github.com/james-munson/types v0.0.0-20241106234456-f7f62e977be0 +## explicit; go 1.21 github.com/longhorn/types/pkg/generated/bimrpc github.com/longhorn/types/pkg/generated/enginerpc github.com/longhorn/types/pkg/generated/imrpc @@ -1650,3 +1650,5 @@ sigs.k8s.io/yaml/goyaml.v2 # k8s.io/sample-apiserver => k8s.io/sample-apiserver v0.31.2 # k8s.io/sample-cli-plugin => k8s.io/sample-cli-plugin v0.31.2 # k8s.io/sample-controller => k8s.io/sample-controller v0.31.2 +# github.com/longhorn/types => github.com/james-munson/types v0.0.0-20241106234456-f7f62e977be0 +# github.com/longhorn/longhorn-share-manager => github.com/james-munson/longhorn-share-manager v1.4.0-rc1.0.20241111220442-c3b1b0d80797