Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
For bugs related to Red Hat Enterprise Linux 5 product line. The current stable release is 5.10. For Red Hat Enterprise Linux 6 and above, please visit Red Hat JIRA https://issues.redhat.com/secure/CreateIssue!default.jspa?pid=12332745 to report new issues.

Bug 601092

Summary: [RFE]Incorrect error msg popped up when missing "-f" in v2v command
Product: Red Hat Enterprise Linux 5 Reporter: Rita Wu <rwu>
Component: virt-v2vAssignee: Matthew Booth <mbooth>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: low Docs Contact:
Priority: low    
Version: 5.5CC: cwei, das_pupun, llim, mbooth, mkenneth, mshao, rjones
Target Milestone: rcKeywords: FutureFeature
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: virt-v2v-0.6.1-1.el5 Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2010-07-27 19:47:59 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Rita Wu 2010-06-07 08:05:46 UTC
Description of problem:
Error msg like "Domain not found" will pop up, although it is due to missing "-f" in v2v command. It's better to point the problem is the missing parameter or virt-v2v.conf rather than "Domain not found" which will mislead users. 


Version-Release number of selected component (if applicable):
v2v-libvirt-0.8.1-2.el5
virt-v2v-0.6.0-3.el5


How reproducible:
always

Steps to Reproduce:
1. scenario 1:
# virsh list --all
 Id Name                 State
----------------------------------
  0 Domain-0             running
  - floppy               shut off

#virt-v2v /etc/virt-v2v.conf -ic xen:/// -o rhev -osd 10.66.90.115:/vol/v2vwulinglu/wulingluv2v/fcp_export floppy
libvirt error code: 42, message: Domain not found: xenUnifiedDomainLookupByName


2. scenario 2:

#  virt-v2v -i libvirtxml /etc/virt-v2v.conf -ic xen:/// -o rhev -osd 10.66.90.115:/vol/v2vwulinglu/wulingluv2v/fcp_export floppy.xml 
Use of uninitialized value in -e at /usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi/Sys/Guestfs/Lib.pm line 150.
Use of uninitialized value in string eq at /usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi/Sys/Guestfs/Lib.pm line 180.
Use of uninitialized value in string eq at /usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi/Sys/Guestfs/Lib.pm line 180.
Use of uninitialized value in string eq at /usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi/Sys/Guestfs/Lib.pm line 180.
Use of uninitialized value in string eq at /usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi/Sys/Guestfs/Lib.pm line 180.
Use of uninitialized value in string eq at /usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi/Sys/Guestfs/Lib.pm line 180.
Use of uninitialized value in string eq at /usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi/Sys/Guestfs/Lib.pm line 180.
{imagename} is not the name of an inactive libvirt domain
Error removing /tmp/eqOzTs2y84.virt-v2v at /usr/lib/perl5/5.8.8/File/Temp.pm line 890.
  
Actual results:
As steps mentioned.

Expected results:
It's better to point the problem is the missing parameter or virt-v2v.conf

Additional info:

Comment 1 Matthew Booth 2010-06-07 09:03:08 UTC
Moving this over to libguestfs. The specific error you get relates to the way libguestfs tries to guess whether something is an image file or a libvirt domain.

Comment 2 Richard W.M. Jones 2010-06-11 08:48:46 UTC
There's another confusing thing here:

> {imagename} is not the name of an inactive libvirt domain

and yet the code looks fine to me:

http://git.annexia.org/?p=libguestfs.git;a=blob;f=perl/lib/Sys/Guestfs/Lib.pm;h=128f7c9fa26b39d71f07544172e42b1d95171538;hb=HEAD#l193

Comment 3 Richard W.M. Jones 2010-06-11 09:12:08 UTC
I think this is a virt-v2v problem.  It seems you are calling

    my $g = open_guest($storage, rw => 1, interface => $interface);

with $storage == \undef (ie a reference to scalar undef).  This also
explains comment 2 since we try to substitute imagename with undef,
and that confuses __x so it prints the original variable name.

The answer is, don't call open_guest with \undef as the first parameter...

I'm very confused by the code in Connection.pm vs Connection/LibvirtXML.pm
since the former uses $self->{paths} and the latter only sets $self->{path},
so I'm not sure how this is supposed to work.  Strong typing FTW.

Comment 4 Matthew Booth 2010-06-16 15:32:28 UTC
(In reply to comment #3)
> I'm very confused by the code in Connection.pm vs Connection/LibvirtXML.pm
> since the former uses $self->{paths} and the latter only sets $self->{path},
> so I'm not sure how this is supposed to work.  Strong typing FTW.    

$self->{path} in Connection::LibvirtXML refers to the path to the file containing the libvirt xml.

$self->{paths} is populated by _storage_iterate in the superclass which iterates over a parsed domain extracting the paths to underlying storage.

Comment 5 Matthew Booth 2010-06-18 14:29:44 UTC
This is fixed upstream.

Comment 8 Rita Wu 2010-07-19 07:22:25 UTC
Hi Matt,

 I verified it on virt-v2v-0.6.1-1.el5.It's better than ever. Now, v2v will consider virt-v2v.conf as domain or domain XML file if missing "-f". But could the error message be more specified?
 
scenario 1:
# virt-v2v /etc/virt-v2v.conf -o rhev -osd 10.66.90.115:/vol/v2vwulinglu/wulingluv2v/fcp_export xenfv-rhel48-32
libvirt error code: 42, message: Domain not found: no domain with matching name '/etc/virt-v2v.conf'

scenario 2:
# virt-v2v -i libvirtxml /etc/virt-v2v.conf  -o rhev -osd 10.66.90.115:/vol/v2vwulinglu/wulingluv2v/fcp_export cleankvm-RHEL-5.4-32.raw.xml
virt-v2v: /etc/virt-v2v.conf doesn't look like a libvirt domain XML file

Comment 9 Rita Wu 2010-07-19 10:10:14 UTC
Communicate with Matt, the current result is clear enough for users to debug. So set it as verified.

Comment 10 das_pupun 2010-07-20 03:19:26 UTC
Hi Matt,

I am experiencing a similar issue when trying to run virt-v2v even with the -f option:

# virt-v2v -f /etc/virt-v2v.conf -ic esx://X.X.X.X/?no_verify=1 -o rhev -osd Y.Y.Y.Y:/export/v2v Webserver04
libvirt error code: 42, message: Domain not found: No domain with name 'Webserver04'

Please let me know if you have any suggestions on how to resolve this issue.

Regards,
Das

Comment 12 errata-xmlrpc 2010-07-27 19:47:59 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2010-0566.html