Bug 1261242 - virt-v2v should prevent using '-of' option appears twice on the command line
virt-v2v should prevent using '-of' option appears twice on the command line
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libguestfs (Show other bugs)
7.2
x86_64 Unspecified
medium Severity medium
: rc
: ---
Assigned To: Richard W.M. Jones
Virtualization Bugs
V2V
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2015-09-08 22:58 EDT by zhoujunqin
Modified: 2016-11-03 13:54 EDT (History)
5 users (show)

See Also:
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 13:54:57 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)

  None (edit)
Description zhoujunqin 2015-09-08 22:58:17 EDT
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@10.66.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@10.66.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@10.66.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@10.66.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 06:01:50 EDT
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@10.66.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@10.66.4.103/tzheng-demo/10.66.106.63/?no_verify=1 -ic vpx://root@10.66.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@10.66.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@10.66.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 03:14:18 EST
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@10.66.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@10.66.4.103/tzheng-demo/10.66.106.63/?no_verify=1 -ic vpx://root@10.66.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@10.66.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@10.66.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 13:54:57 EDT
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

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