qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Juan Quintela <quintela@redhat.com>
To: qemu-devel@nongnu.org
Cc: Alexander Graf <agraf@suse.de>
Subject: [Qemu-devel] [PULL 10/11] migration: Allow to suppress vmdesc submission
Date: Mon, 16 Mar 2015 14:41:11 +0100	[thread overview]
Message-ID: <1426513272-20070-11-git-send-email-quintela@redhat.com> (raw)
In-Reply-To: <1426513272-20070-1-git-send-email-quintela@redhat.com>

From: Alexander Graf <agraf@suse.de>

We now always send a JSON blob describing the migration file format as part
of the migration stream. However, some tools built around QEMU have proven
to stumble over this.

This patch gives the user the chance to disable said self-describing part of
the migration stream. To disable vmdesc submission, just add

  -machine suppress-vmdesc=on

to your QEMU command line.

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 hw/core/machine.c   | 20 ++++++++++++++++++++
 include/hw/boards.h |  1 +
 qemu-options.hx     |  3 ++-
 savevm.c            | 14 +++++++++++---
 4 files changed, 34 insertions(+), 4 deletions(-)

diff --git a/hw/core/machine.c b/hw/core/machine.c
index e3a3e2a..cb1185a 100644
--- a/hw/core/machine.c
+++ b/hw/core/machine.c
@@ -254,6 +254,20 @@ static void machine_set_iommu(Object *obj, bool value, Error **errp)
     ms->iommu = value;
 }

+static void machine_set_suppress_vmdesc(Object *obj, bool value, Error **errp)
+{
+    MachineState *ms = MACHINE(obj);
+
+    ms->suppress_vmdesc = value;
+}
+
+static bool machine_get_suppress_vmdesc(Object *obj, Error **errp)
+{
+    MachineState *ms = MACHINE(obj);
+
+    return ms->suppress_vmdesc;
+}
+
 static int error_on_sysbus_device(SysBusDevice *sbdev, void *opaque)
 {
     error_report("Option '-device %s' cannot be handled by this machine",
@@ -377,6 +391,12 @@ static void machine_initfn(Object *obj)
     object_property_set_description(obj, "iommu",
                                     "Set on/off to enable/disable Intel IOMMU (VT-d)",
                                     NULL);
+    object_property_add_bool(obj, "suppress-vmdesc",
+                             machine_get_suppress_vmdesc,
+                             machine_set_suppress_vmdesc, NULL);
+    object_property_set_description(obj, "suppress-vmdesc",
+                                    "Set on to disable self-describing 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 f44d6f5..1feea2b 100644
--- a/include/hw/boards.h
+++ b/include/hw/boards.h
@@ -143,6 +143,7 @@ struct MachineState {
     bool usb;
     char *firmware;
     bool iommu;
+    bool suppress_vmdesc;

     ram_addr_t ram_size;
     ram_addr_t maxram_size;
diff --git a/qemu-options.hx b/qemu-options.hx
index ad07dde..c513352 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -39,7 +39,8 @@ DEF("machine", HAS_ARG, QEMU_OPTION_machine, \
     "                mem-merge=on|off controls memory merge support (default: on)\n"
     "                iommu=on|off controls emulated Intel IOMMU (VT-d) support (default=off)\n"
     "                aes-key-wrap=on|off controls support for AES key wrapping (default=on)\n"
-    "                dea-key-wrap=on|off controls support for DEA key wrapping (default=on)\n",
+    "                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",
     QEMU_ARCH_ALL)
 STEXI
 @item -machine [type=]@var{name}[,prop=@var{value}[,...]]
diff --git a/savevm.c b/savevm.c
index 54510e9..e7d97ee 100644
--- a/savevm.c
+++ b/savevm.c
@@ -710,6 +710,12 @@ int qemu_savevm_state_iterate(QEMUFile *f)
     return ret;
 }

+static bool should_send_vmdesc(void)
+{
+    MachineState *machine = MACHINE(qdev_get_machine());
+    return !machine->suppress_vmdesc;
+}
+
 void qemu_savevm_state_complete(QEMUFile *f)
 {
     QJSON *vmdesc;
@@ -782,9 +788,11 @@ void qemu_savevm_state_complete(QEMUFile *f)
     qjson_finish(vmdesc);
     vmdesc_len = strlen(qjson_get_str(vmdesc));

-    qemu_put_byte(f, QEMU_VM_VMDESCRIPTION);
-    qemu_put_be32(f, vmdesc_len);
-    qemu_put_buffer(f, (uint8_t *)qjson_get_str(vmdesc), vmdesc_len);
+    if (should_send_vmdesc()) {
+        qemu_put_byte(f, QEMU_VM_VMDESCRIPTION);
+        qemu_put_be32(f, vmdesc_len);
+        qemu_put_buffer(f, (uint8_t *)qjson_get_str(vmdesc), vmdesc_len);
+    }
     object_unref(OBJECT(vmdesc));

     qemu_fflush(f);
-- 
2.1.0

  parent reply	other threads:[~2015-03-16 13:41 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-16 13:41 [Qemu-devel] [PULL 00/11] Migration pull request Juan Quintela
2015-03-16 13:41 ` [Qemu-devel] [PULL 01/11] Add -incoming defer Juan Quintela
2015-03-16 13:41 ` [Qemu-devel] [PULL 02/11] Add migrate_incoming Juan Quintela
2015-03-16 14:35   ` Eric Blake
2015-03-16 13:41 ` [Qemu-devel] [PULL 03/11] ram: make all save_page functions take a uint64_t parameter Juan Quintela
2015-03-16 13:41 ` [Qemu-devel] [PULL 04/11] ram_find_and_save_block: change calling convention Juan Quintela
2015-03-16 13:41 ` [Qemu-devel] [PULL 05/11] ram_save_page: change calling covention Juan Quintela
2015-03-16 13:41 ` [Qemu-devel] [PULL 06/11] save_xbzrle_page: change calling convention Juan Quintela
2015-03-16 13:41 ` [Qemu-devel] [PULL 07/11] save_block_hdr: we can recalculate the cont parameter here Juan Quintela
2015-03-17  3:13   ` Li, Liang Z
2015-03-17 12:00     ` Juan Quintela
2015-03-16 13:41 ` [Qemu-devel] [PULL 08/11] rename save_block_hdr to save_page_header Juan Quintela
2015-03-16 13:41 ` [Qemu-devel] [PULL 09/11] migration: Read JSON VM description on incoming migration Juan Quintela
2015-03-16 13:41 ` Juan Quintela [this message]
2015-03-16 13:41 ` [Qemu-devel] [PULL 11/11] pc: Disable vmdesc submission for old machines Juan Quintela
2015-03-16 15:55 ` [Qemu-devel] [PULL 00/11] Migration pull request Markus Armbruster
2015-03-16 16:20   ` Juan Quintela
2015-03-16 17:22 ` Peter Maydell

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=1426513272-20070-11-git-send-email-quintela@redhat.com \
    --to=quintela@redhat.com \
    --cc=agraf@suse.de \
    --cc=qemu-devel@nongnu.org \
    /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).