mbox series

[v1,0/8] Improvements and clean-ups related to -net

Message ID 1519031728-9850-1-git-send-email-thuth@redhat.com
Headers show
Series Improvements and clean-ups related to -net | expand

Message

Thomas Huth Feb. 19, 2018, 9:15 a.m. UTC
"-net" is a legacy option that often causes confusion and
misconfigurations for the users, since most people are not aware
of the underlying "vlan" (i.e. hub) concept that is used for this
parameter. The prefered way of configuring your network stack is
to use "--netdev" instead, which gives you a clean 1:1 connection
between your emulated guest hardware and the host network backend.

However, there are two reasons why we could not completely deprecate
"-net" yet:

1) Convenience:
In some cases, it's more convenient to use "-net" instead of "-netdev",
e.g. if you just want to have a "tap" network connection, it's faster
to type "-net nic -net tap" instead of "-device e1000,netdev=n1 -netdev
tap,id=n1".

2) On-board NICs:
Currently the "-net nic" parameter is the only way to configure on-board
NICs on certain (embedded) machines via the nd_table[] array.

So beside some generic clean-ups and removal of code that has been
marked as deprecated since QEMU 2.10 already, this patch series
introduces a new parameter "-n" (in patch 7/8) which should be able to
replace "-net" in the long run completely: This new convenience parameter
can be used to configure the default/on-board guest HW together with a
host network backend in a very compact way. To configure a tap backend
for the default NIC, you just have to type "-n tap" here for example.

The last patch finally makes "-net" less prominent in our qemu docs,
e.g. by replacing the examples that contain "-net" with "-netdev".

Note that "-net" itself is not marked as deprecated yet - I think we
should rather do that after one or two QEMU release with "-n" so that
we have enough time to test and get used to the new parameter first.
Or we should likely even keep the "-net" around for a couple of years
since there are a lot of scripts and tools out there that still use
this legacy parameter...

Thomas Huth (8):
  net: Move error reporting from net_init_client/netdev to the calling
    site
  net: List available netdevs with "-netdev help"
  net: Only show vhost-user in the help text if CONFIG_POSIX is defined
  net: Make net_client_init() static
  net: Remove the deprecated way of dumping network packets
  net: Remove the deprecated 'host_net_add' and 'host_net_remove' HMP
    commands
  net: Add a new convenience option "-n" to configure default/on-board
    NICs
  qemu-doc: Make "-net" less prominent

 hmp-commands.hx         |  30 ------
 hmp.h                   |   3 -
 include/net/net.h       |   4 +-
 include/sysemu/sysemu.h |   1 +
 monitor.c               |  61 -------------
 net/dump.c              | 102 +--------------------
 net/net.c               | 237 +++++++++++++++++++++++-------------------------
 qapi/net.json           |  27 +-----
 qemu-doc.texi           |  16 ----
 qemu-options.hx         | 213 +++++++++++++++++++++++--------------------
 tests/test-hmp.c        |   2 -
 vl.c                    |  10 +-
 12 files changed, 247 insertions(+), 459 deletions(-)

Comments

Eric Blake Feb. 19, 2018, 1:29 p.m. UTC | #1
On 02/19/2018 03:15 AM, Thomas Huth wrote:

> The last patch finally makes "-net" less prominent in our qemu docs,
> e.g. by replacing the examples that contain "-net" with "-netdev".

Minor request: while doing this, can we update the documentation to 
mention "--netdev" and "--n" everywhere we touch things?  See this for 
rationale:
https://wiki.qemu.org/BiteSizedTasks#Consistent_option_usage_in_documentation
Thomas Huth Feb. 19, 2018, 1:37 p.m. UTC | #2
On 19.02.2018 14:29, Eric Blake wrote:
> On 02/19/2018 03:15 AM, Thomas Huth wrote:
> 
>> The last patch finally makes "-net" less prominent in our qemu docs,
>> e.g. by replacing the examples that contain "-net" with "-netdev".
> 
> Minor request: while doing this, can we update the documentation to
> mention "--netdev" and "--n" everywhere we touch things?  See this for
> rationale:
> https://wiki.qemu.org/BiteSizedTasks#Consistent_option_usage_in_documentation

Yes, I already tried to do that (see the last patch of this series).
Just forgot to use it in the cover letter, too ;-)

 Thomas