RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1459736 - Pop up unexpected error when convert qcow2 disk with -if raw option by virt-v2v
Summary: Pop up unexpected error when convert qcow2 disk with -if raw option by virt-v2v
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libguestfs
Version: 7.4
Hardware: x86_64
OS: Unspecified
medium
medium
Target Milestone: rc
: ---
Assignee: Richard W.M. Jones
QA Contact: Virtualization Bugs
URL:
Whiteboard: V2V
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-06-08 02:53 UTC by mxie@redhat.com
Modified: 2017-08-25 04:03 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-06-09 11:08:33 UTC
Target Upstream Version:
Embargoed:


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

Description mxie@redhat.com 2017-06-08 02:53:38 UTC
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 07:41:20 UTC
> 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 07:58:05 UTC
(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 08:37:06 UTC
(In reply to mxie 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 10:21:27 UTC
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 10:24:49 UTC
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 10:33:07 UTC
OK,pls close this bug as NOTABUG and I will update test case

Comment 8 Richard W.M. Jones 2017-06-09 11:08:33 UTC
Closing NOTABUG per previous comments.


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