}
static void wait_for_migration_status(QTestState *who,
- const char *goal)
+ const char *goal,
+ const char **ungoals)
{
while (true) {
bool completed;
char *status;
+ const char **ungoal;
status = migrate_query_status(who);
completed = strcmp(status, goal) == 0;
- g_assert_cmpstr(status, !=, "failed");
+ for (ungoal = ungoals; *ungoal; ungoal++) {
+ g_assert_cmpstr(status, !=, *ungoal);
+ }
g_free(status);
if (completed) {
return;
static void wait_for_migration_complete(QTestState *who)
{
- wait_for_migration_status(who, "completed");
+ wait_for_migration_status(who, "completed",
+ (const char * []) { "failed", NULL });
}
static void wait_for_migration_pass(QTestState *who)
* Wait until postcopy is really started; we can only run the
* migrate-pause command during a postcopy
*/
- wait_for_migration_status(from, "postcopy-active");
+ wait_for_migration_status(from, "postcopy-active",
+ (const char * []) { "failed",
+ "completed", NULL });
/*
* Manually stop the postcopy migration. This emulates a network
* migrate-recover command can only succeed if destination machine
* is in the paused state
*/
- wait_for_migration_status(to, "postcopy-paused");
+ wait_for_migration_status(to, "postcopy-paused",
+ (const char * []) { "failed", "active",
+ "completed", NULL });
/*
* Create a new socket to emulate a new channel that is different
* Try to rebuild the migration channel using the resume flag and
* the newly created channel
*/
- wait_for_migration_status(from, "postcopy-paused");
+ wait_for_migration_status(from, "postcopy-paused",
+ (const char * []) { "failed", "active",
+ "completed", NULL });
migrate(from, uri, "{'resume': true}");
g_free(uri);