|
From: | Eric Blake |
Subject: | Re: [Qemu-devel] [Qemu-block] Can I only commit from active image to corresponding range of its backing file by qemu cmd? |
Date: | Tue, 25 Sep 2018 10:47:31 -0500 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.0 |
On 9/25/18 9:13 AM, Alberto Garcia wrote:
If you only want to copy parts of a backing file I think it's much simpler if you use copy-on-read: qemu-io -C -c 'read 0 1M' img.003.commit.000
Oh, slick.
$ qemu-img convert -O qcow2 \ "json:{'driver':'null-co','size':1048576}" \ "json:{'driver':'raw','offset':1048576,'size':2097152,\ 'file':{'driver':'qcow2',\ 'file':{'driver':'file','filename':'img.003'}}}" \ img.003.nocommitqemu-io -C -c 'read 1M 1M' img.003.nocommit
So use copy-on-read to extract the portions you care about into temporary files, then commit those temporary files into the target.
Beats my hacks using 'qemu-nbd -c /dev/nbdN' and then several dd processes as directed by 'qemu-img map --output=json' output.
-- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org
[Prev in Thread] | Current Thread | [Next in Thread] |