From: "Dr. David Alan Gilbert (git)" <dgilbert@redhat.com>
To: qemu-devel@nongnu.org, peterx@redhat.com, quintela@redhat.com
Subject: [Qemu-devel] [PULL 13/15] tests: add postcopy recovery test
Date: Tue, 10 Jul 2018 16:30:14 +0100 [thread overview]
Message-ID: <20180710153016.131258-14-dgilbert@redhat.com> (raw)
In-Reply-To: <20180710153016.131258-1-dgilbert@redhat.com>
From: Peter Xu <peterx@redhat.com>
Test the postcopy recovery procedure by emulating a network failure
using migrate-pause command.
Tested-by: Balamuruhan S <bala24@linux.vnet.ibm.com>
Signed-off-by: Peter Xu <peterx@redhat.com>
Message-Id: <20180710091902.28780-10-peterx@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
---
tests/migration-test.c | 80 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 80 insertions(+)
diff --git a/tests/migration-test.c b/tests/migration-test.c
index 4c15071893..d8b2633fce 100644
--- a/tests/migration-test.c
+++ b/tests/migration-test.c
@@ -352,6 +352,29 @@ static void migrate_set_parameter(QTestState *who, const char *parameter,
migrate_check_parameter(who, parameter, value);
}
+static void migrate_pause(QTestState *who)
+{
+ QDict *rsp;
+
+ rsp = wait_command(who, "{ 'execute': 'migrate-pause' }");
+ g_assert(qdict_haskey(rsp, "return"));
+ qobject_unref(rsp);
+}
+
+static void migrate_recover(QTestState *who, const char *uri)
+{
+ QDict *rsp;
+ gchar *cmd = g_strdup_printf(
+ "{ 'execute': 'migrate-recover', "
+ " 'id': 'recover-cmd', "
+ " 'arguments': { 'uri': '%s' } }", uri);
+
+ rsp = wait_command(who, cmd);
+ g_assert(qdict_haskey(rsp, "return"));
+ g_free(cmd);
+ qobject_unref(rsp);
+}
+
static void migrate_set_capability(QTestState *who, const char *capability,
const char *value)
{
@@ -608,6 +631,62 @@ static void test_postcopy(void)
migrate_postcopy_complete(from, to);
}
+static void test_postcopy_recovery(void)
+{
+ QTestState *from, *to;
+ char *uri;
+
+ if (migrate_postcopy_prepare(&from, &to)) {
+ return;
+ }
+
+ /* Turn postcopy speed down, 4K/s is slow enough on any machines */
+ migrate_set_parameter(from, "max-postcopy-bandwidth", "4096");
+
+ /* Now we start the postcopy */
+ migrate_postcopy_start(from, to);
+
+ /*
+ * Wait until postcopy is really started; we can only run the
+ * migrate-pause command during a postcopy
+ */
+ wait_for_migration_status(from, "postcopy-active");
+
+ /*
+ * Manually stop the postcopy migration. This emulates a network
+ * failure with the migration socket
+ */
+ migrate_pause(from);
+
+ /*
+ * Wait for destination side to reach postcopy-paused state. The
+ * migrate-recover command can only succeed if destination machine
+ * is in the paused state
+ */
+ wait_for_migration_status(to, "postcopy-paused");
+
+ /*
+ * Create a new socket to emulate a new channel that is different
+ * from the broken migration channel; tell the destination to
+ * listen to the new port
+ */
+ uri = g_strdup_printf("unix:%s/migsocket-recover", tmpfs);
+ migrate_recover(to, uri);
+
+ /*
+ * Try to rebuild the migration channel using the resume flag and
+ * the newly created channel
+ */
+ wait_for_migration_status(from, "postcopy-paused");
+ migrate(from, uri, ", 'resume': true");
+ g_free(uri);
+
+ /* Restore the postcopy bandwidth to unlimited */
+ migrate_set_parameter(from, "max-postcopy-bandwidth", "0");
+
+ migrate_postcopy_complete(from, to);
+}
+
static void test_baddest(void)
{
QTestState *from, *to;
@@ -698,6 +777,7 @@ int main(int argc, char **argv)
module_call_init(MODULE_INIT_QOM);
qtest_add_func("/migration/postcopy/unix", test_postcopy);
+ qtest_add_func("/migration/postcopy/recovery", test_postcopy_recovery);
qtest_add_func("/migration/deprecated", test_deprecated);
qtest_add_func("/migration/bad_dest", test_baddest);
qtest_add_func("/migration/precopy/unix", test_precopy_unix);
--
2.17.1
next prev parent reply other threads:[~2018-07-10 15:30 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-10 15:30 [Qemu-devel] [PULL 00/15] migration queue Dr. David Alan Gilbert (git)
2018-07-10 15:30 ` [Qemu-devel] [PULL 01/15] migration: delay postcopy paused state Dr. David Alan Gilbert (git)
2018-07-10 15:30 ` [Qemu-devel] [PULL 02/15] migration: move income process out of multifd Dr. David Alan Gilbert (git)
2018-07-10 15:30 ` [Qemu-devel] [PULL 03/15] migration: unbreak postcopy recovery Dr. David Alan Gilbert (git)
2018-07-10 15:30 ` [Qemu-devel] [PULL 04/15] migration: unify incoming processing Dr. David Alan Gilbert (git)
2018-07-10 15:30 ` [Qemu-devel] [PULL 05/15] migration: simplify check to use qemu file buffer Dr. David Alan Gilbert (git)
2018-07-10 15:30 ` [Qemu-devel] [PULL 06/15] migration: loosen recovery check when load vm Dr. David Alan Gilbert (git)
2018-07-10 15:30 ` [Qemu-devel] [PULL 07/15] migration: fix incorrect bitmap size calculation Dr. David Alan Gilbert (git)
2018-07-10 15:30 ` [Qemu-devel] [PULL 08/15] migration: show pause/recover state on dst host Dr. David Alan Gilbert (git)
2018-07-10 15:30 ` [Qemu-devel] [PULL 09/15] tests: introduce migrate_postcopy_* helpers Dr. David Alan Gilbert (git)
2018-07-10 15:30 ` [Qemu-devel] [PULL 10/15] tests: allow migrate() to take extra flags Dr. David Alan Gilbert (git)
2018-07-10 15:30 ` [Qemu-devel] [PULL 11/15] tests: introduce migrate_query*() helpers Dr. David Alan Gilbert (git)
2018-07-10 15:30 ` [Qemu-devel] [PULL 12/15] tests: introduce wait_for_migration_status() Dr. David Alan Gilbert (git)
2018-07-10 15:30 ` Dr. David Alan Gilbert (git) [this message]
2018-07-10 15:30 ` [Qemu-devel] [PULL 14/15] tests: hide stderr for postcopy recovery test Dr. David Alan Gilbert (git)
2018-07-10 15:30 ` [Qemu-devel] [PULL 15/15] migration: reorder MIG_CMD_POSTCOPY_RESUME Dr. David Alan Gilbert (git)
2018-07-10 16:28 ` [Qemu-devel] [PULL 00/15] migration queue Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180710153016.131258-14-dgilbert@redhat.com \
--to=dgilbert@redhat.com \
--cc=peterx@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).