Bug 1057006

Summary: virt-v2v OVA/OVF import fails when no (optional) Name under VirtualSystem is specified
Product: [Community] Virtualization Tools Reporter: Ronald van Zantvoort <van.zantvoort>
Component: libguestfsAssignee: Richard W.M. Jones <rjones>
Status: CLOSED WONTFIX QA Contact:
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: unspecifiedCC: mbooth, ptoscano, rbalakri, rjones, shavivi, van.zantvoort
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-04-15 15:48:23 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 Ronald van Zantvoort 2014-01-23 10:27:08 UTC
Description of problem:
When an OVF doesn't specify a Name under the VirtualSystem section, import will fail:
Use of uninitialized value in subroutine entry at /usr/lib64/perl5/vendor_perl/Sys/Virt/Domain.pm line 51.

Version-Release number of selected component (if applicable):
Fedora 20 / virt-v2v 0.9.0

How reproducible:
Import an OVA / OVF without a <Name> element under <VirtualSystem>.

Actual results:
Import fails.

Expected results:
Import succeeds using mandatory ovf:id as name.

Additional info:
OVF (http://www.dmtf.org/sites/default/files/standards/documents/DSP0243_1.0.0.pdf) defines only the ovf:id as mandatory identification attribute. 
If no Name is specified, we should use that to fall back on:

    $meta{name} = _node_val($root, '/Envelope/VirtualSystem/Name/text()') || _node_attr($root,'/Envelope/VirtualSystem','ovf:id') ;

====

sub _node_attr
{
        my ($root, $xpath, $att) = @_;
        my ($node) = $root->findnodes($xpath);
        
        return defined($node) ? $node->getAttribute($att) : undef;
}

Comment 1 Richard W.M. Jones 2015-04-15 15:48:23 UTC
Hi, thanks for the bug report.  Unfortunately it is filed against a
very old version of virt-v2v (0.9) which we don't support at all.

Luckily there is a newer version which almost certainly fixes your
bug already.  It's available starting in Fedora 21.  If you still
experience this bug, please try with the new version, and reopen
if it still happens.

Comment 2 Ronald van Zantvoort 2015-08-27 14:32:49 UTC
(In reply to Richard W.M. Jones from comment #1)
> Unfortunately it is filed against a
> very old version of virt-v2v (0.9) 

Well, that tends to happen if you wait 16 months with a reply to a ready2commit submitted patch.