[libvirt] [PATCH 4/4] blockcommit: require base below top

Peter Krempa pkrempa at redhat.com
Mon Jun 16 07:51:36 UTC 2014


On 06/13/14 18:31, Eric Blake wrote:
> The block commit code looks for an explicit base file relative
> to the discovered top file; so for a chain of:
>   base <- snap1 <- snap2 <- snap3
> and a command of:
>   virsh blockcommit $dom vda --base snap2 --top snap1
> we got a sane message (here from libvirt 1.0.5):
> error: invalid argument: could not find base 'snap2' below 'snap1' in chain for 'vda'
> 
> Meanwhile, recent refactoring has slightly reduced the quality of the
> libvirt error messages, by losing the phrase 'below xyz':
> error: invalid argument: could not find image 'snap2' in chain for 'snap3'
> 
> But we had a one-off, where we were not excluding the top file
> itself in searching for the base; thankfully qemu still reports
> the error, but the quality is worse:
>   virsh blockcommit $dom vda --base snap2 --top snap2
> error: internal error unable to execute QEMU command 'block-commit': Base '/snap2' not found
> 
> Fix the one-off in blockcommit by changing the semantics of name
> lookup - if a starting point is specified, then the result must
> be below that point, rather than including that point.  The only
> other call to chain lookup was blockpull code, which was already
> forcing the lookup to omit the active layer and only needs a
> tweak to use the new semantics.
> 
> This also fixes the bug exposed in the testsuite, where when doing
> a lookup pinned to an intermediate point in the chain, we were
> unable to return the name of the parent also in the chain.
> 
> * src/util/virstoragefile.c (virStorageFileChainLookup): Change
> semantics for non-NULL startFrom.
> * src/qemu/qemu_driver.c (qemuDomainBlockJobImpl): Adjust caller,
> to keep existing semantics.
> * tests/virstoragetest.c (mymain): Adjust to expose new semantics.
> 
> Signed-off-by: Eric Blake <eblake at redhat.com>
> ---
>  src/qemu/qemu_driver.c    |  3 +--
>  src/util/virstoragefile.c | 33 ++++++++++++++++++++-------------
>  tests/virstoragetest.c    | 36 +++++++++++++++++-------------------
>  3 files changed, 38 insertions(+), 34 deletions(-)
> 

ACK,

Peter


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 901 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20140616/f69c66a3/attachment-0001.sig>


More information about the libvir-list mailing list