netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* iproute2: Run over all netns
@ 2015-01-05 12:23 Vadim Kochan
  2015-01-05 16:40 ` Nicolas Dichtel
  0 siblings, 1 reply; 2+ messages in thread
From: Vadim Kochan @ 2015-01-05 12:23 UTC (permalink / raw)
  To: netdev

Hi All,

I have some piece of code which allow 'ip cmd'
on each netns, I found it useful for getting some info
from all the netns in one shot, BUT I faced with one issue
which mostly related to the user interface design. The problem
is that it would be good to print netns name only when
user uses "show" command, but not for updating/adding (IMHO),
but its hard to find the good way to implement this.

To run each netns the 'ip -net all CMD ...' construction can be used.

I see the following options for this:

#1 Add additional option ( -N ? ) for show netns label on each executing of CMD:

    # ip -net all -N link

    [test_net]
    1: lo: <LOOPBACK> mtu 65536 qdisc noop state DOWN group default 
        link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00

    [home0]
    1: lo: <LOOPBACK> mtu 65536 qdisc noop state DOWN group default 
        link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00

    [lan0]
    1: lo: <LOOPBACK> mtu 65536 qdisc noop state DOWN group default 
        link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00

    [wan0]
    1: lo: <LOOPBACK> mtu 65536 qdisc noop state DOWN group default 
        link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    2: br0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default 
        link/ether 16:f7:cb:b6:7a:8e brd ff:ff:ff:ff:ff:ff

    [vnet0]
    1: lo: <LOOPBACK> mtu 65536 qdisc noop state DOWN group default 
        link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00


    and w/o:

    # ip -net all link

    1: lo: <LOOPBACK> mtu 65536 qdisc noop state DOWN group default 
        link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00

    1: lo: <LOOPBACK> mtu 65536 qdisc noop state DOWN group default 
        link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00

    1: lo: <LOOPBACK> mtu 65536 qdisc noop state DOWN group default 
        link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00

    1: lo: <LOOPBACK> mtu 65536 qdisc noop state DOWN group default 
        link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    2: br0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default 
        link/ether 16:f7:cb:b6:7a:8e brd ff:ff:ff:ff:ff:ff

    1: lo: <LOOPBACK> mtu 65536 qdisc noop state DOWN group default 
        link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00

    the last one is not so useful right ?

#2 Prints netns name by default if "-net all" was specified
(add option to prevent this ?), so it will be printed even on the
add/del/change commands ...

    # ip -net all link add ...

    [home0]
    [lan0]
    [wan0]
    [vnet0]

    but does it really useless to see that it will shows all the netns
    on which cmd has been ran ?

#3 Do a lot of refactoring to explicitly show netns name for all
"show" commands ...

#4 The tricky option is to look for the all kinds of "show", "ls",
"list" commands in the args and print the netns name when 'all' netns was
specified.

I 'd like to hear your feedbacks, even if someone will say that ALL this
sucks:).

Regards,

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: iproute2: Run over all netns
  2015-01-05 12:23 iproute2: Run over all netns Vadim Kochan
@ 2015-01-05 16:40 ` Nicolas Dichtel
  0 siblings, 0 replies; 2+ messages in thread
From: Nicolas Dichtel @ 2015-01-05 16:40 UTC (permalink / raw)
  To: Vadim Kochan, netdev

Le 05/01/2015 13:23, Vadim Kochan a écrit :
> Hi All,
>
> I have some piece of code which allow 'ip cmd'
> on each netns, I found it useful for getting some info
> from all the netns in one shot, BUT I faced with one issue
> which mostly related to the user interface design. The problem
> is that it would be good to print netns name only when
> user uses "show" command, but not for updating/adding (IMHO),
> but its hard to find the good way to implement this.
>
> To run each netns the 'ip -net all CMD ...' construction can be used.
>
> I see the following options for this:
>
> #1 Add additional option ( -N ? ) for show netns label on each executing of CMD:
>
>      # ip -net all -N link
>
>      [test_net]
>      1: lo: <LOOPBACK> mtu 65536 qdisc noop state DOWN group default
>          link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
>
>      [home0]
>      1: lo: <LOOPBACK> mtu 65536 qdisc noop state DOWN group default
>          link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
>
>      [lan0]
>      1: lo: <LOOPBACK> mtu 65536 qdisc noop state DOWN group default
>          link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
>
>      [wan0]
>      1: lo: <LOOPBACK> mtu 65536 qdisc noop state DOWN group default
>          link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
>      2: br0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default
>          link/ether 16:f7:cb:b6:7a:8e brd ff:ff:ff:ff:ff:ff
>
>      [vnet0]
>      1: lo: <LOOPBACK> mtu 65536 qdisc noop state DOWN group default
>          link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
>
>
>      and w/o:
>
>      # ip -net all link
>
>      1: lo: <LOOPBACK> mtu 65536 qdisc noop state DOWN group default
>          link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
>
>      1: lo: <LOOPBACK> mtu 65536 qdisc noop state DOWN group default
>          link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
>
>      1: lo: <LOOPBACK> mtu 65536 qdisc noop state DOWN group default
>          link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
>
>      1: lo: <LOOPBACK> mtu 65536 qdisc noop state DOWN group default
>          link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
>      2: br0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default
>          link/ether 16:f7:cb:b6:7a:8e brd ff:ff:ff:ff:ff:ff
>
>      1: lo: <LOOPBACK> mtu 65536 qdisc noop state DOWN group default
>          link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
>
>      the last one is not so useful right ?
>
> #2 Prints netns name by default if "-net all" was specified
> (add option to prevent this ?), so it will be printed even on the
> add/del/change commands ...
I vote for this one (I don't think the option to prevent it is needed, it's
better to be explicit).

>
>      # ip -net all link add ...
>
>      [home0]
>      [lan0]
>      [wan0]
>      [vnet0]
>
>      but does it really useless to see that it will shows all the netns
>      on which cmd has been ran ?
I tend to say yes (another process may add/remove a netns in the same time).


Regards,
Nicolas

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-01-05 16:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-05 12:23 iproute2: Run over all netns Vadim Kochan
2015-01-05 16:40 ` Nicolas Dichtel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).