qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH V8 1/2] Add a new qmp command to start/stop repl


From: Zhang Chen
Subject: Re: [Qemu-devel] [PATCH V8 1/2] Add a new qmp command to start/stop replication
Date: Fri, 24 Feb 2017 11:56:33 +0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1



On 02/23/2017 11:31 PM, Eric Blake wrote:
On 02/23/2017 01:14 AM, Zhang Chen wrote:
We can call this qmp command to start/stop replication outside of qemu.
Like Xen colo need this function.

Signed-off-by: Zhang Chen <address@hidden>
Signed-off-by: Wen Congyang <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Reviewed-by: Stefano Stabellini <address@hidden>
Reviewed-by: zhanghailiang <address@hidden>

---
@@ -104,6 +106,27 @@ 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 {
+        replication_stop_all(failover, failover ? NULL : errp);
Technically, this is use of failover without first checking
has_failover; it would be safer if you inserted:

if (!has_failover) {
     failover = NULL;
}

OK, I will insert this code in next version.

Thanks
Zhang Chen

earlier in the function to be safe against any callers that don't go
through the QAPI-generated code.  Fortunately, our QAPI generated code
guarantees that failover is NULL when has_failover is false, so my R-b
can stand as-is if there is no other reason for a respin.

--
Thanks
Zhang Chen






reply via email to

[Prev in Thread] Current Thread [Next in Thread]