mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-06-23 22:17:19 +00:00
qemu: only set wait parameter for server mode socket based char device
Now the `wait` is passed to qmp command, even at non-server mode. This will cause qemu return this error: 'wait' option is incompatible with socket in client connect mode Fixes: #205 Signed-off-by: bin liu <liubin0329@gmail.com>
This commit is contained in:
parent
e438cc5d8c
commit
f971801b10
20
qemu/qmp.go
20
qemu/qmp.go
@ -1518,12 +1518,7 @@ func (q *QMP) ExecuteGetFD(ctx context.Context, fdname string, fd *os.File) erro
|
|||||||
// id is an identifier for the device, path specifies the local path of the unix socket,
|
// id is an identifier for the device, path specifies the local path of the unix socket,
|
||||||
// wait is to block waiting for a client to connect, server specifies that the socket is a listening socket.
|
// wait is to block waiting for a client to connect, server specifies that the socket is a listening socket.
|
||||||
func (q *QMP) ExecuteCharDevUnixSocketAdd(ctx context.Context, id, path string, wait, server bool) error {
|
func (q *QMP) ExecuteCharDevUnixSocketAdd(ctx context.Context, id, path string, wait, server bool) error {
|
||||||
args := map[string]interface{}{
|
data := map[string]interface{}{
|
||||||
"id": id,
|
|
||||||
"backend": map[string]interface{}{
|
|
||||||
"type": "socket",
|
|
||||||
"data": map[string]interface{}{
|
|
||||||
"wait": wait,
|
|
||||||
"server": server,
|
"server": server,
|
||||||
"addr": map[string]interface{}{
|
"addr": map[string]interface{}{
|
||||||
"type": "unix",
|
"type": "unix",
|
||||||
@ -1531,7 +1526,18 @@ func (q *QMP) ExecuteCharDevUnixSocketAdd(ctx context.Context, id, path string,
|
|||||||
"path": path,
|
"path": path,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
}
|
||||||
|
|
||||||
|
// wait is only valid for server mode
|
||||||
|
if server {
|
||||||
|
data["wait"] = wait
|
||||||
|
}
|
||||||
|
|
||||||
|
args := map[string]interface{}{
|
||||||
|
"id": id,
|
||||||
|
"backend": map[string]interface{}{
|
||||||
|
"type": "socket",
|
||||||
|
"data": data,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
return q.executeCommand(ctx, "chardev-add", args, nil)
|
return q.executeCommand(ctx, "chardev-add", args, nil)
|
||||||
|
Loading…
Reference in New Issue
Block a user