diff mbox

[v1,2/2] block/replication: Clarify 'top-id' parameter usage

Message ID 1476164341-8636-3-git-send-email-xiecl.fnst@cn.fujitsu.com (mailing list archive)
State New, archived
Headers show

Commit Message

Changlong Xie Oct. 11, 2016, 5:39 a.m. UTC
Replication driver only support 'top-id' parameter in secondary side,
and it must not be supplied in primary side

Signed-off-by: Changlong Xie <xiecl.fnst@cn.fujitsu.com>
---
 block/replication.c  | 5 +++++
 qapi/block-core.json | 3 ++-
 2 files changed, 7 insertions(+), 1 deletion(-)

Comments

Fam Zheng Oct. 11, 2016, 6:30 a.m. UTC | #1
On Tue, 10/11 13:39, Changlong Xie wrote:
> Replication driver only support 'top-id' parameter in secondary side,
> and it must not be supplied in primary side
> 
> Signed-off-by: Changlong Xie <xiecl.fnst@cn.fujitsu.com>
> ---
>  block/replication.c  | 5 +++++
>  qapi/block-core.json | 3 ++-
>  2 files changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/block/replication.c b/block/replication.c
> index 5b432d9..1e8284b 100644
> --- a/block/replication.c
> +++ b/block/replication.c
> @@ -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 do not support option top-id");

s/do not/does not/

> +            goto fail;
> +        }
>      } else if (!strcmp(mode, "secondary")) {
>          s->mode = REPLICATION_MODE_SECONDARY;
>          top_id = qemu_opt_get(opts, REPLICATION_TOP_ID);
> diff --git a/qapi/block-core.json b/qapi/block-core.json
> index 4badb97..ec92df4 100644
> --- a/qapi/block-core.json
> +++ b/qapi/block-core.json
> @@ -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
>  ##
> -- 
> 1.9.3
> 
> 
> 
>
Changlong Xie Oct. 11, 2016, 10:38 a.m. UTC | #2
On 10/11/2016 02:30 PM, Fam Zheng wrote:
> On Tue, 10/11 13:39, Changlong Xie wrote:
>> Replication driver only support 'top-id' parameter in secondary side,
>> and it must not be supplied in primary side
>>
>> Signed-off-by: Changlong Xie <xiecl.fnst@cn.fujitsu.com>
>> ---
>>   block/replication.c  | 5 +++++
>>   qapi/block-core.json | 3 ++-
>>   2 files changed, 7 insertions(+), 1 deletion(-)
>>
>> diff --git a/block/replication.c b/block/replication.c
>> index 5b432d9..1e8284b 100644
>> --- a/block/replication.c
>> +++ b/block/replication.c
>> @@ -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 do not support option top-id");
>
> s/do not/does not/

Yes, thanks.

>
>> +            goto fail;
>> +        }
>>       } else if (!strcmp(mode, "secondary")) {
>>           s->mode = REPLICATION_MODE_SECONDARY;
>>           top_id = qemu_opt_get(opts, REPLICATION_TOP_ID);
>> diff --git a/qapi/block-core.json b/qapi/block-core.json
>> index 4badb97..ec92df4 100644
>> --- a/qapi/block-core.json
>> +++ b/qapi/block-core.json
>> @@ -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
>>   ##
>> --
>> 1.9.3
>>
>>
>>
>>
>
>
> .
>
diff mbox

Patch

diff --git a/block/replication.c b/block/replication.c
index 5b432d9..1e8284b 100644
--- a/block/replication.c
+++ b/block/replication.c
@@ -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 do 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);
diff --git a/qapi/block-core.json b/qapi/block-core.json
index 4badb97..ec92df4 100644
--- a/qapi/block-core.json
+++ b/qapi/block-core.json
@@ -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
 ##