[libvirt] [PATCH 2/2 (v3)] util: fallback to ioctl(SIOCBRDELBR) if netlink RTM_DELLINK fails

Michal Privoznik mprivozn at redhat.com
Thu Aug 27 01:24:16 UTC 2015


On 26.08.2015 21:05, Laine Stump wrote:
> commit 09778e09 switched from using ioctl(SIOCBRDELBR) for bridge
> device deletion to using a netlink RTM_DELLINK message, which is the
> more modern way to delete a bridge (and also doesn't require the
> bridge to be ~IFF_UP to succeed). However, although older kernels
> (e.g. 2.6.32, in RHEL6/CentOS6) support deleting *some* link types
> with RTM_NEWLINK, they don't support deleting bridges, and there is no
> compile-time way to figure this out.
> 
> This patch moves the body of the SIOCBRDELBR version of
> virNetDevBridgeDelete() into a static function, calls the new function
> from the original, and also calls the new function from the
> RTM_DELLINK version if the RTM_DELLINK message generates an EOPNOTSUPP
> error. Since RTM_DELLINK is done from the subordinate function
> virNetlinkDelLink, which is also called for other purposes (deleting a
> macvtap interface), a function pointer called "fallback" has been
> added to the arglist of virNetlinkDelLink() - if that arg != NULL, the
> provided function will be called when (and only when) RTM_DELLINK
> fails with EOPNOTSUPP.
> 
> Resolves:  https://bugzilla.redhat.com/show_bug.cgi?id=1252780 (part 2)
> ---
> Another idea for doing this I came up with during review of the others...
> 
>  src/util/virnetdevbridge.c  | 41 ++++++++++++++++++++++++++++++-----------
>  src/util/virnetdevmacvlan.c |  2 +-
>  src/util/virnetlink.c       | 13 +++++++++++--
>  src/util/virnetlink.h       |  5 ++++-
>  4 files changed, 46 insertions(+), 15 deletions(-)

ACK. But don't forget that the counterpart is broken too. Once you
destroy network, on RHEL-6, you can't start it up, because of the same
problem.

Michal




More information about the libvir-list mailing list