Bug 1144923

Summary: Improve the error info when do blockpull on same source file
Product: Red Hat Enterprise Linux 7 Reporter: Shanzhi Yu <shyu>
Component: libvirtAssignee: Pavel Hrdina <phrdina>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: low    
Version: 7.1CC: dyuan, mzhan, rbalakri, yanyang
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libvirt-1.2.6-1.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-11-19 05:53:08 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Shanzhi Yu 2014-09-22 02:49:26 UTC
Description of problem:

Improve the error info when do blockpull on same source file

Version-Release number of selected component (if applicable):

libvirt-0.10.2-46.el6.x86_64

How reproducible:

100%

Steps to Reproduce:

1. Prepare a running guest

# virsh list
 Id    Name                           State
----------------------------------------------------
 3     rh6.5                          running

2. Create one external disk-only snapshot

# virsh snapshot-create-as rh6.5 s1 --disk-only
Domain snapshot s1 created

3. Do blockpull with base point to current "source file"

# virsh dumpxml rh6.5|grep "source file"
    <source file='/var/lib/libvirt/images/kvm-rhel6.5-x86_64-qcow2.s1'/>

# virsh blockpull rh6.5 vda --base /var/lib/libvirt/images/kvm-rhel6.5-x86_64-qcow2.s1
error: internal error Unexpected error


Actual results:


Expected results:

Libvirt should post more clear error info stead of "Unexpected error"  

Additional info:

Comment 2 Pavel Hrdina 2015-06-18 13:28:17 UTC
Upstream commit:

commit 3e3c6ff10fdb0bb086d61629d75bcad9169152b9
Author: Eric Blake <eblake>
Date:   Wed Jun 11 16:22:57 2014 -0600

    blockcommit: require base below top
    
    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>


v1.2.5-133-g3e3c6ff

Comment 4 Yang Yang 2015-07-29 09:05:52 UTC
Verified with libvirt-1.2.17-2.el7.x86_64 and qemu-kvm-rhev-2.3.0-12.el7.x86_64.

Steps
1. define/start a vm with following xml
<disk type='file' device='disk'>
      <driver name='qemu' type='qcow2'/>
       <source protocol='gluster' name='gluster-vol1/rhel7.qcow2'>
            <host name='10.66.4.164' port='24007'/>
       </source>
       <target dev='vda' bus='virtio'/>
</disk>
       
2. create 3 snapshots
# for i in {1..3}; do virsh snapshot-create-as vm3 s$i --disk-only --diskspec vda,file=/tmp/vm3.s$i; done
Domain snapshot s1 created
Domain snapshot s2 created
Domain snapshot s3 created

3. do blockpull by specifying base with top image
# virsh blockpull vm3 vda --base /tmp/vm3.s3 --wait --verbose
error: invalid argument: could not find image '/tmp/vm3.s3' beneath '/tmp/vm3.s3' in chain for '/tmp/vm3.s3'

Comment 6 errata-xmlrpc 2015-11-19 05:53:08 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2015-2202.html