mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 23:33:54 -06:00
Create MigrationIncomingState
There are currently lots of pieces of incoming migration state scattered around, and postcopy is adding more, and it seems better to try and keep it together. allocate MIS in process_incoming_migration_co Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Reviewed-by: Amit Shah <amit.shah@redhat.com> Reviewed-by: David Gibson <david@gibson.dropbear.id.au> Reviewed-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
This commit is contained in:
parent
e3807054e2
commit
bca7856ae8
4 changed files with 40 additions and 0 deletions
|
@ -53,6 +53,7 @@ static bool deferred_incoming;
|
|||
migrations at once. For now we don't need to add
|
||||
dynamic creation of migration */
|
||||
|
||||
/* For outgoing */
|
||||
MigrationState *migrate_get_current(void)
|
||||
{
|
||||
static MigrationState current_migration = {
|
||||
|
@ -71,6 +72,28 @@ MigrationState *migrate_get_current(void)
|
|||
return ¤t_migration;
|
||||
}
|
||||
|
||||
/* For incoming */
|
||||
static MigrationIncomingState *mis_current;
|
||||
|
||||
MigrationIncomingState *migration_incoming_get_current(void)
|
||||
{
|
||||
return mis_current;
|
||||
}
|
||||
|
||||
MigrationIncomingState *migration_incoming_state_new(QEMUFile* f)
|
||||
{
|
||||
mis_current = g_malloc0(sizeof(MigrationIncomingState));
|
||||
mis_current->file = f;
|
||||
|
||||
return mis_current;
|
||||
}
|
||||
|
||||
void migration_incoming_state_destroy(void)
|
||||
{
|
||||
g_free(mis_current);
|
||||
mis_current = NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Called on -incoming with a defer: uri.
|
||||
* The migration can be started later after any parameters have been
|
||||
|
@ -115,9 +138,14 @@ static void process_incoming_migration_co(void *opaque)
|
|||
Error *local_err = NULL;
|
||||
int ret;
|
||||
|
||||
migration_incoming_state_new(f);
|
||||
|
||||
ret = qemu_loadvm_state(f);
|
||||
|
||||
qemu_fclose(f);
|
||||
free_xbzrle_decoded_buf();
|
||||
migration_incoming_state_destroy();
|
||||
|
||||
if (ret < 0) {
|
||||
error_report("load of migration failed: %s", strerror(-ret));
|
||||
migrate_decompress_threads_join();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue