replication: clarify permissions
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>
This commit is contained in:
parent
6958349085
commit
37a9051cc7
|
@ -155,6 +155,18 @@ static void replication_close(BlockDriverState *bs)
|
||||||
replication_remove(s->rs);
|
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)
|
static int64_t replication_getlength(BlockDriverState *bs)
|
||||||
{
|
{
|
||||||
return bdrv_getlength(bs->file->bs);
|
return bdrv_getlength(bs->file->bs);
|
||||||
|
@ -660,7 +672,7 @@ BlockDriver bdrv_replication = {
|
||||||
|
|
||||||
.bdrv_open = replication_open,
|
.bdrv_open = replication_open,
|
||||||
.bdrv_close = replication_close,
|
.bdrv_close = replication_close,
|
||||||
.bdrv_child_perm = bdrv_filter_default_perms,
|
.bdrv_child_perm = replication_child_perm,
|
||||||
|
|
||||||
.bdrv_getlength = replication_getlength,
|
.bdrv_getlength = replication_getlength,
|
||||||
.bdrv_co_readv = replication_co_readv,
|
.bdrv_co_readv = replication_co_readv,
|
||||||
|
|
Loading…
Reference in New Issue