[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 09/14] migration: merge enforce_config_section somewh
From: |
Juan Quintela |
Subject: |
[Qemu-devel] [PULL 09/14] migration: merge enforce_config_section somewhat |
Date: |
Wed, 28 Jun 2017 13:31:01 +0200 |
From: Peter Xu <address@hidden>
These two parameters:
- MachineState::enforce_config_section
- MigrationState::send_configuration
are playing similar role here. This patch merges the first one into
second, then we'll have a single place to reference whether we need to
send the configuration section.
I didn't remove the MachineState.enforce_config_section field since when
applying that machine property (in machine_set_property()) we haven't
yet initialized global properties and migration object. Then, it's
still not easy to pass that boolean to MigrationState at such an early
time.
A natural benefit for current patch is that now we kept the meaning of
"enforce-config-section" since it'll still have the highest
priority (that's what "enforce" mean I guess).
Reviewed-by: Juan Quintela <address@hidden>
Signed-off-by: Peter Xu <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Juan Quintela <address@hidden>
---
migration/migration.c | 12 ++++++++++++
migration/savevm.c | 12 ++----------
2 files changed, 14 insertions(+), 10 deletions(-)
diff --git a/migration/migration.c b/migration/migration.c
index 96c6412..e7e6cf3 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -42,6 +42,7 @@
#include "exec/target_page.h"
#include "io/channel-buffer.h"
#include "migration/colo.h"
+#include "hw/boards.h"
#define MAX_THROTTLE (32 << 20) /* Migration transfer speed throttling */
@@ -102,9 +103,20 @@ static MigrationState *current_migration;
void migration_object_init(void)
{
+ MachineState *ms = MACHINE(qdev_get_machine());
+
/* This can only be called once. */
assert(!current_migration);
current_migration = MIGRATION_OBJ(object_new(TYPE_MIGRATION));
+
+ /*
+ * We cannot really do this in migration_instance_init() since at
+ * that time global properties are not yet applied, then this
+ * value will be definitely replaced by something else.
+ */
+ if (ms->enforce_config_section) {
+ current_migration->send_configuration = true;
+ }
}
/* For outgoing */
diff --git a/migration/savevm.c b/migration/savevm.c
index 7b39fb9..be3f885 100644
--- a/migration/savevm.c
+++ b/migration/savevm.c
@@ -943,20 +943,13 @@ bool qemu_savevm_state_blocked(Error **errp)
return false;
}
-static bool enforce_config_section(void)
-{
- MachineState *machine = MACHINE(qdev_get_machine());
- return machine->enforce_config_section;
-}
-
void qemu_savevm_state_header(QEMUFile *f)
{
trace_savevm_state_header();
qemu_put_be32(f, QEMU_VM_FILE_MAGIC);
qemu_put_be32(f, QEMU_VM_FILE_VERSION);
- if (migrate_get_current()->send_configuration ||
- enforce_config_section()) {
+ if (migrate_get_current()->send_configuration) {
qemu_put_byte(f, QEMU_VM_CONFIGURATION);
vmstate_save_state(f, &vmstate_configuration, &savevm_state, 0);
}
@@ -1980,8 +1973,7 @@ int qemu_loadvm_state(QEMUFile *f)
return -ENOTSUP;
}
- if (migrate_get_current()->send_configuration ||
- enforce_config_section()) {
+ if (migrate_get_current()->send_configuration) {
if (qemu_get_byte(f) != QEMU_VM_CONFIGURATION) {
error_report("Configuration section missing");
return -EINVAL;
--
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 <=
- [Qemu-devel] [PULL 06/14] migration: move only_migratable to MigrationState, Juan Quintela, 2017/06/28
- [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