• M
    tap: Improve -netdev/netdev_add/-net/... tap error reporting · a3088177
    Markus Armbruster 提交于
    When -netdev tap fails, it first reports a specific error, then a
    generic one, like this:
    
        $ qemu-system-x86_64 -netdev tap,id=foo
        qemu-system-x86_64: -netdev tap,id=foo: could not configure /dev/net/tun: Operation not permitted
        qemu-system-x86_64: -netdev tap,id=foo: Device 'tap' could not be initialized
    
    With the command line, the messages go to stderr.  In HMP, they go to
    the monitor.  In QMP, the second one becomes the error reply, and the
    first one goes to stderr.
    
    Convert net_init_tap() to Error.  This suppresses the unwanted second
    message, and makes the specific error the QMP error reply.
    
    [Dropped duplicate "and" from error message as suggested by Eric Blake:
    "ifname=, script=, downscript=, and vnet_hdr=, "
    "queues=, and vhostfds= are invalid with helper="
    --Stefan]
    Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
    Reviewed-by: NEric Blake <eblake@redhat.com>
    Message-id: 1431691143-1015-16-git-send-email-armbru@redhat.com
    Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
    a3088177
tap.c 25.2 KB