Skip to content

Commit 61667b6

Browse files
added storageclass param fabrics (#244)
* added storageclass param fabrics * get the target type from sbcli controlplane * get the target type from sbcli controlplane * updated param from fabrics to fabric * updated param from fabrics to fabric * load nvme-rdma module in csi-node * use lowercase for fabric name * use lowercase for fabric name * log targetType * update name targetType in the volumeContext * set default lvol_priority_class to 0 * feat: add topology-aware multicluster provisioning support * added neccessary import * fix merge conflict --------- Co-authored-by: Manohar Reddy <manohar@simplyblock.io>
1 parent 04c43b7 commit 61667b6

File tree

7 files changed

+12
-4
lines changed

7 files changed

+12
-4
lines changed

charts/spdk-csi/latest/spdk-csi/templates/node.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ spec:
9696
[
9797
"/bin/sh", "-c",
9898
"modprobe nvme-tcp || echo failed to modprobe nvme-tcp && \
99+
modprobe nvme-rdma || echo failed to modprobe nvme-rdma && \
99100
if [ ! -f /var/lib/nvme/hostid ]; then uuidgen > /var/lib/nvme/hostid; fi && \
100101
cp /var/lib/nvme/hostid /etc/nvme/hostid && \
101102
echo \"nqn.2014-08.org.nvmexpress:uuid:$(cat /etc/nvme/hostid)\" > /etc/nvme/hostnqn"

charts/spdk-csi/latest/spdk-csi/templates/storageclass.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ parameters:
2121
distr_ndcs: "{{ .Values.logicalVolume.numDataChunks }}"
2222
distr_npcs: "{{ .Values.logicalVolume.numParityChunks }}"
2323
lvol_priority_class: "{{ .Values.logicalVolume.lvol_priority_class }}"
24+
fabric: "{{ .Values.logicalVolume.fabric }}"
2425
max_namespace_per_subsys: "{{ .Values.logicalVolume.max_namespace_per_subsys }}"
2526
tune2fs_reserved_blocks: "{{ .Values.logicalVolume.tune2fs_reserved_blocks }}"
2627
{{- if .Values.storageclass.zoneClusterMap }}

charts/spdk-csi/latest/spdk-csi/values.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ logicalVolume:
123123
lvol_priority_class: "0"
124124
max_namespace_per_subsys: "1"
125125
tune2fs_reserved_blocks: "0"
126+
fabric: tcp
126127

127128
podAnnotations: {}
128129

pkg/spdk/controllerserver.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -500,6 +500,7 @@ func prepareCreateVolumeReq(ctx context.Context, req *csi.CreateVolumeRequest, s
500500
LvolName: req.GetName(),
501501
Size: fmt.Sprintf("%dM", sizeMiB),
502502
LvsName: params["pool_name"],
503+
Fabric: params["fabric"],
503504
MaxRWIOPS: params["qos_rw_iops"],
504505
MaxRWmBytes: params["qos_rw_mbytes"],
505506
MaxRmBytes: params["qos_r_mbytes"],

pkg/util/initiator.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ const (
3838
DevDiskByID = "/dev/disk/by-id/*%s*"
3939

4040
// TargetTypeNVMf is the target type for NVMe over Fabrics
41-
TargetTypeNVMf = "tcp"
41+
TargetTypeTCP = "tcp"
42+
TargetTypeRDMA = "rdma"
4243

4344
// TargetTypeISCSI is the target type for cache
4445
TargetTypeCache = "cache"
@@ -165,8 +166,9 @@ func NewsimplyBlockClient(clusterID string) (*NodeNVMf, error) {
165166
// NewSpdkCsiInitiator creates a new SpdkCsiInitiator based on the target type
166167
func NewSpdkCsiInitiator(volumeContext map[string]string) (SpdkCsiInitiator, error) {
167168
targetType := strings.ToLower(volumeContext["targetType"])
169+
klog.Infof("Simplyblock targetType created :%s", targetType)
168170
switch targetType {
169-
case TargetTypeNVMf:
171+
case TargetTypeTCP, TargetTypeRDMA:
170172
var connections []connectionInfo
171173

172174
err := json.Unmarshal([]byte(volumeContext["connections"]), &connections)
@@ -772,7 +774,7 @@ func fetchLvolConnection(spdkNode *NodeNVMf, lvolID string) ([]*LvolConnectResp,
772774

773775
func connectViaNVMe(conn *LvolConnectResp, ctrlLossTmo int) error {
774776
cmd := []string{
775-
"nvme", "connect", "-t", "tcp",
777+
"nvme", "connect", "-t", conn.TargetType,
776778
"-a", conn.IP, "-s", strconv.Itoa(conn.Port),
777779
"-n", conn.Nqn,
778780
"-l", strconv.Itoa(ctrlLossTmo),

pkg/util/jsonrpc.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ type LvolConnectResp struct {
112112
NrIoQueues int `json:"nr-io-queues"`
113113
CtrlLossTmo int `json:"ctrl-loss-tmo"`
114114
Port int `json:"port"`
115+
TargetType string `json:"transport"`
115116
IP string `json:"ip"`
116117
Connect string `json:"connect"`
117118
NSID int `json:"ns_id"`
@@ -310,7 +311,7 @@ func (client *RPCClient) getVolumeInfo(lvolID string) (map[string]string, error)
310311
"nrIoQueues": strconv.Itoa(result[0].NrIoQueues),
311312
"ctrlLossTmo": strconv.Itoa(result[0].CtrlLossTmo),
312313
"model": model,
313-
"targetType": "tcp",
314+
"targetType": result[0].TargetType,
314315
"connections": string(connectionsData),
315316
"nsId": strconv.Itoa(result[0].NSID),
316317
}, nil

pkg/util/nvmf.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ type CreateLVolData struct {
6666
LvolName string `json:"name"`
6767
Size string `json:"size"`
6868
LvsName string `json:"pool"`
69+
Fabric string `json:"fabric"`
6970
Compression bool `json:"comp"`
7071
Encryption bool `json:"crypto"`
7172
MaxRWIOPS string `json:"max_rw_iops"`

0 commit comments

Comments
 (0)