From 7f23085c82312ef301b612d5c1119afb7a04247d Mon Sep 17 00:00:00 2001 From: Hui Kang Date: Mon, 24 Aug 2015 09:26:39 -0700 Subject: [PATCH] Add hooks for passing explicit veth pairs for forwarding to CRIU. Signed-off-by: Hui Kang --- libcontainer/container_linux.go | 6 ++++++ libcontainer/criu_opts.go | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/libcontainer/container_linux.go b/libcontainer/container_linux.go index 54ba87e23..3ea973c9d 100644 --- a/libcontainer/container_linux.go +++ b/libcontainer/container_linux.go @@ -532,6 +532,12 @@ func (c *linuxContainer) Restore(process *Process, criuOpts *CriuOpts) error { break } } + for _, i := range criuOpts.VethPairs { + veth := new(criurpc.CriuVethPair) + veth.IfOut = proto.String(i.HostInterfaceName) + veth.IfIn = proto.String(i.ContainerInterfaceName) + req.Opts.Veths = append(req.Opts.Veths, veth) + } var ( fds []string diff --git a/libcontainer/criu_opts.go b/libcontainer/criu_opts.go index bca81672e..794d5bd54 100644 --- a/libcontainer/criu_opts.go +++ b/libcontainer/criu_opts.go @@ -5,6 +5,11 @@ type CriuPageServerInfo struct { Port int32 // port number of CRIU page server } +type VethPairName struct { + ContainerInterfaceName string + HostInterfaceName string +} + type CriuOpts struct { ImagesDirectory string // directory for storing image files WorkDirectory string // directory to cd and write logs/pidfiles/stats to @@ -14,4 +19,5 @@ type CriuOpts struct { ShellJob bool // allow to dump and restore shell jobs FileLocks bool // handle file locks, for safety PageServer CriuPageServerInfo // allow to dump to criu page server + VethPairs []VethPairName // pass the veth to criu when restore }