aboutsummaryrefslogtreecommitdiff
path: root/migration
diff options
context:
space:
mode:
authorPeter Xu <peterx@redhat.com>2017-06-27 12:10:15 +0800
committerJuan Quintela <quintela@redhat.com>2017-06-28 11:18:38 +0200
commit3df663e575f1876d7f3bc684f80e72fca0703d39 (patch)
treeeb60fd3480e91e3b24ac5ad298fec10a3a992e96 /migration
parent5272298c48eb3a01c41a7822e6303d0a0a05f004 (diff)
downloadqemu-3df663e575f1876d7f3bc684f80e72fca0703d39.zip
qemu-3df663e575f1876d7f3bc684f80e72fca0703d39.tar.gz
qemu-3df663e575f1876d7f3bc684f80e72fca0703d39.tar.bz2
migration: move only_migratable to MigrationState
One less global variable, and it does only matter with migration. We keep the old "--only-migratable" option, but also now we support: -global migration.only-migratable=true Currently still keep the old interface. Hmm, now vl.c has no way to access migrate_get_current(). Export a function for it to setup only_migratable. Reviewed-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Peter Xu <peterx@redhat.com> Message-Id: <1498536619-14548-7-git-send-email-peterx@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
Diffstat (limited to 'migration')
-rw-r--r--migration/migration.c8
-rw-r--r--migration/migration.h3
-rw-r--r--migration/savevm.c2
3 files changed, 11 insertions, 2 deletions
diff --git a/migration/migration.c b/migration/migration.c
index 221b22c..67f9e68 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -115,6 +115,11 @@ MigrationState *migrate_get_current(void)
return current_migration;
}
+void migration_only_migratable_set(void)
+{
+ migrate_get_current()->only_migratable = true;
+}
+
MigrationIncomingState *migration_incoming_get_current(void)
{
static bool once;
@@ -986,7 +991,7 @@ static GSList *migration_blockers;
int migrate_add_blocker(Error *reason, Error **errp)
{
- if (only_migratable) {
+ if (migrate_get_current()->only_migratable) {
error_propagate(errp, error_copy(reason));
error_prepend(errp, "disallowing migration blocker "
"(--only_migratable) for: ");
@@ -1979,6 +1984,7 @@ void migrate_fd_connect(MigrationState *s)
static Property migration_properties[] = {
DEFINE_PROP_BOOL("store-global-state", MigrationState,
store_global_state, true),
+ DEFINE_PROP_BOOL("only-migratable", MigrationState, only_migratable, false),
DEFINE_PROP_END_OF_LIST(),
};
diff --git a/migration/migration.h b/migration/migration.h
index 4b898e9..34377dd 100644
--- a/migration/migration.h
+++ b/migration/migration.h
@@ -139,6 +139,9 @@ struct MigrationState
* during migration.
*/
bool store_global_state;
+
+ /* Whether the VM is only allowing for migratable devices */
+ bool only_migratable;
};
void migrate_set_state(int *state, int old_state, int new_state);
diff --git a/migration/savevm.c b/migration/savevm.c
index c7a49c9..1499cd3 100644
--- a/migration/savevm.c
+++ b/migration/savevm.c
@@ -2336,7 +2336,7 @@ void vmstate_register_ram_global(MemoryRegion *mr)
bool vmstate_check_only_migratable(const VMStateDescription *vmsd)
{
/* check needed if --only-migratable is specified */
- if (!only_migratable) {
+ if (!migrate_get_current()->only_migratable) {
return true;
}