[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v6 23/24] vhost-user-test: check ownership during mi
From: |
marcandre . lureau |
Subject: |
[Qemu-devel] [PATCH v6 23/24] vhost-user-test: check ownership during migration |
Date: |
Tue, 29 Sep 2015 18:34:53 +0200 |
From: Marc-André Lureau <address@hidden>
Check that backend source and destination do not have simultaneous
ownership during migration.
Signed-off-by: Marc-André Lureau <address@hidden>
---
tests/vhost-user-test.c | 38 ++++++++++++++++++++++++++++++++++++++
1 file changed, 38 insertions(+)
diff --git a/tests/vhost-user-test.c b/tests/vhost-user-test.c
index 7b5f130..56a24df 100644
--- a/tests/vhost-user-test.c
+++ b/tests/vhost-user-test.c
@@ -380,6 +380,10 @@ static void chr_read(void *opaque, const uint8_t *buf, int
size)
g_cond_signal(s->data_cond);
break;
+ case VHOST_USER_RESET_DEVICE:
+ s->fds_num = 0;
+ break;
+
default:
break;
}
@@ -511,12 +515,37 @@ static guint64 get_log_size(TestServer *s)
return log_size;
}
+typedef struct TestMigrateSource {
+ GSource source;
+ TestServer *src;
+ TestServer *dest;
+} TestMigrateSource;
+
+static gboolean
+test_migrate_source_check(GSource *source)
+{
+ TestMigrateSource *t = (TestMigrateSource *)source;
+ gboolean overlap = t->src->fds_num > 0 && t->dest->fds_num > 0;
+
+ g_assert(!overlap);
+
+ return FALSE;
+}
+
+GSourceFuncs test_migrate_source_funcs = {
+ NULL,
+ test_migrate_source_check,
+ NULL,
+ NULL
+};
+
static void test_migrate(void)
{
TestServer *s = test_server_new("src");
TestServer *dest = test_server_new("dest");
const char *uri = "tcp:127.0.0.1:1234";
QTestState *global = global_qtest, *from, *to;
+ GSource *source;
gchar *cmd;
QDict *rsp;
guint8 *log;
@@ -534,6 +563,12 @@ static void test_migrate(void)
to = qtest_init(cmd);
g_free(cmd);
+ source = g_source_new(&test_migrate_source_funcs,
+ sizeof(TestMigrateSource));
+ ((TestMigrateSource *)source)->src = s;
+ ((TestMigrateSource *)source)->dest = dest;
+ g_source_attach(source, NULL);
+
/* slow down migration to have time to fiddle with log */
/* TODO: qtest could learn to break on some places */
rsp = qmp("{ 'execute': 'migrate_set_speed',"
@@ -572,6 +607,9 @@ static void test_migrate(void)
read_guest_mem(dest);
+ g_source_destroy(source);
+ g_source_unref(source);
+
qtest_quit(to);
test_server_free(dest);
qtest_quit(from);
--
2.4.3
- [Qemu-devel] [PATCH v6 09/24] vhost-user: add vhost_user_requires_shm_log(), (continued)
- [Qemu-devel] [PATCH v6 09/24] vhost-user: add vhost_user_requires_shm_log(), marcandre . lureau, 2015/10/08
- [Qemu-devel] [PATCH v6 11/24] vhost-user: send log shm fd along with log_base, marcandre . lureau, 2015/10/08
- [Qemu-devel] [PATCH v6 14/24] vhost-user: document migration log, marcandre . lureau, 2015/10/08
- [Qemu-devel] [PATCH v6 15/24] net: add trace_vhost_user_event, marcandre . lureau, 2015/10/08
- [Qemu-devel] [PATCH v6 13/24] vhost: use a function for each call, marcandre . lureau, 2015/10/08
- [Qemu-devel] [PATCH v6 06/24] memfd: add fallback for memfd, marcandre . lureau, 2015/10/08
- [Qemu-devel] [PATCH v6 16/24] vhost user: add support of live migration, marcandre . lureau, 2015/10/08
- [Qemu-devel] [PATCH v6 23/24] vhost-user-test: check ownership during migration,
marcandre . lureau <=
- [Qemu-devel] [PATCH v6 22/24] vhost-user-test: add live-migration test, marcandre . lureau, 2015/10/08
- [Qemu-devel] [PATCH v6 24/24] vhost-user: use an enum helper for features mask, marcandre . lureau, 2015/10/08
- [Qemu-devel] [PATCH v6 01/24] vhost-user: unit test for new messages, marcandre . lureau, 2015/10/08
- [Qemu-devel] [PATCH v6 04/24] util: add linux-only memfd fallback, marcandre . lureau, 2015/10/08
- [Qemu-devel] [PATCH v6 07/24] vhost: document log resizing, marcandre . lureau, 2015/10/08
- [Qemu-devel] [PATCH v6 12/24] vhost-user: add a migration blocker, marcandre . lureau, 2015/10/08
- [Qemu-devel] [PATCH v6 03/24] linux-headers: add unistd.h, marcandre . lureau, 2015/10/08
- [Qemu-devel] [PATCH v6 17/24] vhost user: add rarp sending after live migration for legacy guest, marcandre . lureau, 2015/10/08