Bug 1140946

Summary: qemu-img shows error message for backing file twice
Product: Red Hat Enterprise Linux 7 Reporter: zhoujunqin <juzhou>
Component: libguestfsAssignee: Richard W.M. Jones <rjones>
Status: CLOSED WONTFIX QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.1CC: areis, dyuan, hhuang, juzhang, mbooth, mzhan, ptoscano, rjones, tzheng, virt-maint, xfu
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: V2V
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1151043 (view as bug list) Environment:
Last Closed: 2015-07-02 10:09:50 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:
Bug Depends On:    
Bug Blocks: 1151043, 1238639    

Description zhoujunqin 2014-09-12 05:38:48 UTC
Description of problem:
Error message showed twice while converting  a guest from libvirtxml with no releated image found

Version-Release number of selected component (if applicable):
virt-v2v-1.27.43-1.1.el7.x86_64
libguestfs-1.27.43-1.1.el7.x86_64
qemu-kvm-rhev-2.1.0-3.rwmj3.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1. Copy xen guest xml file from xen server to v2v server, no copy xen guest img file.
2. Run virt-v2v to connect a xen pv/hvm guest by -i libvirtxml.
# virt-v2v -i libvirtxml -o local -os /var/tmp rhel6.6-pv-x64-test.xml
[   0.0] Opening the source -i libvirtxml rhel6.6-pv-x64-test.xml
[   0.0] Creating an overlay to protect the source from being modified
qemu-img: /tmp/v2vovlcfdd83.qcow2: Could not open '/var/lib/xen/images/rhel6.6-pv-x64-test.img': Could not open '/var/lib/xen/images/rhel6.6-pv-x64-test.img': No such file or directory: No such file or directory
virt-v2v: error: qemu-img command failed, see earlier errors

If reporting bugs, run virt-v2v with debugging enabled and include the
complete output:

  virt-v2v -v -x [...]


Actual results:
The following error showed twice:
qemu-img: /tmp/v2vovlcfdd83.qcow2: Could not open '/var/lib/xen/images/rhel6.6-pv-x64-test.img': Could not open '/var/lib/xen/images/rhel6.6-pv-x64-test.img': No such file or directory: No such file or directory


Expected results:
Error message should only show one time.

Additional info:

Comment 2 Richard W.M. Jones 2014-09-12 18:31:45 UTC
This is actually a qemu bug:

$ qemu-img create -f qcow2 -b /tmp/nosuchfile /tmp/overlay
qemu-img: /tmp/overlay: Could not open '/tmp/nosuchfile': Could not open '/tmp/nosuchfile': No such file or directory: No such file or directory

(That was with Fedora qemu-img-2.1.0-6.fc22.x86_64, but the same
probably happens with qemu-kvm-rhev since they are very similar
versions).

I will add a workaround to libguestfs so it checks the file exists
before running qemu-img.

Comment 3 Richard W.M. Jones 2014-09-12 18:41:49 UTC
(In reply to Richard W.M. Jones from comment #2)
> I will add a workaround to libguestfs so it checks the file exists
> before running qemu-img.

This will be fixed in virt-v2v 1.27.44.  It now says:

$ virt-v2v -i libvirtxml /tmp/bad.xml -o local -os /tmp
[   0.0] Opening the source -i libvirtxml /tmp/bad.xml
virt-v2v: error: access: No such file or directory: 
/home/rjones/d/libguestfs/tests/guests/no-such-disk.img

Comment 5 zhoujunqin 2014-10-08 08:53:41 UTC
(In reply to Richard W.M. Jones from comment #3)
> This will be fixed in virt-v2v 1.27.44.  It now says:
> 
> $ virt-v2v -i libvirtxml /tmp/bad.xml -o local -os /tmp
> [   0.0] Opening the source -i libvirtxml /tmp/bad.xml
> virt-v2v: error: access: No such file or directory: 
> /home/rjones/d/libguestfs/tests/guests/no-such-disk.img

As you said i tried with following package version:
libguestfs-1.27.44-1.1.el7.x86_64
virt-v2v-1.27.44-1.1.el7.x86_64
qemu-kvm-rhev-2.1.2-1.rwmj1.el7.x86_64

steps:
# virt-v2v -i libvirtxml rhel6.6-pv-x64-test.xml -o local -os /tmp 
[   0.0] Opening the source -i libvirtxml rhel6.6-pv-x64-test.xml
virt-v2v: error: access: No such file or directory: 
/var/lib/xen/images/rhel6.6-pv-x64-test.img

If reporting bugs, run virt-v2v with debugging enabled and include the 
complete output:

  virt-v2v -v -x [...]

Getting the same result with you.
But while i updated virt-v2v to latest version:
libguestfs-1.27.58-1.1.el7.x86_64
virt-v2v-1.27.58-1.1.el7.x86_64
qemu-kvm-rhev-2.1.2-1.rwmj1.el7.x86_64

Getting the same result with bug description.

steps:
# virt-v2v -i libvirtxml rhel6.6-pv-x64-test.xml -o local -os /tmp 
[   0.0] Opening the source -i libvirtxml rhel6.6-pv-x64-test.xml
[   0.0] Creating an overlay to protect the source from being modified
qemu-img: /var/tmp/v2vovl32b9ad.qcow2: Could not open '/var/lib/xen/images/rhel6.6-pv-x64-test.img': Could not open '/var/lib/xen/images/rhel6.6-pv-x64-test.img': No such file or directory: No such file or directory
virt-v2v: error: qemu-img command failed, see earlier errors

If reporting bugs, run virt-v2v with debugging enabled and include the 
complete output:

  virt-v2v -v -x [...]


so please help check whether there is something missed in the new version, thanks.

Comment 6 Richard W.M. Jones 2014-10-08 09:23:09 UTC
I've added a workaround in virt-v2v 1.27.44.  However the original
bug still exists in qemu-kvm-rhev, therefore the component is correct.

Reproducer:

$ qemu-img create -f qcow2 -b /tmp/nosuchfile /tmp/overlay
qemu-img: /tmp/overlay: Could not open '/tmp/nosuchfile': Could not open '/tmp/nosuchfile': No such file or directory: No such file or directory

Comment 7 langfang 2014-10-09 08:17:33 UTC
Hi,Ademar
    This bug is now "MODIFIED",please help to add the fixed version for qemu-kvm-rhev component.


thanks
fang lang

Comment 8 Ademar Reis 2014-10-09 13:21:34 UTC
(In reply to Richard W.M. Jones from comment #6)
> I've added a workaround in virt-v2v 1.27.44.  However the original
> bug still exists in qemu-kvm-rhev, therefore the component is correct.
> 

The status was inconsistent: MODIFIED, fixed in version pointing to libguestfs, but component marked qemu-kvm. Fixed by changing the component.


> Reproducer:
> 
> $ qemu-img create -f qcow2 -b /tmp/nosuchfile /tmp/overlay
> qemu-img: /tmp/overlay: Could not open '/tmp/nosuchfile': Could not open
> '/tmp/nosuchfile': No such file or directory: No such file or directory

Clone for QEMU: Bug 1151043

Comment 11 Richard W.M. Jones 2015-07-02 10:09:50 UTC
I'm closing this bug (against libguestfs).

The bug is really in qemu (bug 1151043).

We tried to work around the qemu bug in libguestfs, however doing
that caused another problem, so I reverted the workaround.

It has to be fixed in the proper place, and we cannot work around
it in libguestfs / virt-v2v.