From 4ffdb337e74f9a4dae97ea0396d4e1a3dbb13723 Mon Sep 17 00:00:00 2001 From: Peter Xu Date: Tue, 27 Jun 2017 12:10:18 +0800 Subject: migration: merge enforce_config_section somewhat 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 Signed-off-by: Peter Xu Message-Id: <1498536619-14548-10-git-send-email-peterx@redhat.com> Signed-off-by: Juan Quintela --- migration/savevm.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) (limited to 'migration/savevm.c') 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; -- cgit v1.1