libvirt/src/network
Laine Stump 2122cf3979 network: include plugged interface XML in "plugged" network hook
The network hook script gets called whenever an interface is plugged
into or unplugged from a network, but even though the full XML of both
the network and the domain is included, there is no reasonable way to
determine what exact resources the plugged interface is using:

1) Prior to a recent patch which modified the status XML of interfaces
to include the information about actual hardware resources used, it
would be possible to scan through the domain XML output sent to the
hook, and from there find the correct interface, but that interface
definition would not include any runtime info (e.g. bandwidth or vlan
taken from a portgroup, or which physdev was used in case of a macvtap
network).

2) After the patch modifying the status XML of interfaces, the network
name would no longer be included in the domain XML, so it would be
completely impossible to determine which interface was the one being
plugged.

To solve that problem, this patch includes a single <interface>
element at the beginning of the XML sent to the network hook for
"plugged" and "unplugged" (just inside <hookData>) that is the status
XML of the interface being plugged. This XML will include all info
gathered from the chosen network and portgroup.

NB: due to hardcoded spaces in all of the device *Format() functions,
the <interface> element inside the <hookData> will be indented by 6
spaces rather than 2. I had intended to fix this, but it turns out
that to make virDomainNetDefFormat() indentation relative, I would
have to do the same to virDomainDeviceInfoFormat(), and that function
is called from 19 places - making that a prerequisite of this patch
would cause too many merge difficulties if we needed to backport
network hooks, so I chose to ignore the problem here and fix the
problem for *all* devices in a followup later.
2014-02-25 16:07:36 +02:00
..
bridge_driver_linux.c Fix bridge configuration when OUTPUT policy is DROP on the host 2014-01-07 18:18:29 +01:00
bridge_driver_nop.c Add missing ATTRIBUTE_UNUSED 2013-08-12 21:30:29 +02:00
bridge_driver_platform.c bridge driver: extract platform specifics 2013-08-01 15:47:02 -06:00
bridge_driver_platform.h Added network events to the bridged network driver 2013-12-11 13:32:21 +00:00
bridge_driver.c network: include plugged interface XML in "plugged" network hook 2014-02-25 16:07:36 +02:00
bridge_driver.h bridge_driver.h: Fix build --without-network 2014-02-18 19:52:39 +01:00
default.xml Remove the space before the slash in network XML 2013-08-28 08:05:46 +02:00