[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PATCH v2 3/3] migration: allow to suppress configuration sec
From: |
Greg Kurz |
Subject: |
[Qemu-ppc] [PATCH v2 3/3] migration: allow to suppress configuration section submission |
Date: |
Wed, 17 Feb 2016 17:06:43 +0100 |
User-agent: |
StGit/0.17.1-dirty |
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 <address@hidden>
---
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 address@hidden,address@hidden,...]]