diff mbox

[v11,01/27] tools/libxl: introduction of libxl__qmp_restore to load qemu state

Message ID 1457080891-26054-2-git-send-email-xiecl.fnst@cn.fujitsu.com (mailing list archive)
State New, archived
Headers show

Commit Message

Changlong Xie March 4, 2016, 8:41 a.m. UTC
From: Wen Congyang <wency@cn.fujitsu.com>

In normal migration, the qemu state is passed to qemu as a parameter.
With COLO, secondary vm is running. So we will do the following steps
at every checkpoint:
1. suspend both primary vm and secondary vm
2. sync the state
3. resume both primary vm and secondary vm
Primary will send qemu's state in step2, and secondary's qemu should
read it and restore the state before it is resumed. We can not pass the
state to qemu as a parameter because secondary QEMU is already started
at this point, so we introduce libxl__qmp_restore() to do it.

Signed-off-by: Yang Hongyang <hongyang.yang@easystack.cn>
Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
Signed-off-by: Changlong Xie <xiecl.fnst@cn.fujitsu.com>
Cc: Anthony Perard <anthony.perard@citrix.com>
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
---
 tools/libxl/libxl_internal.h |  2 ++
 tools/libxl/libxl_qmp.c      | 10 ++++++++++
 2 files changed, 12 insertions(+)

Comments

Ian Jackson March 4, 2016, 4:30 p.m. UTC | #1
Changlong Xie writes ("[PATCH v11 01/27] tools/libxl: introduction of libxl__qmp_restore to load qemu state"):
> From: Wen Congyang <wency@cn.fujitsu.com>
> 
> In normal migration, the qemu state is passed to qemu as a parameter.
> With COLO, secondary vm is running. So we will do the following steps
> at every checkpoint:
> 1. suspend both primary vm and secondary vm
> 2. sync the state
> 3. resume both primary vm and secondary vm
> Primary will send qemu's state in step2, and secondary's qemu should
> read it and restore the state before it is resumed. We can not pass the
> state to qemu as a parameter because secondary QEMU is already started
> at this point, so we introduce libxl__qmp_restore() to do it.

We should accept both the Xen part and the Qemu part, or neither.  So
I think this proposal needs (in the Xen commit message) a reference to
the Qemu upstream commit, or Qemu upstream patches, so that we can see
that they've got the appropriate Qemu upstream acks.

But, subject to that, from a Xen point of view this approach looks
good to me.

Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>

Ian.
Changlong Xie March 14, 2016, 9:03 a.m. UTC | #2
On 03/05/2016 12:30 AM, Ian Jackson wrote:
> Changlong Xie writes ("[PATCH v11 01/27] tools/libxl: introduction of libxl__qmp_restore to load qemu state"):
>> From: Wen Congyang <wency@cn.fujitsu.com>
>>
>> In normal migration, the qemu state is passed to qemu as a parameter.
>> With COLO, secondary vm is running. So we will do the following steps
>> at every checkpoint:
>> 1. suspend both primary vm and secondary vm
>> 2. sync the state
>> 3. resume both primary vm and secondary vm
>> Primary will send qemu's state in step2, and secondary's qemu should
>> read it and restore the state before it is resumed. We can not pass the
>> state to qemu as a parameter because secondary QEMU is already started
>> at this point, so we introduce libxl__qmp_restore() to do it.
>
> We should accept both the Xen part and the Qemu part, or neither.  So
> I think this proposal needs (in the Xen commit message) a reference to
> the Qemu upstream commit, or Qemu upstream patches, so that we can see
> that they've got the appropriate Qemu upstream acks.
>
> But, subject to that, from a Xen point of view this approach looks
> good to me.
>
> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
>
Hi Ian

We now push this qemu relevant patch in
http://lists.nongnu.org/archive/html/qemu-devel/2016-03/msg02955.html

Will update the commit messege when it's merged.


Thanks
	-Xie
> Ian.
>
>
> .
>
diff mbox

Patch

diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h
index 005fe53..7801385 100644
--- a/tools/libxl/libxl_internal.h
+++ b/tools/libxl/libxl_internal.h
@@ -1762,6 +1762,8 @@  _hidden int libxl__qmp_stop(libxl__gc *gc, int domid);
 _hidden int libxl__qmp_resume(libxl__gc *gc, int domid);
 /* Save current QEMU state into fd. */
 _hidden int libxl__qmp_save(libxl__gc *gc, int domid, const char *filename);
+/* Load current QEMU state from file. */
+_hidden int libxl__qmp_restore(libxl__gc *gc, int domid, const char *filename);
 /* Set dirty bitmap logging status */
 _hidden int libxl__qmp_set_global_dirty_log(libxl__gc *gc, int domid, bool enable);
 _hidden int libxl__qmp_insert_cdrom(libxl__gc *gc, int domid, const libxl_device_disk *disk);
diff --git a/tools/libxl/libxl_qmp.c b/tools/libxl/libxl_qmp.c
index c45702e..c0bdfcb 100644
--- a/tools/libxl/libxl_qmp.c
+++ b/tools/libxl/libxl_qmp.c
@@ -906,6 +906,16 @@  int libxl__qmp_save(libxl__gc *gc, int domid, const char *filename)
                            NULL, NULL);
 }
 
+int libxl__qmp_restore(libxl__gc *gc, int domid, const char *state_file)
+{
+    libxl__json_object *args = NULL;
+
+    qmp_parameters_add_string(gc, &args, "filename", state_file);
+
+    return qmp_run_command(gc, domid, "xen-load-devices-state", args,
+                           NULL, NULL);
+}
+
 static int qmp_change(libxl__gc *gc, libxl__qmp_handler *qmp,
                       char *device, char *target, char *arg)
 {