Skip to content

Commit

Permalink
block/replication: Clarify 'top-id' parameter usage
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Changlong Xie authored and XanClic committed Oct 24, 2016
1 parent 6d3f404 commit f4f2539
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions block/replication.c
Expand Up @@ -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);
Expand Down
3 changes: 2 additions & 1 deletion qapi/block-core.json
Expand Up @@ -2197,7 +2197,8 @@
# @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
##
Expand Down

0 comments on commit f4f2539

Please sign in to comment.