Subject: [PATCH 10/11] replication: Make --disable-replication compile again

From: Markus Armbruster <[email-masked]>
Date: Fri, 5 May 2017 08:46:53 +0200

RH-Author: Markus Armbruster <[email-masked]>
Message-id: <[email-masked]>
Patchwork-id: 75021
O-Subject: [RHV-7.4 qemu-kvm-rhev PATCH 1/2] replication: Make --disable-replication compile again
Bugzilla: 1422846
RH-Acked-by: Dr. David Alan Gilbert <[email-masked]>
RH-Acked-by: Miroslav Rezanina <[email-masked]>
RH-Acked-by: Thomas Huth <[email-masked]>

Broken in commit daa33c5.

Cc: [email-masked]
Signed-off-by: Markus Armbruster <[email-masked]>
Reviewed-by: Eric Blake <[email-masked]>
Reviewed-by: Zhang Chen <[email-masked]>
Message-id: [email-masked]
Signed-off-by: Stefan Hajnoczi <[email-masked]>
(cherry picked from commit 38bb54f323bf7c83496b6a044cfd28896e997a00)
Signed-off-by: Miroslav Rezanina <[email-masked]>
---
 migration/colo.c | 12 ++++++++++++
 monitor.c        |  5 +++++
 2 files changed, 17 insertions(+)

diff --git a/migration/colo.c b/migration/colo.c
index c19eb3f..963c802 100644
--- a/migration/colo.c
+++ b/migration/colo.c
@@ -153,6 +153,7 @@ 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;
@@ -171,10 +172,14 @@ 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);
 
@@ -189,11 +194,18 @@ 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
 }
 
 static void colo_send_message(QEMUFile *f, COLOMessage msg,
diff --git a/monitor.c b/monitor.c
index 896d669..d4fbc07 100644
--- a/monitor.c
+++ b/monitor.c
@@ -974,6 +974,11 @@ static void qmp_unregister_commands_hack(void)
 #ifndef CONFIG_SPICE
     qmp_unregister_command(&qmp_commands, "query-spice");
 #endif
+#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
-- 
1.8.3.1