From: Greg Kurz <gkurz@linux.vnet.ibm.com>
To: Juan Quintela <quintela@redhat.com>
Cc: Laurent Vivier <lvivier@redhat.com>,
qemu-devel@nongnu.org,
"Dr. David Alan Gilbert" <dgilbert@redhat.com>,
qemu-ppc@nongnu.org, Amit Shah <amit.shah@redhat.com>,
David Gibson <david@gibson.dropbear.id.au>
Subject: [Qemu-devel] [PATCH v2 3/3] migration: allow to suppress configuration section submission
Date: Wed, 17 Feb 2016 17:06:43 +0100 [thread overview]
Message-ID: <20160217160628.840.96784.stgit@bahia.huguette.org> (raw)
In-Reply-To: <20160217160344.840.69108.stgit@bahia.huguette.org>
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 <gkurz@linux.vnet.ibm.com>
---
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}[,...]]
next prev parent reply other threads:[~2016-02-17 16:06 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-17 16:03 [Qemu-devel] [PATCH v2 0/3] Fix migration of old pseries Greg Kurz
2016-02-17 16:05 ` [Qemu-devel] [PATCH v2 1/3] migration: allow configuration section to be optional Greg Kurz
2016-02-17 16:06 ` [Qemu-devel] [PATCH v2 2/3] spapr: fix migration of older pseries Greg Kurz
2016-02-17 16:06 ` Greg Kurz [this message]
2016-02-18 2:50 ` [Qemu-devel] [PATCH v2 3/3] migration: allow to suppress configuration section submission David Gibson
2016-02-18 6:36 ` Amit Shah
2016-02-18 9:24 ` Greg Kurz
2016-02-18 10:25 ` Laurent Vivier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160217160628.840.96784.stgit@bahia.huguette.org \
--to=gkurz@linux.vnet.ibm.com \
--cc=amit.shah@redhat.com \
--cc=david@gibson.dropbear.id.au \
--cc=dgilbert@redhat.com \
--cc=lvivier@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=quintela@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).