Bug 1140050

Summary: No error shows when multiple conflicting options used with virt-v2v
Product: Red Hat Enterprise Linux 7 Reporter: zhoujunqin <juzhou>
Component: libguestfsAssignee: Richard W.M. Jones <rjones>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.1CC: codong, dyuan, mbooth, mzhan, ptoscano, tzheng, wshi
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: V2V
Fixed In Version: libguestfs-1.27.42-1.2.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-03-05 13:44:26 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:
Attachments:
Description Flags
log for step step2
none
log file to step3 none

Description zhoujunqin 2014-09-10 08:58:42 UTC
Description of problem:
No error shows when multiple conflicting options used with virt-v2v

Version-Release number of selected component (if applicable):
libguestfs-1.27.41-1.1.el7.x86_64
virt-v2v-1.27.41-1.1.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1. Check the virt-v2v manual page, it said that "Only one input and output mode can be selected for each run of virt-v2v".
# man virt-v2v
...
       Virt-v2v has a number of possible input and output modes, selected using the -i and -o options.  Only one input and output mode can be selected for each
       run of virt-v2v.
...

2. Use "-i libvirtxml" & "-i disk" options together when converting a guest.
# virt-v2v -i disk -i libvirtxml -o local -os /var/tmp/ rhel6.6-pv-x64-test.img
[   0.0] Opening the source -i libvirtxml rhel6.6-pv-x64-test.img
virt-v2v: error: exception: Out of memory

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

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

3. Use "-i disk" for several times in one command line.
# virt-v2v -i disk -i disk -i disk -i disk  -o local -os /var/tmp/ rhel6.6-pv-x64-test.img
[   0.0] Opening the source -i disk rhel6.6-pv-x64-test.img
[   0.0] Creating an overlay to protect the source from being modified
[   0.0] Opening the overlay
[  44.0] Initializing the target -o local -os /var/tmp/
[  44.0] Inspecting the overlay
[  48.0] Checking for sufficient free disk space in the guest
[  48.0] Converting Red Hat Enterprise Linux Server release 6.6 Beta (Santiago) to run on KVM
virt-v2v: warning: /files/boot/grub/device.map/hd0 references unknown
device "xvda".  You may have to fix this entry manually after conversion.
[  76.0] Mapping filesystem data to avoid copying unused and blank areas
[  77.0] Closing the overlay
[  77.0] Copying disk 1/1 to /var/tmp/rhel6.6-pv-x64-test-sda (raw)
    (100.00/100%)
[  91.0] Creating output metadata
[  91.0] Finishing off

Actual results:
For step2: Conversion failed, but the error: exception: Out of memory is unclear.
For step3: Conversion successfully with several times in one command line.

Expected results:
virt-v2v should forbid multiple conflicting options used with virt-v2v show friendly error.

Additional info:
Log file for step2 and step3 will be attached.

Comment 1 zhoujunqin 2014-09-10 08:59:47 UTC
Created attachment 936056 [details]
log for step step2

Comment 2 zhoujunqin 2014-09-10 09:01:21 UTC
Created attachment 936057 [details]
log file to step3

Comment 4 Richard W.M. Jones 2014-09-10 10:29:10 UTC
For the -i and -o options, this is fixed in the following
commit:

https://github.com/libguestfs/libguestfs/commit/b6099f4aee3e14a04f6b8c8d62246d337f2a1582

$ virt-v2v -i disk -i libvirt
virt-v2v: error: -i option used more than once on the command line

Note this doesn't fix other options.  eg. It's still possible
to specify -oa or -os twice (in which case, the last option "wins").
It complicates the code to prevent such cases.

Comment 6 zhoujunqin 2014-09-12 09:04:19 UTC
I can reproduce this issue as Comment 0.
Try to verify with new build:
libguestfs-1.27.43-1.1.el7.x86_64
virt-v2v-1.27.43-1.1.el7.x86_64

steps:

# virt-v2v -i libvirtxml -i disk
virt-v2v: error: -i option used more than once on the command line

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

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

# virt-v2v -i disk -o local -i disk 
virt-v2v: error: -i option used more than once on the command line

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

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

# virt-v2v -i disk -o local -o local 
virt-v2v: error: -o option used more than once on the command line

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

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

# virt-v2v  -o local -i disk -o local
virt-v2v: error: -o option used more than once on the command line

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

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

see above result, move this bug from ON_QA to VERIFIED.

Comment 8 errata-xmlrpc 2015-03-05 13:44:26 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-0303.html