Add new qmp commands to suppurt Xen COLO
v10 cover Add new qmp commands to suppurt Xen COLO
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
a0ddc0b359375b2418213966dfbdbfab593ecc6ftools/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(+)
Signature · 1 line
2.7.4
PATCH v10 1/2 Add a new qmp command to start/stop replication
We can call this qmp command to start/stop replication outside of qemu. Like Xen colo need this function.
--- migration/colo.c | 26 ++++++++++++++++++++++++++ qapi-schema.json | 25 +++++++++++++++++++++++++ 2 files changed, 51 insertions(+)
migration/colo.c +26 -0
@@ -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) {
qapi-schema.json +25 -0
@@ -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
Signature · 1 line
2.7.4
PATCH v10 2/2 Add a new qmp command to do checkpoint, query xen replication status
In reply to Zhang ChenWe can call this qmp command to do checkpoint outside of qemu. Xen colo will need this function.
--- migration/colo.c | 23 +++++++++++++++++++++++ qapi-schema.json | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 71 insertions(+)
migration/colo.c +23 -0
@@ -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) {
qapi-schema.json +48 -0
54 lines not on this page · raw message
Signature · 1 line
2.7.4
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?
Quoted 29 lines · Zhang Chen
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
a0ddc0b359375b2418213966dfbdbfab593ecc6ftools/libxl: introduction oflibxl__qmp_restoreto load qemu stateV10:
- 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 statusmigration/colo.c | 49 +++++++++++++++++++++++++++++++++++++ qapi-schema.json | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 122 insertions(+)Signature · 1 line
2.7.4
Quoted 2 lines · Stefano Stabellini
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).
Signature · 2 lines
Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
Quoted 6 lines · Eric Blake
Quoted 2 lines · Stefano Stabellini
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
MAINTAINERSsuggests the pull request should go through COLO Framework (zhanghailiang) or maybe Xen (you).
I am fine either way. zhanghailiang?
Quoted 10 lines · Stefano Stabellini
Quoted 6 lines · Eric Blake
Quoted 2 lines · Stefano Stabellini
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
MAINTAINERSsuggests 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.
Quoted 2 lines
.