mirror of
https://github.com/TECHNOFAB11/zfs-localpv.git
synced 2026-02-02 15:45:13 +01:00
feat(block): adding block volume support for ZFSPV (#102)
This commit adds the support for creating a Raw Block Volume request using volumemode as block in PVC :-
```
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: block-claim
spec:
volumeMode: Block
storageClassName: zfspv-block
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 5Gi
```
The driver will create a zvol for this volume and bind mount the block device at the given path.
Signed-off-by: Pawan <pawan@mayadata.io>
This commit is contained in:
parent
49dc99726b
commit
dd059a2f43
10 changed files with 274 additions and 10 deletions
|
|
@ -110,14 +110,18 @@ func (ns *node) NodePublishVolume(
|
|||
|
||||
vol, mountInfo, err := GetVolAndMountInfo(req)
|
||||
if err != nil {
|
||||
goto PublishVolumeResponse
|
||||
return nil, status.Error(codes.Internal, err.Error())
|
||||
}
|
||||
// attempt mount operation on the requested path
|
||||
if err = zfs.MountVolume(vol, mountInfo); err != nil {
|
||||
goto PublishVolumeResponse
|
||||
// If the access type is block, do nothing for stage
|
||||
switch req.GetVolumeCapability().GetAccessType().(type) {
|
||||
case *csi.VolumeCapability_Block:
|
||||
// attempt block mount operation on the requested path
|
||||
err = zfs.MountBlock(vol, mountInfo)
|
||||
case *csi.VolumeCapability_Mount:
|
||||
// attempt filesystem mount operation on the requested path
|
||||
err = zfs.MountFilesystem(vol, mountInfo)
|
||||
}
|
||||
|
||||
PublishVolumeResponse:
|
||||
if err != nil {
|
||||
return nil, status.Error(codes.Internal, err.Error())
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue