qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 6/10] Introduce v3 of savevm protocol


From: Avi Kivity
Subject: Re: [Qemu-devel] [PATCH 6/10] Introduce v3 of savevm protocol
Date: Wed, 10 Sep 2008 10:09:37 +0300
User-agent: Thunderbird 2.0.0.16 (X11/20080723)

iAnthony Liguori wrote:
The current savevm/loadvm protocol has some draw backs.  It does not support
the ability to do progressive saving which means it cannot be used for live
checkpointing or migration.  The sections sizes are 32-bit integers which
means that it will not function when using more than 4GB of memory for a guest.
It attempts to seek within the output file which means it cannot be streamed.
The current protocol also is pretty lax about how it supports forward
compatibility.  If a saved section version is greater than what the restore
code support, the restore code generally treats the saved data as being in
whatever version it supports.  This means that restoring a saved VM on an older
version of QEMU will likely result in silent guest failure.

This patch introduces a new version of the savevm protocol.  It has the
following features:

 * Support for progressive save of sections (for live checkpoint/migration)
 * An asynchronous API for doing save
 * Support for interleaving multiple progressive save sections
   (for future support of memory hot-add/storage migration)
 * Fully streaming format
 * Strong section version checking

Right now, the code is missing to support restoring v2 images.

Signed-off-by: Anthony Liguori <address@hidden>


+int qemu_savevm_state_iterate(QEMUFile *f)
+{
+    SaveStateEntry *se;
+    int ret = 0;
+
+    for (se = first_se; se != NULL; se = se->next) {
+        if (se->save_live_state == NULL)
+            continue;
+
+        /* Section type */
+        qemu_put_byte(f, QEMU_VM_SECTION_PART);
+        qemu_put_be32(f, se->section_id);
+
+        ret |= se->save_live_state(f, QEMU_VM_SECTION_PART, se->opaque);

What if the callback returns an error?

+    }
+
+    if (ret)
+        return 1;
+
+    return 0;
+}
+

An alternative solution that doesn't involve iterating over the saveset over and over again involves providing a queue of uncompleted state saves. If a save handler has more work to be done, it queues a continuation and returns. The queue is primed by _begin(). qemu_savevm_state_iterate() would simply attempt to drain the queue. I don't think it's a significant improvement though.

--
I have a truly marvellous patch that fixes the bug which this
signature is too narrow to contain.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]