mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-22 18:07:57 +00:00
net: Treat venet device as a separate complete device
When restoring venet device we need to restore its index as well, which actually possible with new iproute2 package but the problem is that the index itself lays inside image file. We could use crit tool to extract it but this would slowdon procedure signifantly (need to run python which would parse the image, or need to pass the index into environmnet from inside of the CRIU itself). So lets do a trick and simply created venet device inside container by criu itself (thanks we support creating venet via netlink interface now). Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org> Acked-by: Andrew Vagin <avagin@odin.com> Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
parent
8f0f75a6d6
commit
2467a30fe2
24
net.c
24
net.c
@ -243,12 +243,7 @@ static int dump_one_voiddev(struct ifinfomsg *ifi, char *kind,
|
|||||||
struct rtattr **tb, struct cr_imgset *fds)
|
struct rtattr **tb, struct cr_imgset *fds)
|
||||||
{
|
{
|
||||||
if (!strcmp(kind, "venet"))
|
if (!strcmp(kind, "venet"))
|
||||||
/*
|
return dump_one_netdev(ND_TYPE__VENET, ifi, tb, fds, NULL);
|
||||||
* If we meet a link we know about, such as
|
|
||||||
* OpenVZ's venet, save general parameters of
|
|
||||||
* it as external link.
|
|
||||||
*/
|
|
||||||
return dump_one_netdev(ND_TYPE__EXTLINK, ifi, tb, fds, NULL);
|
|
||||||
|
|
||||||
return dump_unknown_device(ifi, kind, tb, fds);
|
return dump_unknown_device(ifi, kind, tb, fds);
|
||||||
}
|
}
|
||||||
@ -441,6 +436,21 @@ static int veth_link_info(NetDeviceEntry *nde, struct newlink_req *req)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int venet_link_info(NetDeviceEntry *nde, struct newlink_req *req)
|
||||||
|
{
|
||||||
|
struct rtattr *venet_data;
|
||||||
|
|
||||||
|
BUG_ON(ns_fd < 0);
|
||||||
|
|
||||||
|
venet_data = NLMSG_TAIL(&req->h);
|
||||||
|
addattr_l(&req->h, sizeof(*req), IFLA_INFO_KIND, "venet", 5);
|
||||||
|
addattr_l(&req->h, sizeof(*req), IFLA_INFO_DATA, NULL, 0);
|
||||||
|
addattr_l(&req->h, sizeof(*req), IFLA_NET_NS_FD, &ns_fd, sizeof(ns_fd));
|
||||||
|
venet_data->rta_len = (void *)NLMSG_TAIL(&req->h) - (void *)venet_data;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int restore_link(NetDeviceEntry *nde, int nlsk)
|
static int restore_link(NetDeviceEntry *nde, int nlsk)
|
||||||
{
|
{
|
||||||
pr_info("Restoring link %s type %d\n", nde->name, nde->type);
|
pr_info("Restoring link %s type %d\n", nde->name, nde->type);
|
||||||
@ -449,6 +459,8 @@ static int restore_link(NetDeviceEntry *nde, int nlsk)
|
|||||||
case ND_TYPE__LOOPBACK: /* fallthrough */
|
case ND_TYPE__LOOPBACK: /* fallthrough */
|
||||||
case ND_TYPE__EXTLINK: /* see comment in protobuf/netdev.proto */
|
case ND_TYPE__EXTLINK: /* see comment in protobuf/netdev.proto */
|
||||||
return restore_link_parms(nde, nlsk);
|
return restore_link_parms(nde, nlsk);
|
||||||
|
case ND_TYPE__VENET:
|
||||||
|
return restore_one_link(nde, nlsk, venet_link_info);
|
||||||
case ND_TYPE__VETH:
|
case ND_TYPE__VETH:
|
||||||
return restore_one_link(nde, nlsk, veth_link_info);
|
return restore_one_link(nde, nlsk, veth_link_info);
|
||||||
case ND_TYPE__TUN:
|
case ND_TYPE__TUN:
|
||||||
|
@ -12,6 +12,10 @@ enum nd_type {
|
|||||||
* by the setup-namespaces script.
|
* by the setup-namespaces script.
|
||||||
*/
|
*/
|
||||||
EXTLINK = 4;
|
EXTLINK = 4;
|
||||||
|
/*
|
||||||
|
* Virtuozzo specific device.
|
||||||
|
*/
|
||||||
|
VENET = 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
message net_device_entry {
|
message net_device_entry {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user