RunState: Add additional states

Currently, only vm_start() and vm_stop() change the VM state.
That's, the state is only changed when starting or stopping the VM.

This commit adds the runstate_set() function, which makes it possible
to also do state transitions when the VM is stopped or running.

Additional states are also added and the current state is stored.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
This commit is contained in:
Luiz Capitulino 2011-07-29 15:04:45 -03:00
parent 1dfb4dd993
commit f5bbfba1eb
4 changed files with 35 additions and 2 deletions

View file

@ -72,8 +72,11 @@ void process_incoming_migration(QEMUFile *f)
incoming_expected = false;
if (autostart)
if (autostart) {
vm_start();
} else {
runstate_set(RSTATE_PRE_LAUNCH);
}
}
int do_migrate(Monitor *mon, const QDict *qdict, QObject **ret_data)
@ -390,6 +393,9 @@ void migrate_fd_put_ready(void *opaque)
}
state = MIG_STATE_ERROR;
}
if (state == MIG_STATE_COMPLETED) {
runstate_set(RSTATE_POST_MIGRATE);
}
s->state = state;
notifier_list_notify(&migration_state_notifiers, NULL);
}