Bug 1459736 - Pop up unexpected error when convert qcow2 disk with -if raw option by virt-v2v
Pop up unexpected error when convert qcow2 disk with -if raw option by virt-v2v
Status: CLOSED NOTABUG
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libguestfs (Show other bugs)
7.4
x86_64 Unspecified
medium Severity medium
: rc
: ---
Assigned To: Richard W.M. Jones
Virtualization Bugs
V2V
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2017-06-07 22:53 EDT by mxie@redhat.com
Modified: 2017-08-25 00:03 EDT (History)
6 users (show)

See Also:
Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2017-06-09 07:08:33 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
virt-v2v.log (60.55 KB, text/plain)
2017-06-07 22:53 EDT, mxie@redhat.com
no flags Details

  None (edit)
Description mxie@redhat.com 2017-06-07 22:53:38 EDT
Created attachment 1285959 [details]
virt-v2v.log

Description of problem:
Pop up unexpected error when convert qcow2 disk with -if raw option by virt-v2v  

Version-Release number of selected component (if applicable):
libguestfs-1.36.3-4.el7.x86_64
virt-v2v-1.36.3-4.el7.x86_64
qemu-kvm-rhev-2.9.0-8.el7.x86_64
libvirt-3.2.0-7.el7.x86_64



How reproducible:
100%

Steps to Reproduce:
1.Prepare a qcow2 disk which has installed os
# qemu-img info xen-pv-rhel6.9-x86_64-sda
image: xen-pv-rhel6.9-x86_64-sda
file format: qcow2
virtual size: 9.8G (10485760000 bytes)
disk size: 3.2G
cluster_size: 65536
Format specific information:
    compat: 1.1
    lazy refcounts: false
    refcount bits: 16
    corrupt: false
2.Using virt-v2v to convert this qcow2 disk with -if raw option
# virt-v2v -i disk xen-pv-rhel6.9-x86_64-sda -o rhv -os 10.73.131.93:/home/nfs_export -if raw
[   0.0] Opening the source -i disk -if raw xen-pv-rhel6.9-x86_64-sda
[   0.0] Creating an overlay to protect the source from being modified
[   0.1] Initializing the target -o rhv -os 10.73.131.93:/home/nfs_export
[   0.3] Opening the overlay
[   1.2] Inspecting the overlay
virt-v2v: error: inspection could not detect the source guest (or physical 
machine).

Assuming that you are running virt-v2v/virt-p2v on a source which is 
supported (and not, for example, a blank disk), then this should not 
happen.

No root device found in this operating system image.

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



Actual results:
As above description

Expected results:
Should popup error like "qemu-img: /var/tmp/v2vovl6f4bd7.qcow2: Image is not in raw format" when convert qcow2 disk with -if raw option by virt-v2v  


Additional info:
1.Can't reproduce the problem when convert raw disk with -if qcow2 option by virt-v2v  
# virt-v2v -i disk esx6.0-rhel7.3-x86_64-sda  -o rhv -os 10.73.131.93:/home/nfs_export -if qcow2
[   0.0] Opening the source -i disk -if qcow2 esx6.0-rhel7.3-x86_64-sda
[   0.0] Creating an overlay to protect the source from being modified
qemu-img: /var/tmp/v2vovlab8f48.qcow2: Image is not in qcow2 format
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 [...]
Comment 2 Richard W.M. Jones 2017-06-08 03:41:20 EDT
> No root device found in this operating system image.

This is correct if you tell virt-v2v that the image is raw when
it's some other format.  The solution is don't use the ‘-if’ option,
since virt-v2v will autodetect the format.

I think this is NOTABUG.
Comment 3 mxie@redhat.com 2017-06-08 03:58:05 EDT
(In reply to Richard W.M. Jones from comment #2)
> > No root device found in this operating system image.
> 
> This is correct if you tell virt-v2v that the image is raw when
> it's some other format.  The solution is don't use the ‘-if’ option,
> since virt-v2v will autodetect the format.
> 
> I think this is NOTABUG.

But v2v could pop up correct error when convert guest from raw disk with -if qcow2, and "if “ option is designed for -i disk, we can't stop customer using -i disk with if option, so I thinks it is better to modify the error info when convert qcow2 disk with -if raw option by virt-v2v in case customer will doubt there are some problem with the disk when he meet this error info
Comment 4 Pino Toscano 2017-06-09 04:37:06 EDT
(In reply to mxie@redhat.com from comment #3)
> (In reply to Richard W.M. Jones from comment #2)
> > > No root device found in this operating system image.
> > 
> > This is correct if you tell virt-v2v that the image is raw when
> > it's some other format.  The solution is don't use the ‘-if’ option,
> > since virt-v2v will autodetect the format.
> > 
> > I think this is NOTABUG.

I agree.

> But v2v could pop up correct error when convert guest from raw disk with -if
> qcow2, and "if “ option is designed for -i disk, we can't stop customer
> using -i disk with if option, so I thinks it is better to modify the error
> info when convert qcow2 disk with -if raw option by virt-v2v in case
> customer will doubt there are some problem with the disk when he meet this
> error info

The problem is that a raw image is a simple file representing byte-by-byte a disk.  Telling qemu to read a qcow2 image as raw will make qemu do not attempt any detection, and read any byte of the file as such, which will be seen as garbage (thus not finding any partition table, filesystem, etc).
Comment 5 mxie@redhat.com 2017-06-09 06:21:27 EDT
Thanks rjones and Pino's details explanation, I think if option is not useful at all for virt-v2v convert guest from disk because virt-v2v will autodetect the disk format , could remove this option in virt-v2v?
Comment 6 Richard W.M. Jones 2017-06-09 06:24:49 EDT
We need to keep the -if option because autodetecting formats can
be dangerous (although with modern qemu it's not really that dangerous).

I should note that this case only happens because you're using
-i disk, which is (sort of) a debugging option, or at least,
an option that wouldn't be used commonly except by people who know
what they're doing.

In ordinary cases (eg. -i libvirt, libvirtxml, ova etc) the metadata
provides the format to virt-v2v safely.
Comment 7 mxie@redhat.com 2017-06-09 06:33:07 EDT
OK,pls close this bug as NOTABUG and I will update test case
Comment 8 Richard W.M. Jones 2017-06-09 07:08:33 EDT
Closing NOTABUG per previous comments.

Note You need to log in before you can comment on or make changes to this bug.