mirror of
https://passt.top/passt
synced 2025-09-18 16:39:12 +02:00
migrate: Skeleton of live migration logic
Introduce facilities for guest migration on top of vhost-user infrastructure. Add migration facilities based on top of the current vhost-user infrastructure, moving vu_migrate() and related functions to migrate.c. Versioned migration stages define function pointers to be called on source or target, or data sections that need to be transferred. The migration header consists of a magic number, a version number for the encoding, and a "compat_version" which represents the oldest version which is compatible with the current one. We don't use it yet, but that allows for the future possibility of backwards compatible protocol extensions. Co-authored-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
This commit is contained in:
parent
836fe215e0
commit
5911e08c0f
11 changed files with 324 additions and 115 deletions
8
passt.c
8
passt.c
|
@ -51,6 +51,7 @@
|
|||
#include "tcp_splice.h"
|
||||
#include "ndp.h"
|
||||
#include "vu_common.h"
|
||||
#include "migrate.h"
|
||||
|
||||
#define EPOLL_EVENTS 8
|
||||
|
||||
|
@ -75,7 +76,6 @@ char *epoll_type_str[] = {
|
|||
[EPOLL_TYPE_TAP_LISTEN] = "listening qemu socket",
|
||||
[EPOLL_TYPE_VHOST_CMD] = "vhost-user command socket",
|
||||
[EPOLL_TYPE_VHOST_KICK] = "vhost-user kick socket",
|
||||
[EPOLL_TYPE_VHOST_MIGRATION] = "vhost-user migration socket",
|
||||
};
|
||||
static_assert(ARRAY_SIZE(epoll_type_str) == EPOLL_NUM_TYPES,
|
||||
"epoll_type_str[] doesn't match enum epoll_type");
|
||||
|
@ -202,6 +202,7 @@ int main(int argc, char **argv)
|
|||
isolate_initial(argc, argv);
|
||||
|
||||
c.pasta_netns_fd = c.fd_tap = c.pidfile_fd = -1;
|
||||
c.device_state_fd = -1;
|
||||
|
||||
sigemptyset(&sa.sa_mask);
|
||||
sa.sa_flags = 0;
|
||||
|
@ -357,9 +358,6 @@ loop:
|
|||
case EPOLL_TYPE_VHOST_KICK:
|
||||
vu_kick_cb(c.vdev, ref, &now);
|
||||
break;
|
||||
case EPOLL_TYPE_VHOST_MIGRATION:
|
||||
vu_migrate(c.vdev, eventmask);
|
||||
break;
|
||||
default:
|
||||
/* Can't happen */
|
||||
ASSERT(0);
|
||||
|
@ -368,5 +366,7 @@ loop:
|
|||
|
||||
post_handler(&c, &now);
|
||||
|
||||
migrate_handler(&c);
|
||||
|
||||
goto loop;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue