On 10/05/2012 11:29 AM, Eric Blake wrote:

> 
> which uses the absolute file name base->filename and fails to find base,
> making it impossible to commit into a base file that was referenced via
> relative name in the chain.  I think that bdrv_find_backing_image needs
> to canonicalize any relative name passed in on input relative to the
> directory of the bs where it is starting the search, and then search for
> absolute name matches rather than the current approach of searching for
> exact string matches (even if the exact string is a relative name).
> 
> Also, consider this case of mixed relative and absolute backing files in
> the chain:
> 
> /dir1/base <- /dir1/file1(base) <- /dir2/base(/dir1/file1) <-
> /dir2/file2(base)
> 
> The relative name 'base' appears twice in the chain, so you either have
> to declare it ambiguous, or else declare that relative names are
> canonicalized relative to the starting point (such that
> bdrv_find_backing_image(/dir1/file1, "base") gives a different result
> than bdrv_find_backing_image(/dir2/file2, "base").  Which means, if I
> request block-commit "top":"/dir1/file1", "base":"base", am I requesting
> a commit into /dir1/base (good) or into /dir2/base (swapped arguments)?

Related question:

/dir/base <- /dir/snap1(base) <- /dir/active(/dir/snap1)

If I commit snap1 into base, should /dir/active encode the backing file
as '/dir/base' (keep things absolute, since /dir/active had already been
absolute) or as 'base' (relative, since the part of the chain previously
referring to base was using relative).  And if we store relative names,
we need to make sure that the relative name stored in /dir/active
correctly points to the correct file name, even if the ultimate base
file lives in a different directory (similar problems exist with
relative chains during block pull).

I'm wondering if this means 'block-stream' and 'block-commit' both need
to add @mode:#optional arguments, similar to Paolo's 'drive-mirror'
command [1], so that the user can request 'absolute-paths' vs.
'relative-paths' as the mode for which of two file names will be written
as the backing file at the end of the operation.

[1] https://lists.gnu.org/archive/html/qemu-devel/2012-09/msg04592.html

-- 
Eric Blake   ebl...@redhat.com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to