[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-block] [for-2.9 2/8] char: Fix socket with "type": "vsock" add
From: |
Marc-André Lureau |
Subject: |
Re: [Qemu-block] [for-2.9 2/8] char: Fix socket with "type": "vsock" address |
Date: |
Wed, 29 Mar 2017 12:49:31 -0400 (EDT) |
----- Original Message -----
>
> Hi
>
> ----- Original Message -----
> > Watch this:
> >
> > $ qemu-system-x86_64 -nodefaults -S -display none -qmp stdio
> > {"QMP": {"version": {"qemu": {"micro": 91, "minor": 8, "major": 2},
> > "package": " (v2.8.0-1195-gf84141e-dirty)"}, "capabilities": []}}
> > { "execute": "qmp_capabilities" }
> > {"return": {}}
> > { "execute": "chardev-add", "arguments": { "id": "chr0", "backend": {
> > "type": "socket", "data": { "addr": { "type": "vsock", "data": { "cid":
> > "CID", "port": "P" }}}}}}
> > Aborted (core dumped)
> >
> > Crashes because SocketAddress_to_str() is blissfully unaware of
> > SOCKET_ADDRESS_KIND_VSOCK. Fix that. Pick the output format to match
> > socket_parse(), just like the existing formats.
> >
> > Cc: Stefan Hajnoczi <address@hidden>
> > Cc: Paolo Bonzini <address@hidden>
> > Cc: Marc-André Lureau <address@hidden>
> > Signed-off-by: Markus Armbruster <address@hidden>
>
> Reviewed-by: Marc-André Lureau <address@hidden>
>
> > ---
> > chardev/char-socket.c | 4 ++++
> > 1 file changed, 4 insertions(+)
> >
> > diff --git a/chardev/char-socket.c b/chardev/char-socket.c
> > index 6344b07..36ab0d6 100644
> > --- a/chardev/char-socket.c
> > +++ b/chardev/char-socket.c
> > @@ -357,6 +357,10 @@ static char *SocketAddress_to_str(const char *prefix,
> > SocketAddress *addr,
> > return g_strdup_printf("%sfd:%s%s", prefix, addr->u.fd.data->str,
> > is_listen ? ",server" : "");
> > break;
> > + case SOCKET_ADDRESS_KIND_VSOCK:
> > + return g_strdup_printf("%svsock:%s:%s", prefix,
> > + addr->u.vsock.data->cid,
> > + addr->u.vsock.data->port);
> > default:
> > abort();
>
> ooch.. may I suggest we don't abort() here? g_return_val_if_fail() perhaps a
> more judicious choice?
-> g_return_if_reached()
>
- [Qemu-block] [for-2.9 1/8] nbd sockets vnc: Mark problematic address family tests TODO, (continued)
[Qemu-block] [for-2.9 2/8] char: Fix socket with "type": "vsock" address, Markus Armbruster, 2017/03/29
Re: [Qemu-block] [for-2.9 2/8] char: Fix socket with "type": "vsock" address, Stefan Hajnoczi, 2017/03/29
Re: [Qemu-block] [for-2.9 2/8] char: Fix socket with "type": "vsock" address, Max Reitz, 2017/03/29
[Qemu-block] [for-2.9 4/8] block: Document -drive problematic code and bugs, Markus Armbruster, 2017/03/29
[Qemu-block] [for-2.9 7/8] nbd: Tidy up blockdev-add interface, Markus Armbruster, 2017/03/29