|
From: | Vladimir Sementsov-Ogievskiy |
Subject: | Re: [PATCH v2 3/4] qapi: blockdev-backup: add discard-source parameter |
Date: | Thu, 25 Jan 2024 20:28:17 +0300 |
User-agent: | Mozilla Thunderbird |
On 19.01.24 17:46, Fiona Ebner wrote:
Am 17.01.24 um 17:07 schrieb Vladimir Sementsov-Ogievskiy:Add a parameter that enables discard-after-copy. That is mostly useful in "push backup with fleecing" scheme, when source is snapshot-access format driver node, based on copy-before-write filter snapshot-access API: [guest] [snapshot-access] ~~ blockdev-backup ~~> [backup target] | | | root | file v v [copy-before-write] | | | file | target v v [active disk] [temp.img] In this case discard-after-copy does two things: - discard data in temp.img to save disk space - avoid further copy-before-write operation in discarded area Note that we have to declare WRITE permission on source in copy-before-write filter, for discard to work. Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>Unfortunately, setting BLK_PERM_WRITE unconditionally breaks blockdev-backup for a read-only node (even when not using discard-source):
Ohh, right. So, that's the place when we have to somehow pass through discrard-souce option to CBW filter, so that it know that WRITE permission is needed. Will try in v3. Thanks again for testing!
#!/bin/bash ./qemu-img create /tmp/disk.raw -f raw 1G ./qemu-img create /tmp/backup.raw -f raw 1G ./qemu-system-x86_64 --qmp stdio \ --blockdev raw,node-name=node0,file.driver=file,file.filename=/tmp/disk.raw,read-only=true \ --blockdev raw,node-name=node1,file.driver=file,file.filename=/tmp/backup.raw \ <<EOF {"execute": "qmp_capabilities"} {"execute": "blockdev-backup", "arguments": { "device": "node0", "target": "node1", "sync": "full", "job-id": "backup0" } } EOFThe above works before applying this patch, but leads to an error afterwards:{"error": {"class": "GenericError", "desc": "Block node is read-only"}}Best Regards, Fiona
-- Best regards, Vladimir
[Prev in Thread] | Current Thread | [Next in Thread] |