From 735a7f9154537040189ffaad6a8f767164922976 Mon Sep 17 00:00:00 2001 From: Martynas Pumputis Date: Thu, 6 Apr 2017 16:52:42 +0100 Subject: [PATCH] Use correct path to netns of container in plugin-v2 Used when configuring ARP settings of a container upon ContainerStarted event. --- plugin/net/watcher.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/plugin/net/watcher.go b/plugin/net/watcher.go index 45dd28c7..c0d38f79 100644 --- a/plugin/net/watcher.go +++ b/plugin/net/watcher.go @@ -47,7 +47,13 @@ func (w *watcher) ContainerStarted(id string) { w.driver.warn("ContainerStarted", "unable to register %s with weaveDNS: %s", id, err) } } - if _, err := weavenet.WithNetNSByPid(info.State.Pid, "configure-arp", weavenet.VethName); err != nil { + rootDir := "/" + if w.driver.isPluginV2 { + // We bind mount host's /proc to /host/proc for plugin-v2 + rootDir = "/host" + } + netNSPath := weavenet.NSPathByPidWithRoot(rootDir, info.State.Pid) + if _, err := weavenet.WithNetNS(netNSPath, "configure-arp", weavenet.VethName); err != nil { w.driver.warn("ContainerStarted", "unable to configure interfaces: %s", err) } }