@ -541,6 +541,7 @@ void migrate_end(QTestState *from, QTestState *to, bool test_dest)
static int migrate_postcopy_prepare ( QTestState * * from_ptr ,
static int migrate_postcopy_prepare ( QTestState * * from_ptr ,
QTestState * * to_ptr ,
QTestState * * to_ptr ,
void * * hook_data ,
MigrateCommon * args )
MigrateCommon * args )
{
{
QTestState * from , * to ;
QTestState * from , * to ;
@ -554,7 +555,7 @@ static int migrate_postcopy_prepare(QTestState **from_ptr,
}
}
if ( args - > start_hook ) {
if ( args - > start_hook ) {
args - > postcopy _data = args - > start_hook ( from , to ) ;
* hook _data = args - > start_hook ( from , to ) ;
}
}
migrate_ensure_non_converge ( from ) ;
migrate_ensure_non_converge ( from ) ;
@ -582,7 +583,7 @@ static int migrate_postcopy_prepare(QTestState **from_ptr,
}
}
static void migrate_postcopy_complete ( QTestState * from , QTestState * to ,
static void migrate_postcopy_complete ( QTestState * from , QTestState * to ,
MigrateCommon * args )
void * hook_data , MigrateCommon * args )
{
{
MigrationTestEnv * env = migration_get_env ( ) ;
MigrationTestEnv * env = migration_get_env ( ) ;
@ -601,8 +602,7 @@ static void migrate_postcopy_complete(QTestState *from, QTestState *to,
}
}
if ( args - > end_hook ) {
if ( args - > end_hook ) {
args - > end_hook ( from , to , args - > postcopy_data ) ;
args - > end_hook ( from , to , hook_data ) ;
args - > postcopy_data = NULL ;
}
}
migrate_end ( from , to , true ) ;
migrate_end ( from , to , true ) ;
@ -610,13 +610,14 @@ static void migrate_postcopy_complete(QTestState *from, QTestState *to,
void test_postcopy_common ( MigrateCommon * args )
void test_postcopy_common ( MigrateCommon * args )
{
{
void * hook_data = NULL ;
QTestState * from , * to ;
QTestState * from , * to ;
if ( migrate_postcopy_prepare ( & from , & to , args ) ) {
if ( migrate_postcopy_prepare ( & from , & to , & hook_data , args ) ) {
return ;
return ;
}
}
migrate_postcopy_start ( from , to , & src_state ) ;
migrate_postcopy_start ( from , to , & src_state ) ;
migrate_postcopy_complete ( from , to , args ) ;
migrate_postcopy_complete ( from , to , hook_data , args ) ;
}
}
static void wait_for_postcopy_status ( QTestState * one , const char * status )
static void wait_for_postcopy_status ( QTestState * one , const char * status )
@ -742,6 +743,7 @@ void test_postcopy_recovery_common(MigrateCommon *args)
{
{
QTestState * from , * to ;
QTestState * from , * to ;
g_autofree char * uri = NULL ;
g_autofree char * uri = NULL ;
void * hook_data = NULL ;
/*
/*
* Always enable OOB QMP capability for recovery tests , migrate - recover is
* Always enable OOB QMP capability for recovery tests , migrate - recover is
@ -752,7 +754,7 @@ void test_postcopy_recovery_common(MigrateCommon *args)
/* Always hide errors for postcopy recover tests since they're expected */
/* Always hide errors for postcopy recover tests since they're expected */
args - > start . hide_stderr = true ;
args - > start . hide_stderr = true ;
if ( migrate_postcopy_prepare ( & from , & to , args ) ) {
if ( migrate_postcopy_prepare ( & from , & to , & hook_data , args ) ) {
return ;
return ;
}
}
@ -808,7 +810,7 @@ void test_postcopy_recovery_common(MigrateCommon *args)
/* Restore the postcopy bandwidth to unlimited */
/* Restore the postcopy bandwidth to unlimited */
migrate_set_parameter_int ( from , " max-postcopy-bandwidth " , 0 ) ;
migrate_set_parameter_int ( from , " max-postcopy-bandwidth " , 0 ) ;
migrate_postcopy_complete ( from , to , args ) ;
migrate_postcopy_complete ( from , to , hook_data , args ) ;
}
}
int test_precopy_common ( MigrateCommon * args )
int test_precopy_common ( MigrateCommon * args )