[kata-dev] vsock & network namespaces in Kata

Peng Tao tao.peng at linux.alibaba.com
Tue Dec 17 03:26:42 UTC 2019



On 2019/12/17 05:51, Montes, Julio wrote:
> Hi Stefano
> 
> This patch [1] moves the runtime to the sandbox's (qemu) net namespace.
> This patch is a hotfix that should be used only for testing
> 
> -
> Julio
> 
> 
> [1] - 
> https://github.com/devimc/kata-runtime/commit/656d518da223ecff9a9086be5140734979cbba9c.patch

+func (n *Network) Set(netNSPath string) error {
+	span, _ := n.trace(context.Background(), "run")
+	defer span.Finish()
+
+	runtime.LockOSThread()
+	defer runtime.UnlockOSThread()
+
+	targetNS, err := ns.GetNS(netNSPath)
+	if err != nil {
+		return err
+	}
+
+	if err := targetNS.Set(); err != nil {
+		return err
+	}
+
+	return nil
+}

kata shimv2 has two Ms. I don't think it can work by just setting one 
thread's netns. The result is that netns is randomly set for shimv2 
goroutines.

containerd-shim-v2/service.go:  cmd.Env = append(os.Environ(), 
"GOMAXPROCS=2")

Cheers,
Tao
-- 
Into something rich and strange.



More information about the kata-dev mailing list