Bug 918236 - virt-convert fails to convert RHEV .ovf - IndexError: list index out of range
Summary: virt-convert fails to convert RHEV .ovf - IndexError: list index out of range
Keywords:
Status: CLOSED CANTFIX
Alias: None
Product: Virtualization Tools
Classification: Community
Component: virt-manager
Version: unspecified
Hardware: x86_64
OS: Linux
unspecified
low
Target Milestone: ---
Assignee: Cole Robinson
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-03-05 18:34 UTC by James Laska
Modified: 2014-02-07 22:39 UTC (History)
11 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2014-02-07 22:39:21 UTC
Embargoed:


Attachments (Terms of Use)
example.ovf (10.68 KB, text/plain)
2013-03-05 18:34 UTC, James Laska
no flags Details

Description James Laska 2013-03-05 18:34:23 UTC
Created attachment 705586 [details]
example.ovf

Description of problem:

Attempting to convert a RHEV OVF image of ManageIQ fails using virt-convert.

Version-Release number of selected component (if applicable):
 * python-virtinst-0.600.3-2.fc18.noarch

Steps to Reproduce:
1. Obtain ManageIQ EVM appliance OVF (hand wave)
2. Attempt to convert RHEV OVF into virt-image format
> virt-convert --debug  -i ovf -o virt-image  master/vms/4d9cfc66-1ae5-4e7b-9b2a-39176d4e63b5/4d9cfc66-1ae5-4e7b-9b2a-39176d4e63b5.ovf

Actual results:

> [Tue, 05 Mar 2013 13:32:24 virt-convert 20422] ERROR (cli:439) Couldn't import file "master/vms/4d9cfc66-1ae5-4e7b-9b2a-39176d4e63b5/4d9cfc66-1ae5-4e7b-9b2a-39176d4e63b5.ovf": list index out of range
> [Tue, 05 Mar 2013 13:32:24 virt-convert 20422] DEBUG (cli:442) 
> Traceback (most recent call last):
>   File "/usr/bin/virt-convert", line 185, in main
>     vmdef = inp.import_file(options.input_file)
>   File "/usr/lib/python2.7/site-packages/virtconv/parsers/ovf.py", line 300, in import_file
>     return _xml_wrapper(xml, ovf_parser._import_file)
>   File "/usr/lib/python2.7/site-packages/virtconv/parsers/ovf.py", line 131, in _xml_wrapper
>     result = func(ctx)
>   File "/usr/lib/python2.7/site-packages/virtconv/parsers/ovf.py", line 345, in _import_file
>     ens = xpath_nodes("/ovf:Envelope[1]")[0]
> IndexError: list index out of range

Expected results:

Successful image conversion

Additional info:
 * See attachment for .ovf file

Comment 1 William Brown 2013-08-09 02:48:02 UTC
I can reproduce this issue also.

Comment 4 Giuseppe Scrivano 2013-11-04 13:22:58 UTC
the problem seems to be caused by the xpath query.  If the "ovf" namespace is not registered, then xpath doesn't correctly perform the query.

This line seems to fix the reported problem:

ctx.xpathRegisterNs("ovf", "http://schemas.dmtf.org/ovf/envelope/1/")

Using the attached file I now get:

Traceback (most recent call last):
  File "virt-manager/virt-convert", line 176, in main
    vmdef = inp.import_file(options.input_file)
  File "virt-manager/virtconv/parsers/ovf.py", line 289, in import_file
    register_namespace=ovf_register_namespace)
  File "virt-manager/virtinst/util.py", line 300, in xml_parse_wrapper
    ret = parse_func(doc, ctx, *args, **kwargs)
  File "virt-manager/virtconv/parsers/ovf.py", line 426, in _import_file
    vm.validate()
  File "virt-manager/virtconv/vmcfg.py", line 69, in validate
    raise ValueError(_("VM name is not set"))
ValueError: VM name is not set

and it seems that the file is missing also other information.

I have no familiarity with ovf, is it a valid ovf file?

Comment 5 Cole Robinson 2013-11-05 16:10:23 UTC
If RHEV is generating it, presumably it's been successfully consumed by something else. So I think we can assume it's a valid ovf. virt-convert likely just needs to be extended.

Comment 6 Cole Robinson 2014-02-07 22:39:21 UTC
After poking at it for a while, I'm pretty convinced that ovf output is bogus. It's not like any other ovf files I can find in the wild. It doesn't even reference real filesystem paths, just UUIDs, so there would be nothing for libvirt to actually start anyways. Closing as CANTFIX


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