Add missing parameters to CreateFilesystem req so that the created FS can be mounted later

This commit is contained in:
Helen Zhang 2024-01-05 17:08:03 -08:00
parent 817778f1c6
commit b7e0b32f24

View File

@ -6,10 +6,10 @@
package service package service
import ( import (
"github.com/oracle/zfssa-csi-driver/pkg/utils"
"github.com/oracle/zfssa-csi-driver/pkg/zfssarest"
"context" "context"
"github.com/container-storage-interface/spec/lib/go/csi" "github.com/container-storage-interface/spec/lib/go/csi"
"github.com/oracle/zfssa-csi-driver/pkg/utils"
"github.com/oracle/zfssa-csi-driver/pkg/zfssarest"
context2 "golang.org/x/net/context" context2 "golang.org/x/net/context"
"google.golang.org/grpc/codes" "google.golang.org/grpc/codes"
"google.golang.org/grpc/status" "google.golang.org/grpc/status"
@ -58,6 +58,16 @@ func (fs *zFilesystem) create(ctx context.Context, token *zfssarest.Token,
capacityRange := req.GetCapacityRange() capacityRange := req.GetCapacityRange()
capabilities := req.GetVolumeCapabilities() capabilities := req.GetVolumeCapabilities()
if _, ok := req.Parameters["restrictChown"]; !ok {
utils.GetLogCTRL(ctx, 5).Println("Adding restrictChown to CreateFilesystem req parameters")
req.Parameters["restrictChown"] = "false"
}
if _, ok := req.Parameters["shareNFS"]; !ok {
utils.GetLogCTRL(ctx, 5).Println("Adding shareNFS to CreateFilesystem req parameters")
req.Parameters["shareNFS"] = "on"
}
fsinfo, httpStatus, err := zfssarest.CreateFilesystem(ctx, token, fsinfo, httpStatus, err := zfssarest.CreateFilesystem(ctx, token,
req.GetName(), getVolumeSize(capacityRange), &req.Parameters) req.GetName(), getVolumeSize(capacityRange), &req.Parameters)
if err != nil { if err != nil {
@ -168,7 +178,6 @@ func (lun *zFilesystem) clone(ctx context.Context, token *zfssarest.Token,
} }
// Publishes a file system. In this case there's nothing to do. // Publishes a file system. In this case there's nothing to do.
//
func (fs *zFilesystem) controllerPublishVolume(ctx context.Context, token *zfssarest.Token, func (fs *zFilesystem) controllerPublishVolume(ctx context.Context, token *zfssarest.Token,
req *csi.ControllerPublishVolumeRequest, nodeName string) (*csi.ControllerPublishVolumeResponse, error) { req *csi.ControllerPublishVolumeRequest, nodeName string) (*csi.ControllerPublishVolumeResponse, error) {
@ -178,9 +187,7 @@ func (fs *zFilesystem) controllerPublishVolume(ctx context.Context, token *zfssa
return &csi.ControllerPublishVolumeResponse{}, nil return &csi.ControllerPublishVolumeResponse{}, nil
} }
// Unpublishes a file system. In this case there's nothing to do. // Unpublishes a file system. In this case there's nothing to do.
//
func (fs *zFilesystem) controllerUnpublishVolume(ctx context.Context, token *zfssarest.Token, func (fs *zFilesystem) controllerUnpublishVolume(ctx context.Context, token *zfssarest.Token,
req *csi.ControllerUnpublishVolumeRequest) (*csi.ControllerUnpublishVolumeResponse, error) { req *csi.ControllerUnpublishVolumeRequest) (*csi.ControllerUnpublishVolumeResponse, error) {
utils.GetLogCTRL(ctx, 5).Println("fs.controllerUnpublishVolume") utils.GetLogCTRL(ctx, 5).Println("fs.controllerUnpublishVolume")