2
0
mirror of git://github.com/lxc/lxc synced 2025-08-29 20:19:53 +00:00

criu: support restoring containers with pre-created veth devices

We did th CRIU and kernel work but for some reason we never did push the
LXC work.

Link: cdb0d42702
      commit cdb0d427020f ("net: allow restoring of precreated veth devices")
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
This commit is contained in:
Christian Brauner 2021-10-20 14:48:41 +02:00
parent 2db3d91eea
commit 0109a13d53
No known key found for this signature in database
GPG Key ID: 8EB056D53EECB12D

View File

@ -45,6 +45,7 @@
#define CRIU_IN_FLIGHT_SUPPORT "2.4"
#define CRIU_EXTERNAL_NOT_VETH "2.8"
#define CRIU_EXTERNAL_NETDEV "3.15"
lxc_log_define(criu, lxc);
@ -550,8 +551,22 @@ static int exec_criu(struct cgroup_ops *cgroup_ops, struct lxc_conf *conf,
TRACE("Added macvlan device entry %s", buf);
break;
case LXC_NET_PHYS:
if (cmp_version(opts->criu_version, CRIU_EXTERNAL_NETDEV) < 0)
return syserror_set(-EOPNOTSUPP, "Restoring physical network devices not supported");
if (is_empty_string(netdev->link))
return syserror_set(-EINVAL, "Specifying link is required");
ret = strnprintf(buf, sizeof(buf), "netdev[%s]:%s", eth, netdev->link);
if (ret < 0)
return syserror_set(-EIO, "Failed to append phys device name");
TRACE("Added phys device entry %s", buf);
break;
case LXC_NET_NONE:
__fallthrough;
case LXC_NET_EMPTY:
break;
default:
@ -825,6 +840,7 @@ static bool criu_ok(struct lxc_container *c, char **criu_version)
case LXC_NET_VETH:
case LXC_NET_NONE:
case LXC_NET_EMPTY:
case LXC_NET_PHYS:
case LXC_NET_MACVLAN:
break;
default: