From f0d2f8a19956045b4b53ac5f2c4b59940016ca41 Mon Sep 17 00:00:00 2001 From: yangfeiyu Date: Fri, 9 Oct 2020 16:02:27 +0800 Subject: [PATCH] kata-runtime: support using CNI plugin to insert mutiple network interfaces at the same time reason: support using CNI plugin to insert mutiple network interfaces at the same time Signed-off-by: yangfeiyu --- netmon/netmon.go | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/netmon/netmon.go b/netmon/netmon.go index 57beacfb..a519e5ba 100644 --- a/netmon/netmon.go +++ b/netmon/netmon.go @@ -463,11 +463,17 @@ func (n *netmon) updateRoutes() error { // if the device of the routes have not be hotplug to guest, // the update operation will be failed, pending them. - // For all routes are belong the same device, so we just need - // judge the device of the first route - if _, pluged := n.plugedIfaces[routes[0].Device]; !pluged { - n.pendingRoutes[routes[0].Device] = routes - n.logger().Infof("dev %s have not been added, pending:%v", routes[0].Device, routes) + var pendingFlag bool + for _, route := range routes{ + if _, pluged := n.plugedIfaces[route.Device]; !pluged { + pendingFlag = true + n.pendingRoutes[route.Device] = append(n.pendingRoutes[route.Device],route) + n.logger().Infof("dev %s have not been added, pending:%v", route.Device, n.pendingRoutes[route.Device]) + } + } + + // find pending route + if pendingFlag { return nil } -- 2.23.0