[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 06/14] migration: move only_migratable to MigrationSt
From: |
Juan Quintela |
Subject: |
[Qemu-devel] [PULL 06/14] migration: move only_migratable to MigrationState |
Date: |
Wed, 28 Jun 2017 13:30:58 +0200 |
From: Peter Xu <address@hidden>
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 <address@hidden>
Signed-off-by: Peter Xu <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Juan Quintela <address@hidden>
---
include/migration/misc.h | 2 ++
include/sysemu/sysemu.h | 1 -
migration/migration.c | 8 +++++++-
migration/migration.h | 3 +++
migration/savevm.c | 2 +-
vl.c | 9 +++++++--
6 files changed, 20 insertions(+), 5 deletions(-)
diff --git a/include/migration/misc.h b/include/migration/misc.h
index 2d36cf5..6ac3307 100644
--- a/include/migration/misc.h
+++ b/include/migration/misc.h
@@ -55,4 +55,6 @@ bool migration_has_finished(MigrationState *);
bool migration_has_failed(MigrationState *);
/* ...and after the device transmission */
bool migration_in_postcopy_after_devices(MigrationState *);
+void migration_only_migratable_set(void);
+
#endif
diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h
index 9841a52..b213696 100644
--- a/include/sysemu/sysemu.h
+++ b/include/sysemu/sysemu.h
@@ -15,7 +15,6 @@
/* vl.c */
extern const char *bios_name;
-extern int only_migratable;
extern const char *qemu_name;
extern QemuUUID qemu_uuid;
extern bool qemu_uuid_set;
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;
}
diff --git a/vl.c b/vl.c
index f0a0515..36ff3f4 100644
--- a/vl.c
+++ b/vl.c
@@ -188,7 +188,6 @@ bool boot_strict;
uint8_t *boot_splash_filedata;
size_t boot_splash_filedata_size;
uint8_t qemu_extra_params_fw[2];
-int only_migratable; /* turn it off unless user states otherwise */
int icount_align_option;
@@ -3953,7 +3952,13 @@ int main(int argc, char **argv, char **envp)
incoming = optarg;
break;
case QEMU_OPTION_only_migratable:
- only_migratable = 1;
+ /*
+ * TODO: we can remove this option one day, and we
+ * should all use:
+ *
+ * "-global migration.only-migratable=true"
+ */
+ migration_only_migratable_set();
break;
case QEMU_OPTION_nodefaults:
has_defaults = 0;
--
2.9.4
- [Qemu-devel] [PULL 00/14] Migration pull request for 20170628, Juan Quintela, 2017/06/28
- [Qemu-devel] [PULL 01/14] machine: export register_compat_prop(), Juan Quintela, 2017/06/28
- [Qemu-devel] [PULL 03/14] vl: clean up global property registration, Juan Quintela, 2017/06/28
- [Qemu-devel] [PULL 02/14] accel: introduce AccelClass.global_props, Juan Quintela, 2017/06/28
- [Qemu-devel] [PULL 04/14] migration: let MigrationState be a qdev, Juan Quintela, 2017/06/28
- [Qemu-devel] [PULL 07/14] migration: move skip_configuration out, Juan Quintela, 2017/06/28
- [Qemu-devel] [PULL 05/14] migration: move global_state.optional out, Juan Quintela, 2017/06/28
- [Qemu-devel] [PULL 08/14] migration: move skip_section_footers, Juan Quintela, 2017/06/28
- [Qemu-devel] [PULL 09/14] migration: merge enforce_config_section somewhat, Juan Quintela, 2017/06/28
- [Qemu-devel] [PULL 06/14] migration: move only_migratable to MigrationState,
Juan Quintela <=
- [Qemu-devel] [PULL 11/14] migration: add comment for TYPE_MIGRATE, Juan Quintela, 2017/06/28
- [Qemu-devel] [PULL 10/14] migration: hmp: dump globals, Juan Quintela, 2017/06/28
- [Qemu-devel] [PULL 13/14] migration: add "return-path" capability, Juan Quintela, 2017/06/28
- [Qemu-devel] [PULL 14/14] exec: fix access to ram_list.dirty_memory when sync dirty bitmap, Juan Quintela, 2017/06/28
- [Qemu-devel] [PULL 12/14] vmstate: error hint for failed equal checks, Juan Quintela, 2017/06/28
- Re: [Qemu-devel] [PULL 00/14] Migration pull request for 20170628, Peter Maydell, 2017/06/29