mirror of
https://gitlab.com/qemu-project/qemu
synced 2024-11-05 20:35:44 +00:00
replication: Avoid blk_make_empty() on read-only child
This is just a bandaid to keep tests/test-replication working after bdrv_make_empty() starts to assert that we're not trying to call it on a read-only child. For the real solution in the future, replication should not steal the BdrvChild from its backing file (this is never correct to do!), but instead have its own child node references, with the appropriate permissions. Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
2d97fde439
commit
6ecbc6c526
1 changed files with 11 additions and 2 deletions
|
@ -343,9 +343,18 @@ static void secondary_do_checkpoint(BDRVReplicationState *s, Error **errp)
|
|||
return;
|
||||
}
|
||||
|
||||
ret = s->hidden_disk->bs->drv->bdrv_make_empty(s->hidden_disk->bs);
|
||||
BlockBackend *blk = blk_new(qemu_get_current_aio_context(),
|
||||
BLK_PERM_WRITE, BLK_PERM_ALL);
|
||||
blk_insert_bs(blk, s->hidden_disk->bs, &local_err);
|
||||
if (local_err) {
|
||||
error_propagate(errp, local_err);
|
||||
blk_unref(blk);
|
||||
return;
|
||||
}
|
||||
|
||||
ret = blk_make_empty(blk, errp);
|
||||
blk_unref(blk);
|
||||
if (ret < 0) {
|
||||
error_setg(errp, "Cannot make hidden disk empty");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue