mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-17 07:02:03 -06:00
vhost-user-test: use unix port for migration
TCP port 1234 may be used by another process concurrently. Instead use a temporary unix socket. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
parent
9732baf678
commit
a899b1ea2a
1 changed files with 7 additions and 1 deletions
|
@ -123,6 +123,7 @@ static VhostUserMsg m __attribute__ ((unused));
|
||||||
|
|
||||||
typedef struct TestServer {
|
typedef struct TestServer {
|
||||||
gchar *socket_path;
|
gchar *socket_path;
|
||||||
|
gchar *mig_path;
|
||||||
gchar *chr_name;
|
gchar *chr_name;
|
||||||
CharDriverState *chr;
|
CharDriverState *chr;
|
||||||
int fds_num;
|
int fds_num;
|
||||||
|
@ -364,6 +365,7 @@ static TestServer *test_server_new(const gchar *name)
|
||||||
gchar *chr_path;
|
gchar *chr_path;
|
||||||
|
|
||||||
server->socket_path = g_strdup_printf("%s/%s.sock", tmpfs, name);
|
server->socket_path = g_strdup_printf("%s/%s.sock", tmpfs, name);
|
||||||
|
server->mig_path = g_strdup_printf("%s/%s.mig", tmpfs, name);
|
||||||
|
|
||||||
chr_path = g_strdup_printf("unix:%s,server,nowait", server->socket_path);
|
chr_path = g_strdup_printf("unix:%s,server,nowait", server->socket_path);
|
||||||
server->chr_name = g_strdup_printf("chr-%s", name);
|
server->chr_name = g_strdup_printf("chr-%s", name);
|
||||||
|
@ -405,6 +407,9 @@ static gboolean _test_server_free(TestServer *server)
|
||||||
unlink(server->socket_path);
|
unlink(server->socket_path);
|
||||||
g_free(server->socket_path);
|
g_free(server->socket_path);
|
||||||
|
|
||||||
|
unlink(server->mig_path);
|
||||||
|
g_free(server->mig_path);
|
||||||
|
|
||||||
g_free(server->chr_name);
|
g_free(server->chr_name);
|
||||||
g_free(server);
|
g_free(server);
|
||||||
|
|
||||||
|
@ -512,7 +517,7 @@ static void test_migrate(void)
|
||||||
{
|
{
|
||||||
TestServer *s = test_server_new("src");
|
TestServer *s = test_server_new("src");
|
||||||
TestServer *dest = test_server_new("dest");
|
TestServer *dest = test_server_new("dest");
|
||||||
const char *uri = "tcp:127.0.0.1:1234";
|
char *uri = g_strdup_printf("%s%s", "unix:", dest->mig_path);
|
||||||
QTestState *global = global_qtest, *from, *to;
|
QTestState *global = global_qtest, *from, *to;
|
||||||
GSource *source;
|
GSource *source;
|
||||||
gchar *cmd;
|
gchar *cmd;
|
||||||
|
@ -583,6 +588,7 @@ static void test_migrate(void)
|
||||||
test_server_free(dest);
|
test_server_free(dest);
|
||||||
qtest_quit(from);
|
qtest_quit(from);
|
||||||
test_server_free(s);
|
test_server_free(s);
|
||||||
|
g_free(uri);
|
||||||
|
|
||||||
global_qtest = global;
|
global_qtest = global;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue