From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46391) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aW4cw-0005qI-2L for qemu-devel@nongnu.org; Wed, 17 Feb 2016 11:06:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aW4cr-00031F-1B for qemu-devel@nongnu.org; Wed, 17 Feb 2016 11:06:54 -0500 Received: from e06smtp09.uk.ibm.com ([195.75.94.105]:44968) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aW4cq-000316-Os for qemu-devel@nongnu.org; Wed, 17 Feb 2016 11:06:48 -0500 Received: from localhost by e06smtp09.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 17 Feb 2016 16:06:47 -0000 From: Greg Kurz Date: Wed, 17 Feb 2016 17:06:43 +0100 Message-ID: <20160217160628.840.96784.stgit@bahia.huguette.org> In-Reply-To: <20160217160344.840.69108.stgit@bahia.huguette.org> References: <20160217160344.840.69108.stgit@bahia.huguette.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] [PATCH v2 3/3] migration: allow to suppress configuration section submission List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Juan Quintela Cc: Laurent Vivier , qemu-devel@nongnu.org, "Dr. David Alan Gilbert" , qemu-ppc@nongnu.org, Amit Shah , David Gibson Since the addition of the configuration section in QEMU 2.4, it is impossible to migrate a pseries-2.3 machine back to QEMU 2.3. This patch makes it possible thanks to a new machine property which allows to disable configuration section submission. To disable submission, just add: -machine suppress-config-section=on Alternatively, if the target QEMU version isn't known at startup, this can be done later from the QEMU monitor with: qom-set /machine suppress-config-section on This property won't be automatically set for pseries-2.3 because it would then break backward migration to QEMU 2.4. If automatic behaviour is needed, it is up to the tooling to handle this. Signed-off-by: Greg Kurz --- hw/core/machine.c | 21 +++++++++++++++++++++ include/hw/boards.h | 1 + migration/savevm.c | 8 +++++++- qemu-options.hx | 3 ++- 4 files changed, 31 insertions(+), 2 deletions(-) diff --git a/hw/core/machine.c b/hw/core/machine.c index 7203dd260bf2..ad4ecdc65787 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -327,6 +327,21 @@ static bool machine_get_require_config_section(Object *obj, Error **errp) return ms->require_config_section; } +static void machine_set_suppress_config_section(Object *obj, bool value, + Error **errp) +{ + MachineState *ms = MACHINE(obj); + + ms->suppress_config_section = value; +} + +static bool machine_get_suppress_config_section(Object *obj, Error **errp) +{ + MachineState *ms = MACHINE(obj); + + return ms->suppress_config_section; +} + static int error_on_sysbus_device(SysBusDevice *sbdev, void *opaque) { error_report("Option '-device %s' cannot be handled by this machine", @@ -489,6 +504,12 @@ static void machine_initfn(Object *obj) object_property_set_description(obj, "require-config-section", "Set on/off to reject/accept migration without configuration section", NULL); + object_property_add_bool(obj, "suppress-config-section", + machine_get_suppress_config_section, + machine_set_suppress_config_section, NULL); + object_property_set_description(obj, "suppress-config-section", + "Set on/off to enable/disable configuration section migration", + NULL); /* Register notifier when init is done for sysbus sanity checks */ ms->sysbus_notifier.notify = machine_init_notify; diff --git a/include/hw/boards.h b/include/hw/boards.h index d6ff1ba4c260..35aaa6493458 100644 --- a/include/hw/boards.h +++ b/include/hw/boards.h @@ -129,6 +129,7 @@ struct MachineState { bool iommu; bool suppress_vmdesc; bool require_config_section; + bool suppress_config_section; ram_addr_t ram_size; ram_addr_t maxram_size; diff --git a/migration/savevm.c b/migration/savevm.c index f8dee03a3350..3fd07efeb38b 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -878,13 +878,19 @@ bool qemu_savevm_state_blocked(Error **errp) return false; } +static bool should_send_configuration(void) +{ + MachineState *machine = MACHINE(qdev_get_machine()); + return !machine->suppress_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 (!savevm_state.skip_configuration) { + if (!savevm_state.skip_configuration && should_send_configuration()) { qemu_put_byte(f, QEMU_VM_CONFIGURATION); vmstate_save_state(f, &vmstate_configuration, &savevm_state, 0); } diff --git a/qemu-options.hx b/qemu-options.hx index 172471c75b1c..af08fa8ec314 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -44,7 +44,8 @@ DEF("machine", HAS_ARG, QEMU_OPTION_machine, \ " dea-key-wrap=on|off controls support for DEA key wrapping (default=on)\n" " suppress-vmdesc=on|off disables self-describing migration (default=off)\n" " nvdimm=on|off controls NVDIMM support (default=off)\n" - " require-config-section=on|off incoming migration requires configuration section (default=on)\n", + " require-config-section=on|off incoming migration requires configuration section (default=on)\n" + " suppress-config-section=on|off disables configuration section migration (default=off)\n", QEMU_ARCH_ALL) STEXI @item -machine [type=]@var{name}[,prop=@var{value}[,...]]