Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
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 1261242

Summary: virt-v2v should prevent using '-of' option appears twice on the command line
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.2CC: mxie, mzhan, ptoscano, tzheng, xiaodwan
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard: V2V
Fixed In Version: libguestfs-1.28.1-1.53.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-11-03 17:54:57 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 zhoujunqin 2015-09-09 02:58:17 UTC
Description of problem:
virt-v2v should prevent using '-of' option appears twice on the command line

Version-Release number of selected component (if applicable):
libvirt-1.2.17-8.el7.x86_64
libguestfs-1.28.1-1.52.el7.x86_64
virt-v2v-1.28.1-1.52.el7.x86_64
qemu-kvm-rhev-2.3.0-22.el7.x86_64


How reproducible:
100%

Steps to Reproduce:
1. Convert a esx guest to local kvm with wrong '-of' option:

# export LIBGUESTFS_BACKEND=direct;virt-v2v  -ic vpx://root.4.103/tzheng-demo/10.66.106.63/?no_verify=1 esx5.5-rhel5.11-i386 -of taesratat -o null
[   0.0] Opening the source -i libvirt -ic vpx://root.4.103/tzheng-demo/10.66.106.63/?no_verify=1 esx5.5-rhel5.11-i386
Enter root's password for 10.66.4.103: 
Enter host password for user 'root':
[  13.0] Creating an overlay to protect the source from being modified
[  14.0] Opening the overlay
[  24.0] Initializing the target -o null
virt-v2v: error: output format should be 'raw' or 'qcow2'.

Use the '-of <format>' option to select a different output format for the 
converted guest.

Other output formats are not supported at the moment, although might be 
considered in future.

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

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

2. Convert a esx guest to local kvm with several wrong '-of' options and last one is right '-of' options:

# virt-v2v  -ic vpx://root.4.103/tzheng-demo/10.66.106.63/?no_verify=1 esx5.5-rhel5.11-i386 -of taesratat -of aaa -of raw  -o null
[   0.0] Opening the source -i libvirt -ic vpx://root.4.103/tzheng-demo/10.66.106.63/?no_verify=1 esx5.5-rhel5.11-i386
Enter root's password for 10.66.4.103: 
Enter host password for user 'root':
[  13.0] Creating an overlay to protect the source from being modified
[  13.0] Opening the overlay
[  24.0] Initializing the target -o null
[  24.0] Inspecting the overlay
[  61.0] Checking for sufficient free disk space in the guest
[  61.0] Estimating space required on target for each disk
[  61.0] Converting Red Hat Enterprise Linux Server release 5.11 (Tikanga) to run on KVM
virt-v2v: This guest has virtio drivers installed.
[ 166.0] Mapping filesystem data to avoid copying unused and blank areas
[ 172.0] Closing the overlay
[ 172.0] Checking if the guest needs BIOS or UEFI to boot
[ 172.0] Copying disk 1/1 to /var/tmp/null.Zh3TQS/sda (raw)
    (100.00/100%)
[ 411.0] Creating output metadata
[ 411.0] Finishing off


Actual results:
Step 1: virt-v2v command failed for detecting '-of taesratat' is a invalid option.
Step2: virt-v2v command finished with no error for just detecting the last '-of raw' option is a valid one the same time ignore several wrong '-of' options in front of it.

Expected results:
virt-v2v should prevent using '-of' option appears twice on the command line

Additional info:

Comment 2 zhoujunqin 2015-09-15 10:01:50 UTC
Try to verify this bug with new build:
libvirt-1.2.17-8.el7.x86_64
qemu-kvm-rhev-2.3.0-22.el7.x86_64
libguestfs-1.28.1-1.55.el7.x86_64
virt-v2v-1.28.1-1.55.el7.x86_64


Steps:
1. Convert a esx guest to local kvm with several '-of' option:

# virt-v2v  -ic vpx://root.4.103/tzheng-demo/10.66.106.63/?no_verify=1 esx5.5-rhel5.11-i386 -of taesratat -of aaa -of raw  -o null 
virt-v2v: error: -of 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 [...]

Result: virt-v2v will report a good error, not letting user use more than twice '-of' option.

2. Test other options:

2.1 '-ic'
# virt-v2v  -ic vpx://root.4.103/tzheng-demo/10.66.106.63/?no_verify=1 -ic vpx://root.4.103/tzheng-demo/10.66.106.63/?no_verify=1 esx5.5-rhel5.11-i386 -of raw 
virt-v2v: error: -ic 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 [...]

2.2 '-on'
# virt-v2v  -ic vpx://root.4.103/tzheng-demo/10.66.106.63/?no_verify=1 esx5.5-rhel5.11-i386 -of raw -on test1 -on test2
virt-v2v: error: -on 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 [...]

2.3 '--password-file'
# virt-v2v  -ic vpx://root.4.103/tzheng-demo/10.66.106.63/?no_verify=1 esx5.5-rhel5.11-i386 -of raw -on test1 --password-file /tmp/passwd2 --password-file /tmp/passwd2
virt-v2v: error: --password-file 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 [...]

Also tested other options: -if, -oc, -os,--vdsm-vm-uuid, --vdsm-ovf-output, --vmtype options, they are also forbidding user used more than once on the command line.

Comment 3 mxie@redhat.com 2016-02-26 08:14:18 UTC
Test this bug with new build:
libvirt-1.3.1-1.el7.x86_64
qemu-kvm-rhev-2.3.0-31.el7.x86_64
libguestfs-1.32.2-6.el7.x86_64
virt-v2v-1.32.2-6.el7.x86_64


Steps:
1. Convert a esx guest to local kvm with several '-of' option:

# virt-v2v  -ic vpx://root.4.103/tzheng-demo/10.66.106.63/?no_verify=1 esx5.5-rhel5.11-i386 -of taesratat -of aaa -of raw  -o null 
virt-v2v: error: -of 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 [...]

Result: virt-v2v will report a good error, not letting user use more than twice '-of' option.

2. Test other options:

2.1 '-ic'
# virt-v2v  -ic vpx://root.4.103/tzheng-demo/10.66.106.63/?no_verify=1 -ic vpx://root.4.103/tzheng-demo/10.66.106.63/?no_verify=1 esx5.5-rhel5.11-i386 -of raw 
virt-v2v: error: -ic 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 [...]

2.2 '-on'
# virt-v2v  -ic vpx://root.4.103/tzheng-demo/10.66.106.63/?no_verify=1 esx5.5-rhel5.11-i386 -of raw -on test1 -on test2
virt-v2v: error: -on 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 [...]

2.3 '--password-file'
# virt-v2v  -ic vpx://root.4.103/tzheng-demo/10.66.106.63/?no_verify=1 esx5.5-rhel5.11-i386 -of raw -on test1 --password-file /tmp/passwd2 --password-file /tmp/passwd2
virt-v2v: error: --password-file 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 [...]

Also tested other options: -if, -oc, -os,--vdsm-vm-uuid, --vdsm-ovf-output, --vmtype options, they are also forbidding user used more than once on the command line.

Comment 5 errata-xmlrpc 2016-11-03 17:54:57 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/RHSA-2016-2576.html