[Qemu-devel] [PULL 2/8] replication: clarify permissions

Kevin Wolf posted 8 patches 8 years, 10 months ago
[Qemu-devel] [PULL 2/8] replication: clarify permissions
Posted by Kevin Wolf 8 years, 10 months ago
From: Changlong Xie <xiecl.fnst@cn.fujitsu.com>

Even if hidden_disk, secondary_disk are backing files, they all need
write permissions in replication scenario. Otherwise we will encouter
below exceptions on secondary side during adding nbd server:

{'execute': 'nbd-server-add', 'arguments': {'device': 'colo-disk', 'writable': true } }
{"error": {"class": "GenericError", "desc": "Conflicts with use by hidden-qcow2-driver as 'backing', which does not allow 'write' on sec-qcow2-driver-for-nbd"}}

CC: Zhang Hailiang <zhang.zhanghailiang@huawei.com>
CC: Zhang Chen <zhangchen.fnst@cn.fujitsu.com>
CC: Wen Congyang <wencongyang2@huawei.com>
Signed-off-by: Changlong Xie <xiecl.fnst@cn.fujitsu.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 block/replication.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/block/replication.c b/block/replication.c
index 22f170f..bf3c395 100644
--- a/block/replication.c
+++ b/block/replication.c
@@ -155,6 +155,18 @@ static void replication_close(BlockDriverState *bs)
     replication_remove(s->rs);
 }
 
+static void replication_child_perm(BlockDriverState *bs, BdrvChild *c,
+                                   const BdrvChildRole *role,
+                                   uint64_t perm, uint64_t shared,
+                                   uint64_t *nperm, uint64_t *nshared)
+{
+    *nperm = *nshared = BLK_PERM_CONSISTENT_READ \
+                        | BLK_PERM_WRITE \
+                        | BLK_PERM_WRITE_UNCHANGED;
+
+    return;
+}
+
 static int64_t replication_getlength(BlockDriverState *bs)
 {
     return bdrv_getlength(bs->file->bs);
@@ -660,7 +672,7 @@ BlockDriver bdrv_replication = {
 
     .bdrv_open                  = replication_open,
     .bdrv_close                 = replication_close,
-    .bdrv_child_perm            = bdrv_filter_default_perms,
+    .bdrv_child_perm            = replication_child_perm,
 
     .bdrv_getlength             = replication_getlength,
     .bdrv_co_readv              = replication_co_readv,
-- 
1.8.3.1


Re: [Qemu-devel] [PULL 2/8] replication: clarify permissions
Posted by Eric Blake 8 years, 9 months ago
On 03/17/2017 08:15 AM, Kevin Wolf wrote:
> From: Changlong Xie <xiecl.fnst@cn.fujitsu.com>
> 
> Even if hidden_disk, secondary_disk are backing files, they all need
> write permissions in replication scenario. Otherwise we will encouter
> below exceptions on secondary side during adding nbd server:
> 
> {'execute': 'nbd-server-add', 'arguments': {'device': 'colo-disk', 'writable': true } }
> {"error": {"class": "GenericError", "desc": "Conflicts with use by hidden-qcow2-driver as 'backing', which does not allow 'write' on sec-qcow2-driver-for-nbd"}}
> 
> CC: Zhang Hailiang <zhang.zhanghailiang@huawei.com>
> CC: Zhang Chen <zhangchen.fnst@cn.fujitsu.com>
> CC: Wen Congyang <wencongyang2@huawei.com>

This address for Wen Congyang is different than the one listed in
MAINTAINERS for replication (M: Wen Congyang <wency@cn.fujitsu.com>),
and different still from addresses my mailer has harvested from other
posts (wencongyang@gmail.com).  The MAINTAINERS entry is now resulting
in 'undelivered mail' bounce messages, can you please submit an update
to MAINTAINERS with your new preferred address? [or gently correct me if
I'm confusing two people with the same name?]

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org

Re: [Qemu-devel] [PULL 2/8] replication: clarify permissions
Posted by Hailiang Zhang 8 years, 9 months ago
On 2017/4/18 9:23, Eric Blake wrote:
> On 03/17/2017 08:15 AM, Kevin Wolf wrote:
>> From: Changlong Xie <xiecl.fnst@cn.fujitsu.com>
>>
>> Even if hidden_disk, secondary_disk are backing files, they all need
>> write permissions in replication scenario. Otherwise we will encouter
>> below exceptions on secondary side during adding nbd server:
>>
>> {'execute': 'nbd-server-add', 'arguments': {'device': 'colo-disk', 'writable': true } }
>> {"error": {"class": "GenericError", "desc": "Conflicts with use by hidden-qcow2-driver as 'backing', which does not allow 'write' on sec-qcow2-driver-for-nbd"}}
>>
>> CC: Zhang Hailiang <zhang.zhanghailiang@huawei.com>
>> CC: Zhang Chen <zhangchen.fnst@cn.fujitsu.com>
>> CC: Wen Congyang <wencongyang2@huawei.com>
> This address for Wen Congyang is different than the one listed in
> MAINTAINERS for replication (M: Wen Congyang <wency@cn.fujitsu.com>),
> and different still from addresses my mailer has harvested from other
> posts (wencongyang@gmail.com).  The MAINTAINERS entry is now resulting
> in 'undelivered mail' bounce messages, can you please submit an update
> to MAINTAINERS with your new preferred address? [or gently correct me if
> I'm confusing two people with the same name?]
>

No, the same people, he just left his job from fujitsu, the entry in MAINTAINERS
file needs to be updated.

Cc: Changlong Xie <xiecl.fnst@cn.fujitsu.com>
Hi Changlong, would you please send a patch to update it ?

Hailiang



Re: [Qemu-devel] [PULL 2/8] replication: clarify permissions
Posted by Xie Changlong 8 years, 9 months ago

On 04/18/2017 09:36 AM, Hailiang Zhang wrote:
> On 2017/4/18 9:23, Eric Blake wrote:
>> On 03/17/2017 08:15 AM, Kevin Wolf wrote:
>>> From: Changlong Xie <xiecl.fnst@cn.fujitsu.com>
>>>
>>> Even if hidden_disk, secondary_disk are backing files, they all need
>>> write permissions in replication scenario. Otherwise we will encouter
>>> below exceptions on secondary side during adding nbd server:
>>>
>>> {'execute': 'nbd-server-add', 'arguments': {'device': 'colo-disk', 
>>> 'writable': true } }
>>> {"error": {"class": "GenericError", "desc": "Conflicts with use by 
>>> hidden-qcow2-driver as 'backing', which does not allow 'write' on 
>>> sec-qcow2-driver-for-nbd"}}
>>>
>>> CC: Zhang Hailiang <zhang.zhanghailiang@huawei.com>
>>> CC: Zhang Chen <zhangchen.fnst@cn.fujitsu.com>
>>> CC: Wen Congyang <wencongyang2@huawei.com>
>> This address for Wen Congyang is different than the one listed in
>> MAINTAINERS for replication (M: Wen Congyang <wency@cn.fujitsu.com>),
>> and different still from addresses my mailer has harvested from other
>> posts (wencongyang@gmail.com).  The MAINTAINERS entry is now resulting
>> in 'undelivered mail' bounce messages, can you please submit an update
>> to MAINTAINERS with your new preferred address? [or gently correct me if
>> I'm confusing two people with the same name?]
>>
>
> No, the same people, he just left his job from fujitsu, the entry in 
> MAINTAINERS
> file needs to be updated.
>
> Cc: Changlong Xie <xiecl.fnst@cn.fujitsu.com>
> Hi Changlong, would you please send a patch to update it ?
Hi all

After a short talk with Wen, i would like to update his new email 
address now.

Thanks
     -Xie
>
> Hailiang
>
>
>
>
> .
>