Skip to content

Commit

Permalink
updated caching-node connect param
Browse files Browse the repository at this point in the history
  • Loading branch information
geoffrey1330 committed Aug 22, 2024
1 parent 2459065 commit 798f16c
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 20 deletions.
4 changes: 2 additions & 2 deletions charts/latest/spdk-csi/templates/caching-node-handler.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ spec:
value: "{{ .Values.cachingnode.cpuMask }}"
- name: SPDKMEM
value: "{{ .Values.cachingnode.spdkMem }}"
- name: SPDKIMAGE
value: "{{ .Values.image.spdk.repository }}:{{ .Values.image.spdk.tag }}"
# - name: SPDKIMAGE
# value: "{{ .Values.image.spdk.repository }}:{{ .Values.image.spdk.tag }}"
- name: S3DATAPATH
value: "{{ .Values.cachingnode.s3DataPath }}"
- name: BLOCKEDPCIE
Expand Down
2 changes: 1 addition & 1 deletion e2e/templates/pvc-cache.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ metadata:
annotations:
simplybk/secret-name: simplyblock-pvc-keys
simplybk/secret-namespace: default
#simplybk/host-id: 3edee612-c833-4dbf-a55b-966b057d0e3b
simplybk/host-id: 1678ca3e-f02a-4855-ac8f-95e3bd8e2362
spec:
accessModes:
- ReadWriteOnce
Expand Down
6 changes: 2 additions & 4 deletions pkg/spdk/controllerserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -349,14 +349,12 @@ func (cs *controllerServer) publishVolume(req *csi.CreateVolumeRequest, volumeID
if err != nil {
return nil, err
}
err = cs.spdkNode.CachingNodeConnect(hostID, spdkVol.lvolID)
connInfo, err := cs.spdkNode.CachingNodeConnect(hostID, spdkVol.lvolID)

Check failure on line 352 in pkg/spdk/controllerserver.go

View workflow job for this annotation

GitHub Actions / Analyze (go)

shadow: declaration of "err" shadows declaration at line 337 (govet)
if err != nil {
klog.Errorf("error Connecting volume to host: %v", err)
return nil, err
}
return map[string]string{
"hostID": hostID,
}, nil
return connInfo, nil
}

volumeInfo, err := cs.spdkNode.VolumeInfo(spdkVol.lvolID)
Expand Down
18 changes: 9 additions & 9 deletions pkg/util/jsonrpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -302,20 +302,20 @@ type CachingNodeReq struct {
LvolID string `json:"lvol_id"`
}

func (client *RPCClient) cachingNodeConnect(hostID, lvolID string) (bool, error) {
func (client *RPCClient) cachingNodeConnect(hostID, lvolID string) (map[string]string, error) {
params := CachingNodeReq{
LvolID: lvolID,
}
var result bool
out, err := client.CallSBCLI("PUT", "/cachingnode/connect/"+hostID, &params)

_, err := client.CallSBCLI("PUT", "/cachingnode/connect/"+hostID, &params)
if err != nil {
return false, err
}
result, ok := out.(bool)
if !ok {
return false, fmt.Errorf("failed to convert the response to bool type. Interface: %v", out)
return nil, err
}
return result, nil
return map[string]string{
"name": lvolID,
"uuid": lvolID,
"model": lvolID,
}, nil
}

func (client *RPCClient) resizeVolume(lvolID string, newSize int64) (bool, error) {
Expand Down
8 changes: 4 additions & 4 deletions pkg/util/nvmf.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,13 +160,13 @@ func (node *NodeNVMf) DeleteSnapshot(snapshotID string) error {
return nil
}

func (node *NodeNVMf) CachingNodeConnect(hostID, lvolID string) error {
_, err := node.client.cachingNodeConnect(hostID, lvolID)
func (node *NodeNVMf) CachingNodeConnect(hostID, lvolID string) (map[string]string, error) {
conn, err := node.client.cachingNodeConnect(hostID, lvolID)
if err != nil {
return err
return nil, err
}
klog.V(5).Infof("caching node connected: %s", hostID)
return nil
return conn, nil
}

// PublishVolume exports a volume through NVMf target
Expand Down

0 comments on commit 798f16c

Please sign in to comment.