mirror of
https://github.com/kubernetes-csi/csi-driver-nvmf.git
synced 2025-04-27 02:51:26 +00:00
feat: add rdma support
Signed-off-by: Meinhard Zhou <zhouenhua@bytedance.com>
This commit is contained in:
parent
998801c53d
commit
b002568227
@ -99,8 +99,6 @@ func (d *driver) AddControllerServiceCapabilities(cl []csi.ControllerServiceCapa
|
||||
}
|
||||
|
||||
d.cscap = csc
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func (d *driver) ValidateControllerServiceRequest(c csi.ControllerServiceCapability_RPC_Type) error {
|
||||
|
@ -20,7 +20,6 @@ import (
|
||||
b64 "encoding/base64"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
@ -70,7 +69,7 @@ func _connect(argStr string) error {
|
||||
return err
|
||||
}
|
||||
// todo: read file to verify
|
||||
lines, err := utils.ReadLinesFromFile(file)
|
||||
lines, _ := utils.ReadLinesFromFile(file)
|
||||
klog.Infof("Connect: read string %s", lines)
|
||||
return nil
|
||||
}
|
||||
@ -182,7 +181,7 @@ func disconnectByNqn(nqn, hostnqn string) int {
|
||||
|
||||
// delete nqn directory if has no hostnqn files
|
||||
nqnPath := filepath.Join(RUN_NVMF, nqn)
|
||||
hostnqns, err := ioutil.ReadDir(nqnPath)
|
||||
hostnqns, err := os.ReadDir(nqnPath)
|
||||
if err != nil {
|
||||
klog.Errorf("Disconnect: readdir %s err: %v", nqnPath, err)
|
||||
return -ENOENT
|
||||
@ -191,7 +190,7 @@ func disconnectByNqn(nqn, hostnqn string) int {
|
||||
os.RemoveAll(nqnPath)
|
||||
}
|
||||
|
||||
devices, err := ioutil.ReadDir(SYS_NVMF)
|
||||
devices, err := os.ReadDir(SYS_NVMF)
|
||||
if err != nil {
|
||||
klog.Errorf("Disconnect: readdir %s err: %s", SYS_NVMF, err)
|
||||
return -ENOENT
|
||||
@ -204,7 +203,7 @@ func disconnectByNqn(nqn, hostnqn string) int {
|
||||
|
||||
// disconnect all controllers if has no hostnqn files
|
||||
if len(hostnqns) <= 0 {
|
||||
devices, err := ioutil.ReadDir(SYS_NVMF)
|
||||
devices, err := os.ReadDir(SYS_NVMF)
|
||||
if err != nil {
|
||||
klog.Errorf("Disconnect: readdir %s err: %s", SYS_NVMF, err)
|
||||
return -ENOENT
|
||||
@ -328,7 +327,7 @@ func removeConnectorFile(targetPath string) {
|
||||
}
|
||||
|
||||
func GetConnectorFromFile(filePath string) (*Connector, error) {
|
||||
f, err := ioutil.ReadFile(filePath)
|
||||
f, err := os.ReadFile(filePath)
|
||||
if err != nil {
|
||||
return &Connector{}, err
|
||||
|
||||
|
@ -120,6 +120,10 @@ func (n *NodeServer) NodeExpandVolume(ctx context.Context, req *csi.NodeExpandVo
|
||||
scanPath := parseDeviceToControllerPath(deviceName)
|
||||
if utils.IsFileExisting(scanPath) {
|
||||
file, err := os.OpenFile(scanPath, os.O_RDWR|os.O_TRUNC, 0766)
|
||||
if err != nil {
|
||||
klog.Errorf("NodeExpandVolume: open scan path %s error: %v", scanPath, err)
|
||||
return nil, status.Errorf(codes.Internal, "NodeExpandVolume: open scan path %s error: %v", scanPath, err)
|
||||
}
|
||||
err = utils.WriteStringToFile(file, "1")
|
||||
if err != nil {
|
||||
klog.Errorf("NodeExpandVolume: Rescan error: %v", err)
|
||||
|
@ -62,7 +62,7 @@ func getNVMfDiskInfo(req *csi.NodePublishVolumeRequest) (*nvmfDiskInfo, error) {
|
||||
nqn := volOpts["nqn"]
|
||||
|
||||
if targetTrAddr == "" || nqn == "" || targetTrPort == "" || targetTrType == "" || deviceUUID == "" {
|
||||
return nil, fmt.Errorf("Some Nvme target info is missing, volID: %s ", volName)
|
||||
return nil, fmt.Errorf("some nvme target info is missing, volID: %s ", volName)
|
||||
}
|
||||
|
||||
return &nvmfDiskInfo{
|
||||
|
@ -32,15 +32,10 @@ import (
|
||||
|
||||
func waitForPathToExist(devicePath string, maxRetries, intervalSeconds int, deviceTransport string) (bool, error) {
|
||||
for i := 0; i < maxRetries; i++ {
|
||||
if deviceTransport == "tcp" {
|
||||
exist := utils.IsFileExisting(devicePath)
|
||||
if exist {
|
||||
return true, nil
|
||||
}
|
||||
} else {
|
||||
return false, fmt.Errorf("connect only support tcp")
|
||||
exist := utils.IsFileExisting(devicePath)
|
||||
if exist {
|
||||
return true, nil
|
||||
}
|
||||
|
||||
if i == maxRetries-1 {
|
||||
break
|
||||
}
|
||||
|
@ -52,7 +52,6 @@ type nonBlockingGRPCServer struct {
|
||||
func (s *nonBlockingGRPCServer) Start(endpoint string, ids csi.IdentityServer, cs csi.ControllerServer, ns csi.NodeServer) {
|
||||
s.wg.Add(1)
|
||||
go s.serve(endpoint, ids, cs, ns)
|
||||
return
|
||||
}
|
||||
|
||||
func (s *nonBlockingGRPCServer) Wait() {
|
||||
|
Loading…
Reference in New Issue
Block a user