On 05.02.2015 16:36, Lin Ma wrote:
>>>> "Daniel P. Berrange" <berrange(a)redhat.com> 2015-2-4 下午
17:17 >>>
>On Mon, Feb 02, 2015 at 10:08:21PM +0800, Lin Ma wrote:
>> It constructs a temporary static config of the network, Obtains all of
>> attached interfaces information through netcf, Then removes the config.
>>
>> Signed-off-by: Lin Ma
>> ---
>> include/libvirt/libvirt-network.h | 1 +
>> src/Makefile.am | 3 +
>> src/network/bridge_driver.c | 141 ++++++++++++++++++++++++++++++++++-
>> src/network/bridge_driver_platform.h | 7 ++
>> tests/Makefile.am | 4 +
>> 5 files changed, 155 insertions(+), 1 deletion(-)
>
>So, IIUC, the point of this change is to display a list of all the TAP
>devices attached to a network. I'm not entirely convinced this is the
>right approach to take. Also do we want to limit this to reporting of
>devices inside bridges. It could be equally useful to see a list of
>macvtap devices associated with a physical NIC.
Obtaining a list of macvtap devices associated with a physical NIC,
It's a good idea. I intend to implement this api, also implement a new
virsh subcommand to show these information to user.
If you agreed with my thought, Then what are the proper api name and
virsh subcommand name you suggest? and what about the output format?
Well, let see. We already have a way of expressing node devices (even
virtual net interfaces): virNode* set of API. For instance:
virsh # nodedev-dumpxml net_macvtap0_52_54_00_62_35_0f
<device>
<name>net_macvtap0_52_54_00_62_35_0f</name>
<path>/sys/devices/virtual/net/macvtap0</path>
<parent>computer</parent>
<capability type='net'>
<interface>macvtap0</interface>
<address>52:54:00:62:35:0f</address>
<link state='unknown'/>
<capability type='80203'/>
</capability>
</device>
I think it would be possible to extend macvtap XMLs with <parent/>
element to reflect NIC over which macvtap is created. Although we are
aiming at the opposite mapping. But then again - we don't have any
<child/> element in nodedev XML yet. When trying to build a nodedev
tree, users are required to enumerate nodes and look for <parent/> (or
use virNodeDeviceGetParent()).
Michal