Skip to content

Commit a3435ba

Browse files
authored
added nvmf optional connect param host-iface (#283)
1 parent d78f467 commit a3435ba

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

pkg/util/initiator.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ type initiatorNVMf struct {
6666
ctrlLossTmo string
6767
model string
6868
nsId string
69+
hostIface string
6970
}
7071

7172
// initiatorCache is an implementation of NVMf cache initiator
@@ -185,6 +186,7 @@ func NewSpdkCsiInitiator(volumeContext map[string]string) (SpdkCsiInitiator, err
185186
ctrlLossTmo: volumeContext["ctrlLossTmo"],
186187
model: volumeContext["model"],
187188
nsId: volumeContext["nsId"],
189+
hostIface: volumeContext["hostIface"],
188190
}, nil
189191

190192
case "cache":
@@ -361,6 +363,11 @@ func (nvmf *initiatorNVMf) Connect() (string, error) {
361363
"-a", connections[i].IP, "-s", strconv.Itoa(conn.Port), "-n", nvmf.nqn, "-l", strconv.Itoa(ctrlLossTmo),
362364
"-c", nvmf.reconnectDelay, "-i", nvmf.nrIoQueues,
363365
}
366+
367+
if nvmf.hostIface != "" {
368+
cmdLine = append(cmdLine, "-f", nvmf.hostIface)
369+
}
370+
364371
err := execWithTimeoutRetry(cmdLine, 40, len(nvmf.connections))
365372
if err != nil {
366373
// go on checking device status in case caused by duplicated request

pkg/util/jsonrpc.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ type LvolConnectResp struct {
116116
IP string `json:"ip"`
117117
Connect string `json:"connect"`
118118
NSID int `json:"ns_id"`
119+
HostIface string `json:"host-iface,omitempty"`
119120
}
120121

121122
type connectionInfo struct {
@@ -314,6 +315,7 @@ func (client *RPCClient) getVolumeInfo(lvolID string) (map[string]string, error)
314315
"targetType": result[0].TargetType,
315316
"connections": string(connectionsData),
316317
"nsId": strconv.Itoa(result[0].NSID),
318+
"hostIface": result[0].HostIface,
317319
}, nil
318320
}
319321

0 commit comments

Comments
 (0)