All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH V10 0/2] Add new qmp commands to suppurt Xen COLO
@ 2017-02-25  2:46 Zhang Chen
  2017-02-25  2:46 ` [Qemu-devel] [PATCH V10 1/2] Add a new qmp command to start/stop replication Zhang Chen
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Zhang Chen @ 2017-02-25  2:46 UTC (permalink / raw)
  To: qemu devel, Eric Blake, zhanghailiang, Markus Armbruster,
	Stefano Stabellini
  Cc: Jason Wang, Zhang Chen, Li Zhijian, eddie . dong, bian naimeng

Xen COLO depend on qemu COLO replication function.
So, We need new qmp commands for Xen to use qemu replication.

Corresponding libxl patches already in xen.git.
Commit ID:

ed37ef1f91c20f0ab162ce60f8c38400b917fa64
COLO: introduce new API to prepare/start/do/get_error/stop replication

a0ddc0b359375b2418213966dfbdbfab593ecc6f
tools/libxl: introduction of libxl__qmp_restore to load qemu state

V10:
   - Fix ReplicationStatus error comments.
   - Fix query-xen-replication-status example.

Zhang Chen (2):
  Add a new qmp command to start/stop replication
  Add a new qmp command to do checkpoint, query xen replication status

 migration/colo.c | 49 +++++++++++++++++++++++++++++++++++++
 qapi-schema.json | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 122 insertions(+)

-- 
2.7.4

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Qemu-devel] [PATCH V10 1/2] Add a new qmp command to start/stop replication
  2017-02-25  2:46 [Qemu-devel] [PATCH V10 0/2] Add new qmp commands to suppurt Xen COLO Zhang Chen
@ 2017-02-25  2:46 ` Zhang Chen
  2017-02-25  2:46 ` [Qemu-devel] [PATCH V10 2/2] Add a new qmp command to do checkpoint, query xen replication status Zhang Chen
  2017-02-27 22:31 ` [Qemu-devel] [PATCH V10 0/2] Add new qmp commands to suppurt Xen COLO Stefano Stabellini
  2 siblings, 0 replies; 7+ messages in thread
From: Zhang Chen @ 2017-02-25  2:46 UTC (permalink / raw)
  To: qemu devel, Eric Blake, zhanghailiang, Markus Armbruster,
	Stefano Stabellini
  Cc: Jason Wang, Zhang Chen, Li Zhijian, eddie . dong, bian naimeng,
	Wen Congyang

We can call this qmp command to start/stop replication outside of qemu.
Like Xen colo need this function.

Signed-off-by: Zhang Chen <zhangchen.fnst@cn.fujitsu.com>
Signed-off-by: Wen Congyang <wencongyang@gmail.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
Reviewed-by: zhanghailiang <zhang.zhanghailiang@huawei.com>

---
 migration/colo.c | 26 ++++++++++++++++++++++++++
 qapi-schema.json | 25 +++++++++++++++++++++++++
 2 files changed, 51 insertions(+)

diff --git a/migration/colo.c b/migration/colo.c
index 93c85c5..0114899 100644
--- a/migration/colo.c
+++ b/migration/colo.c
@@ -19,6 +19,8 @@
 #include "qemu/error-report.h"
 #include "qapi/error.h"
 #include "migration/failover.h"
+#include "replication.h"
+#include "qmp-commands.h"
 
 #define COLO_BUFFER_BASE_SIZE (4 * 1024 * 1024)
 
@@ -104,6 +106,30 @@ void colo_do_failover(MigrationState *s)
     }
 }
 
+void qmp_xen_set_replication(bool enable, bool primary,
+                             bool has_failover, bool failover,
+                             Error **errp)
+{
+    ReplicationMode mode = primary ?
+                           REPLICATION_MODE_PRIMARY :
+                           REPLICATION_MODE_SECONDARY;
+
+    if (has_failover && enable) {
+        error_setg(errp, "Parameter 'failover' is only for"
+                   " stopping replication");
+        return;
+    }
+
+    if (enable) {
+        replication_start_all(mode, errp);
+    } else {
+        if (!has_failover) {
+            failover = NULL;
+        }
+        replication_stop_all(failover, failover ? NULL : errp);
+    }
+}
+
 static void colo_send_message(QEMUFile *f, COLOMessage msg,
                               Error **errp)
 {
diff --git a/qapi-schema.json b/qapi-schema.json
index cbdffdd..9445b93 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -5906,6 +5906,31 @@
 { 'command': 'xen-load-devices-state', 'data': {'filename': 'str'} }
 
 ##
+# @xen-set-replication:
+#
+# Enable or disable replication.
+#
+# @enable: true to enable, false to disable.
+#
+# @primary: true for primary or false for secondary.
+#
+# @failover: #optional true to do failover, false to stop. but cannot be
+#            specified if 'enable' is true. default value is false.
+#
+# Returns: nothing.
+#
+# Example:
+#
+# -> { "execute": "xen-set-replication",
+#      "arguments": {"enable": true, "primary": false} }
+# <- { "return": {} }
+#
+# Since: 2.9
+##
+{ 'command': 'xen-set-replication',
+  'data': { 'enable': 'bool', 'primary': 'bool', '*failover' : 'bool' } }
+
+##
 # @GICCapability:
 #
 # The struct describes capability for a specific GIC (Generic
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [Qemu-devel] [PATCH V10 2/2] Add a new qmp command to do checkpoint, query xen replication status
  2017-02-25  2:46 [Qemu-devel] [PATCH V10 0/2] Add new qmp commands to suppurt Xen COLO Zhang Chen
  2017-02-25  2:46 ` [Qemu-devel] [PATCH V10 1/2] Add a new qmp command to start/stop replication Zhang Chen
@ 2017-02-25  2:46 ` Zhang Chen
  2017-02-27 22:31 ` [Qemu-devel] [PATCH V10 0/2] Add new qmp commands to suppurt Xen COLO Stefano Stabellini
  2 siblings, 0 replies; 7+ messages in thread
From: Zhang Chen @ 2017-02-25  2:46 UTC (permalink / raw)
  To: qemu devel, Eric Blake, zhanghailiang, Markus Armbruster,
	Stefano Stabellini
  Cc: Jason Wang, Zhang Chen, Li Zhijian, eddie . dong, bian naimeng,
	Wen Congyang

We can call this qmp command to do checkpoint outside of qemu.
Xen colo will need this function.

Signed-off-by: Zhang Chen <zhangchen.fnst@cn.fujitsu.com>
Signed-off-by: Wen Congyang <wencongyang@gmail.com>
Reviewed-by: Eric Blake <eblake@redhat.com>

---
 migration/colo.c | 23 +++++++++++++++++++++++
 qapi-schema.json | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 71 insertions(+)

diff --git a/migration/colo.c b/migration/colo.c
index 0114899..2b241b4 100644
--- a/migration/colo.c
+++ b/migration/colo.c
@@ -130,6 +130,29 @@ void qmp_xen_set_replication(bool enable, bool primary,
     }
 }
 
+ReplicationStatus *qmp_query_xen_replication_status(Error **errp)
+{
+    Error *err = NULL;
+    ReplicationStatus *s = g_new0(ReplicationStatus, 1);
+
+    replication_get_error_all(&err);
+    if (err) {
+        s->error = true;
+        s->has_desc = true;
+        s->desc = g_strdup(error_get_pretty(err));
+    } else {
+        s->error = false;
+    }
+
+    error_free(err);
+    return s;
+}
+
+void qmp_xen_colo_do_checkpoint(Error **errp)
+{
+    replication_do_checkpoint_all(errp);
+}
+
 static void colo_send_message(QEMUFile *f, COLOMessage msg,
                               Error **errp)
 {
diff --git a/qapi-schema.json b/qapi-schema.json
index 9445b93..5aa74e6 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -5931,6 +5931,54 @@
   'data': { 'enable': 'bool', 'primary': 'bool', '*failover' : 'bool' } }
 
 ##
+# @ReplicationStatus:
+#
+# The result format for 'query-xen-replication-status'.
+#
+# @error: true if an error happened, false if replication is normal.
+#
+# @desc: #optional the human readable error description string, when
+#        @error is 'true'.
+#
+# Since: 2.9
+##
+{ 'struct': 'ReplicationStatus',
+  'data': { 'error': 'bool', '*desc': 'str' } }
+
+##
+# @query-xen-replication-status:
+#
+# Query replication status while the vm is running.
+#
+# Returns: A @ReplicationResult object showing the status.
+#
+# Example:
+#
+# -> { "execute": "query-xen-replication-status" }
+# <- { "return": { "error": false } }
+#
+# Since: 2.9
+##
+{ 'command': 'query-xen-replication-status',
+  'returns': 'ReplicationStatus' }
+
+##
+# @xen-colo-do-checkpoint:
+#
+# Xen uses this command to notify replication to trigger a checkpoint.
+#
+# Returns: nothing.
+#
+# Example:
+#
+# -> { "execute": "xen-colo-do-checkpoint" }
+# <- { "return": {} }
+#
+# Since: 2.9
+##
+{ 'command': 'xen-colo-do-checkpoint' }
+
+##
 # @GICCapability:
 #
 # The struct describes capability for a specific GIC (Generic
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [PATCH V10 0/2] Add new qmp commands to suppurt Xen COLO
  2017-02-25  2:46 [Qemu-devel] [PATCH V10 0/2] Add new qmp commands to suppurt Xen COLO Zhang Chen
  2017-02-25  2:46 ` [Qemu-devel] [PATCH V10 1/2] Add a new qmp command to start/stop replication Zhang Chen
  2017-02-25  2:46 ` [Qemu-devel] [PATCH V10 2/2] Add a new qmp command to do checkpoint, query xen replication status Zhang Chen
@ 2017-02-27 22:31 ` Stefano Stabellini
  2017-02-27 22:44   ` Eric Blake
  2 siblings, 1 reply; 7+ messages in thread
From: Stefano Stabellini @ 2017-02-27 22:31 UTC (permalink / raw)
  To: Zhang Chen
  Cc: qemu devel, Eric Blake, zhanghailiang, Markus Armbruster,
	Stefano Stabellini, Jason Wang, Li Zhijian, eddie . dong,
	bian naimeng

Eric, are you OK with this series going upstream? If so, do you want me
to send the pull request for it or are you going to handle it?

On Sat, 25 Feb 2017, Zhang Chen wrote:
> Xen COLO depend on qemu COLO replication function.
> So, We need new qmp commands for Xen to use qemu replication.
> 
> Corresponding libxl patches already in xen.git.
> Commit ID:
> 
> ed37ef1f91c20f0ab162ce60f8c38400b917fa64
> COLO: introduce new API to prepare/start/do/get_error/stop replication
> 
> a0ddc0b359375b2418213966dfbdbfab593ecc6f
> tools/libxl: introduction of libxl__qmp_restore to load qemu state
> 
> V10:
>    - Fix ReplicationStatus error comments.
>    - Fix query-xen-replication-status example.
> 
> Zhang Chen (2):
>   Add a new qmp command to start/stop replication
>   Add a new qmp command to do checkpoint, query xen replication status
> 
>  migration/colo.c | 49 +++++++++++++++++++++++++++++++++++++
>  qapi-schema.json | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 122 insertions(+)
> 
> -- 
> 2.7.4
> 
> 
> 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [PATCH V10 0/2] Add new qmp commands to suppurt Xen COLO
  2017-02-27 22:31 ` [Qemu-devel] [PATCH V10 0/2] Add new qmp commands to suppurt Xen COLO Stefano Stabellini
@ 2017-02-27 22:44   ` Eric Blake
  2017-02-27 22:52     ` Stefano Stabellini
  0 siblings, 1 reply; 7+ messages in thread
From: Eric Blake @ 2017-02-27 22:44 UTC (permalink / raw)
  To: Stefano Stabellini, Zhang Chen
  Cc: qemu devel, zhanghailiang, Markus Armbruster, Jason Wang,
	Li Zhijian, eddie . dong, bian naimeng

[-- Attachment #1: Type: text/plain, Size: 446 bytes --]

On 02/27/2017 04:31 PM, Stefano Stabellini wrote:
> Eric, are you OK with this series going upstream? If so, do you want me
> to send the pull request for it or are you going to handle it?

Both patches have my R-b, but MAINTAINERS suggests the pull request
should go through COLO Framework (zhanghailiang) or maybe Xen (you).


-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [PATCH V10 0/2] Add new qmp commands to suppurt Xen COLO
  2017-02-27 22:44   ` Eric Blake
@ 2017-02-27 22:52     ` Stefano Stabellini
  2017-02-28  1:17       ` Hailiang Zhang
  0 siblings, 1 reply; 7+ messages in thread
From: Stefano Stabellini @ 2017-02-27 22:52 UTC (permalink / raw)
  To: Eric Blake
  Cc: Stefano Stabellini, Zhang Chen, qemu devel, zhanghailiang,
	Markus Armbruster, Jason Wang, Li Zhijian, eddie . dong,
	bian naimeng

On Mon, 27 Feb 2017, Eric Blake wrote:
> On 02/27/2017 04:31 PM, Stefano Stabellini wrote:
> > Eric, are you OK with this series going upstream? If so, do you want me
> > to send the pull request for it or are you going to handle it?
> 
> Both patches have my R-b, but MAINTAINERS suggests the pull request
> should go through COLO Framework (zhanghailiang) or maybe Xen (you).

I am fine either way. zhanghailiang? 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [PATCH V10 0/2] Add new qmp commands to suppurt Xen COLO
  2017-02-27 22:52     ` Stefano Stabellini
@ 2017-02-28  1:17       ` Hailiang Zhang
  0 siblings, 0 replies; 7+ messages in thread
From: Hailiang Zhang @ 2017-02-28  1:17 UTC (permalink / raw)
  To: Stefano Stabellini, Eric Blake
  Cc: xuquan8, Zhang Chen, qemu devel, Markus Armbruster, Jason Wang,
	Li Zhijian, eddie . dong, bian naimeng

On 2017/2/28 6:52, Stefano Stabellini wrote:
> On Mon, 27 Feb 2017, Eric Blake wrote:
>> On 02/27/2017 04:31 PM, Stefano Stabellini wrote:
>>> Eric, are you OK with this series going upstream? If so, do you want me
>>> to send the pull request for it or are you going to handle it?
>>
>> Both patches have my R-b, but MAINTAINERS suggests the pull request
>> should go through COLO Framework (zhanghailiang) or maybe Xen (you).
>
> I am fine either way. zhanghailiang?
>

Yes, I'm fine if you could give a pull request for this series.

Thanks.

> .
>

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2017-02-28  1:16 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-25  2:46 [Qemu-devel] [PATCH V10 0/2] Add new qmp commands to suppurt Xen COLO Zhang Chen
2017-02-25  2:46 ` [Qemu-devel] [PATCH V10 1/2] Add a new qmp command to start/stop replication Zhang Chen
2017-02-25  2:46 ` [Qemu-devel] [PATCH V10 2/2] Add a new qmp command to do checkpoint, query xen replication status Zhang Chen
2017-02-27 22:31 ` [Qemu-devel] [PATCH V10 0/2] Add new qmp commands to suppurt Xen COLO Stefano Stabellini
2017-02-27 22:44   ` Eric Blake
2017-02-27 22:52     ` Stefano Stabellini
2017-02-28  1:17       ` Hailiang Zhang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.