block/replication: Clarify 'top-id' parameter usage
authorChanglong Xie <xiecl.fnst@cn.fujitsu.com>
Wed, 12 Oct 2016 04:50:08 +0000 (12:50 +0800)
committerMax Reitz <mreitz@redhat.com>
Mon, 24 Oct 2016 15:56:07 +0000 (17:56 +0200)
The replication driver only supports the 'top-id' parameter for the
secondary side; it must not be supplied for the primary side.

Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Changlong Xie <xiecl.fnst@cn.fujitsu.com>
Message-id: 1476247808-15646-1-git-send-email-xiecl.fnst@cn.fujitsu.com
Signed-off-by: Max Reitz <mreitz@redhat.com>
block/replication.c
qapi/block-core.json

index 3bd1cf1809d2d6f97bf7ba011f972c2620da0e4f..8bbfc8f870978070fe8f4d43f304199f616fe0a8 100644 (file)
@@ -101,6 +101,11 @@ static int replication_open(BlockDriverState *bs, QDict *options,
 
     if (!strcmp(mode, "primary")) {
         s->mode = REPLICATION_MODE_PRIMARY;
+        top_id = qemu_opt_get(opts, REPLICATION_TOP_ID);
+        if (top_id) {
+            error_setg(&local_err, "The primary side does not support option top-id");
+            goto fail;
+        }
     } else if (!strcmp(mode, "secondary")) {
         s->mode = REPLICATION_MODE_SECONDARY;
         top_id = qemu_opt_get(opts, REPLICATION_TOP_ID);
index c59047bc9414dd367bb163169242b9e5a633e490..97b120532a224d99d4a5b1e2e90b338bc6b8e148 100644 (file)
 # @mode: the replication mode
 #
 # @top-id: #optional In secondary mode, node name or device ID of the root
-#          node who owns the replication node chain. Ignored in primary mode.
+#          node who owns the replication node chain. Must not be given in
+#          primary mode.
 #
 # Since: 2.8
 ##