-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[csi] Add patch for fake volume expansion support (#38)
Signed-off-by: Alexandr Stefurishin <[email protected]> Signed-off-by: v.oleynikov <[email protected]> Co-authored-by: v.oleynikov <[email protected]>
- Loading branch information
Showing
3 changed files
with
93 additions
and
4 deletions.
There are no files selected for viewing
89 changes: 89 additions & 0 deletions
89
images/csi-nfs/patches/0003-fake-implementation-of-ControllerExpandVolume.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
From 189c10ff76dcef64cf2816317d3c197956497453 Mon Sep 17 00:00:00 2001 | ||
From: Alexandr Stefurishin <[email protected]> | ||
Date: Tue, 24 Sep 2024 09:56:28 +0300 | ||
Subject: [PATCH] fake-implementation-of-ControllerExpandVolume | ||
|
||
Signed-off-by: Alexandr Stefurishin <[email protected]> | ||
--- | ||
pkg/nfs/controllerserver.go | 18 +++++++++++++++--- | ||
pkg/nfs/identityserver.go | 14 ++++++++++++++ | ||
pkg/nfs/nfs.go | 2 ++ | ||
3 files changed, 31 insertions(+), 3 deletions(-) | ||
|
||
diff --git a/pkg/nfs/controllerserver.go b/pkg/nfs/controllerserver.go | ||
index 726df875..494567de 100644 | ||
--- a/pkg/nfs/controllerserver.go | ||
+++ b/pkg/nfs/controllerserver.go | ||
@@ -304,7 +304,11 @@ func (cs *ControllerServer) ListVolumes(_ context.Context, _ *csi.ListVolumesReq | ||
} | ||
|
||
func (cs *ControllerServer) GetCapacity(_ context.Context, _ *csi.GetCapacityRequest) (*csi.GetCapacityResponse, error) { | ||
- return nil, status.Error(codes.Unimplemented, "") | ||
+ return &csi.GetCapacityResponse{ | ||
+ AvailableCapacity: 1000_000_000_000_000, // 1000 TB | ||
+ MaximumVolumeSize: nil, | ||
+ MinimumVolumeSize: nil, | ||
+ }, nil | ||
} | ||
|
||
// ControllerGetCapabilities implements the default GRPC callout. | ||
@@ -432,8 +436,16 @@ func (cs *ControllerServer) ListSnapshots(_ context.Context, _ *csi.ListSnapshot | ||
return nil, status.Error(codes.Unimplemented, "") | ||
} | ||
|
||
-func (cs *ControllerServer) ControllerExpandVolume(_ context.Context, _ *csi.ControllerExpandVolumeRequest) (*csi.ControllerExpandVolumeResponse, error) { | ||
- return nil, status.Error(codes.Unimplemented, "") | ||
+func (cs *ControllerServer) ControllerExpandVolume(_ context.Context, req *csi.ControllerExpandVolumeRequest) (*csi.ControllerExpandVolumeResponse, error) { | ||
+ // fake implementation, doesn't really resize anything | ||
+ | ||
+ klog.V(2).Infof("[ControllerExpandVolume] received expansion request for volumeID:%s, requiredBytes: %d", req.VolumeId, req.CapacityRange.RequiredBytes) | ||
+ klog.Warning("[ControllerExpandVolume] volume expansion is not really happenning, fake implementation is used") | ||
+ | ||
+ return &csi.ControllerExpandVolumeResponse{ | ||
+ CapacityBytes: req.CapacityRange.RequiredBytes, | ||
+ NodeExpansionRequired: false, | ||
+ }, nil | ||
} | ||
|
||
// Mount nfs server at base-dir | ||
diff --git a/pkg/nfs/identityserver.go b/pkg/nfs/identityserver.go | ||
index d76fcf49..85afdb6f 100644 | ||
--- a/pkg/nfs/identityserver.go | ||
+++ b/pkg/nfs/identityserver.go | ||
@@ -61,6 +61,20 @@ func (ids *IdentityServer) GetPluginCapabilities(_ context.Context, _ *csi.GetPl | ||
}, | ||
}, | ||
}, | ||
+ { | ||
+ 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, | ||
+ }, | ||
+ }, | ||
+ }, | ||
}, | ||
}, nil | ||
} | ||
diff --git a/pkg/nfs/nfs.go b/pkg/nfs/nfs.go | ||
index 7d69265e..e91093da 100644 | ||
--- a/pkg/nfs/nfs.go | ||
+++ b/pkg/nfs/nfs.go | ||
@@ -98,6 +98,8 @@ func NewDriver(options *DriverOptions) *Driver { | ||
csi.ControllerServiceCapability_RPC_SINGLE_NODE_MULTI_WRITER, | ||
csi.ControllerServiceCapability_RPC_CLONE_VOLUME, | ||
csi.ControllerServiceCapability_RPC_CREATE_DELETE_SNAPSHOT, | ||
+ csi.ControllerServiceCapability_RPC_GET_CAPACITY, | ||
+ csi.ControllerServiceCapability_RPC_EXPAND_VOLUME, | ||
}) | ||
|
||
n.AddNodeServiceCapabilities([]csi.NodeServiceCapability_RPC_Type{ | ||
-- | ||
2.43.0 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters