[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 18/26] qapi: add conditions to REPLICATION type/comm
From: |
Marc-André Lureau |
Subject: |
[Qemu-devel] [PATCH 18/26] qapi: add conditions to REPLICATION type/commands on the schema |
Date: |
Thu, 27 Jul 2017 17:41:18 +0200 |
Add #if defined(CONFIG_REPLICATION) in generated code, and adjust the
code accordingly.
Signed-off-by: Marc-André Lureau <address@hidden>
---
qapi-schema.json | 12 ++++++++----
migration/colo.c | 14 ++------------
monitor.c | 5 -----
3 files changed, 10 insertions(+), 21 deletions(-)
diff --git a/qapi-schema.json b/qapi-schema.json
index bcee3157b0..2f4528c769 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -6337,7 +6337,8 @@
# Since: 2.9
##
{ 'command': 'xen-set-replication',
- 'data': { 'enable': 'bool', 'primary': 'bool', '*failover' : 'bool' } }
+ 'data': { 'enable': 'bool', 'primary': 'bool', '*failover' : 'bool' },
+ 'if': 'defined(CONFIG_REPLICATION)' }
##
# @ReplicationStatus:
@@ -6352,7 +6353,8 @@
# Since: 2.9
##
{ 'struct': 'ReplicationStatus',
- 'data': { 'error': 'bool', '*desc': 'str' } }
+ 'data': { 'error': 'bool', '*desc': 'str' },
+ 'if': 'defined(CONFIG_REPLICATION)' }
##
# @query-xen-replication-status:
@@ -6369,7 +6371,8 @@
# Since: 2.9
##
{ 'command': 'query-xen-replication-status',
- 'returns': 'ReplicationStatus' }
+ 'returns': 'ReplicationStatus',
+ 'if': 'defined(CONFIG_REPLICATION)' }
##
# @xen-colo-do-checkpoint:
@@ -6385,7 +6388,8 @@
#
# Since: 2.9
##
-{ 'command': 'xen-colo-do-checkpoint' }
+{ 'command': 'xen-colo-do-checkpoint',
+ 'if': 'defined(CONFIG_REPLICATION)' }
##
# @GICCapability:
diff --git a/migration/colo.c b/migration/colo.c
index a4255432ac..3bff9fc9a4 100644
--- a/migration/colo.c
+++ b/migration/colo.c
@@ -147,11 +147,11 @@ void colo_do_failover(MigrationState *s)
}
}
+#ifdef CONFIG_REPLICATION
void qmp_xen_set_replication(bool enable, bool primary,
bool has_failover, bool failover,
Error **errp)
{
-#ifdef CONFIG_REPLICATION
ReplicationMode mode = primary ?
REPLICATION_MODE_PRIMARY :
REPLICATION_MODE_SECONDARY;
@@ -170,14 +170,10 @@ void qmp_xen_set_replication(bool enable, bool primary,
}
replication_stop_all(failover, failover ? NULL : errp);
}
-#else
- abort();
-#endif
}
ReplicationStatus *qmp_query_xen_replication_status(Error **errp)
{
-#ifdef CONFIG_REPLICATION
Error *err = NULL;
ReplicationStatus *s = g_new0(ReplicationStatus, 1);
@@ -192,19 +188,13 @@ ReplicationStatus *qmp_query_xen_replication_status(Error
**errp)
error_free(err);
return s;
-#else
- abort();
-#endif
}
void qmp_xen_colo_do_checkpoint(Error **errp)
{
-#ifdef CONFIG_REPLICATION
replication_do_checkpoint_all(errp);
-#else
- abort();
-#endif
}
+#endif
static void colo_send_message(QEMUFile *f, COLOMessage msg,
Error **errp)
diff --git a/monitor.c b/monitor.c
index 4bf6a3ea2e..383c84d162 100644
--- a/monitor.c
+++ b/monitor.c
@@ -970,11 +970,6 @@ static void qmp_query_qmp_schema(QDict *qdict, QObject
**ret_data,
*/
static void qmp_unregister_commands_hack(void)
{
-#ifndef CONFIG_REPLICATION
- qmp_unregister_command(&qmp_commands, "xen-set-replication");
- qmp_unregister_command(&qmp_commands, "query-xen-replication-status");
- qmp_unregister_command(&qmp_commands, "xen-colo-do-checkpoint");
-#endif
#ifndef TARGET_I386
qmp_unregister_command(&qmp_commands, "rtc-reset-reinjection");
#endif
--
2.14.0.rc0.1.g40ca67566
- [Qemu-devel] [PATCH 13/26] qapi2texi: add 'If:' condition to enum values, (continued)
- [Qemu-devel] [PATCH 13/26] qapi2texi: add 'If:' condition to enum values, Marc-André Lureau, 2017/07/27
- [Qemu-devel] [PATCH 23/26] qapi: make s390 commands depend on TARGET_S390X, Marc-André Lureau, 2017/07/27
- [Qemu-devel] [PATCH 16/26] qapi: add conditions to VNC type/commands/events on the schema, Marc-André Lureau, 2017/07/27
- [Qemu-devel] [PATCH 08/26] qapi: add 'if' condition on enum member values, Marc-André Lureau, 2017/07/27
- [Qemu-devel] [PATCH 24/26] qapi: make query-gic-capabilities depend on TARGET_ARM, Marc-André Lureau, 2017/07/27
- [Qemu-devel] [PATCH 15/26] qapi2texi: add condition to variants, Marc-André Lureau, 2017/07/27
- [Qemu-devel] [PATCH 12/26] qapi2texi: add 'If:' section to generated documentation, Marc-André Lureau, 2017/07/27
- [Qemu-devel] [PATCH 21/26] build-sys: make qemu qapi objects per-target, Marc-André Lureau, 2017/07/27
- [Qemu-devel] [PATCH 14/26] qapi2texi: add 'If:' condition to struct members, Marc-André Lureau, 2017/07/27
- [Qemu-devel] [PATCH 09/26] qapi: add 'if' condition on struct member, Marc-André Lureau, 2017/07/27
- [Qemu-devel] [PATCH 18/26] qapi: add conditions to REPLICATION type/commands on the schema,
Marc-André Lureau <=
- [Qemu-devel] [PATCH 06/26] qapi2texi: minor python code simplification, Marc-André Lureau, 2017/07/27
- [Qemu-devel] [PATCH 01/26] qapi: fix type_seen key error, Marc-André Lureau, 2017/07/27
- [Qemu-devel] [PATCH 17/26] qapi: add conditions to SPICE type/commands/events on the schema, Marc-André Lureau, 2017/07/27
- [Qemu-devel] [PATCH 10/26] qapi: add 'if' condition on union variant, Marc-André Lureau, 2017/07/27
- [Qemu-devel] [PATCH 11/26] qapi: add 'if' condition on alternate variant, Marc-André Lureau, 2017/07/27
- [Qemu-devel] [PATCH 25/26] qapi: make query-cpu-model-expansion depend on s390 or x86, Marc-André Lureau, 2017/07/27
- [Qemu-devel] [PATCH 26/26] qapi: make query-cpu-definitions depend on specific targets, Marc-André Lureau, 2017/07/27
- [Qemu-devel] [PATCH 07/26] qapi: add 'if' condition on top-level schema elements, Marc-André Lureau, 2017/07/27