On 06/22/2016 01:37 PM, Laine Stump wrote:
This patch takes the code out of
lxcContainerRenameAndEnableInterfaces() that adds all IP addresses and
IP routes to the interface, and puts it into a utility function
virNetDevIPInfoAddToDev() in virnetdevip.c so that it can be used by
anyone.
One small change in functionality -
lxcContainerRenameAndEnableInterfaces() previously would add all IP
addresses to the interface while it was still offline, then set the
interface online, and then add the routes. Because I don't want the
utility function to set the interface online, I've moved this up so
the interface is first set online, then IP addresses and routes are
added. This is the same order that the network service from
initscripts (in ifup-ether) does it, so it shouldn't pose any problem
(and hasn't, in the tests that I've run).
Saw that - was wondering, then I read the commit message. Fine by me...
---
src/libvirt_private.syms | 1 +
src/lxc/lxc_container.c | 46 +++++++++----------------------------
src/util/virnetdevip.c | 60 ++++++++++++++++++++++++++++++++++++++++++++++++
src/util/virnetdevip.h | 2 ++
4 files changed, 74 insertions(+), 35 deletions(-)
Funny/Ironic - this patch fixes the Coverity error I noted in the
previous patch for lxcContainerRenameAndEnableInterfaces
NIT: See below - for virnetipdev.h minor nit.
ACK
John
[...]
diff --git a/src/util/virnetdevip.h b/src/util/virnetdevip.h
index be41636..66c5c00 100644
--- a/src/util/virnetdevip.h
+++ b/src/util/virnetdevip.h
@@ -86,5 +86,7 @@ virSocketAddrPtr virNetDevIPRouteGetGateway(virNetDevIPRoutePtr def);
/* virNetDevIPInfo object */
void virNetDevIPInfoClear(virNetDevIPInfoPtr ip);
+int virNetDevIPInfoAddToDev(const char *ifname,
^^
+ virNetDevIPInfo const *ipInfo);
There one extraneous space here... don't forget to align the argument
then too.
#endif /* __VIR_NETDEVIP_H__ */