Bug 1550123 - NullPointerException in LibvirtVmXmlBuilder.writeRng if SpecParams is missing
Summary: NullPointerException in LibvirtVmXmlBuilder.writeRng if SpecParams is missing
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Enterprise Virtualization Manager
Classification: Red Hat
Component: ovirt-engine
Version: 4.2.2
Hardware: Unspecified
OS: Unspecified
low
medium
Target Milestone: ---
: ---
Assignee: Nobody
QA Contact: meital avital
URL:
Whiteboard:
Depends On:
Blocks: 1550168
TreeView+ depends on / blocked
 
Reported: 2018-02-28 14:45 UTC by Richard W.M. Jones
Modified: 2019-04-28 10:00 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1550168 (view as bug list)
Environment:
Last Closed: 2018-11-14 11:24:38 UTC
oVirt Team: Virt
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
engine.log (2.71 MB, text/plain)
2018-02-28 14:46 UTC, Richard W.M. Jones
no flags Details

Description Richard W.M. Jones 2018-02-28 14:45:24 UTC
Description of problem:

Create a VM from OVF which has:

      <Item>
        <rasd:Caption>RNG Device</rasd:Caption>
        <rasd:InstanceId>feeae0f9-ce77-4df7-8daf-0d128ef0e0e2</rasd:InstanceId>
        <rasd:ResourceType>0</rasd:ResourceType>
        <Type>rng</Type>
        <Device>virtio</Device>
      </Item>

Note that <SpecParams> is missing from the virtio-rng device.

This causes a NullPointerException in LibvirtVmXmlBuilder.writeRng

Version-Release number of selected component (if applicable):

ovirt-engine-4.2.2.2-0.0.master.20180225172203.gitd7cf125.el7.centos.noarch

How reproducible:

100%

Steps to Reproduce:
1. See description

Comment 1 Richard W.M. Jones 2018-02-28 14:46:26 UTC
Created attachment 1401907 [details]
engine.log

See correlation ID b88ef6ff-62ea-4803-8bfc-15a328b6121b

Comment 2 Richard W.M. Jones 2018-02-28 15:00:57 UTC
Oh and the error message the user sees is completely bogus and irrelevant
to the actual failure:

  There are no hosts to use. Check that the cluster contains at least one host in Up state.

Comment 3 Richard W.M. Jones 2018-02-28 15:01:39 UTC
Similar issue exists in memballoon:

nd] (default task-31) [a2b8be14-3f72-405f-8ea4-1115443bdf4f] Failed to create VM
: java.lang.NullPointerException
        at org.ovirt.engine.core.vdsbroker.builder.vminfo.LibvirtVmXmlBuilder.writeBalloon(LibvirtVmXmlBuilder.java:2155) [vdsbroker.jar:]

Comment 5 Arik 2018-02-28 15:37:46 UTC
(In reply to Tomáš Golembiovský from comment #4)
> Code in OvfReader suggest such situations should be handled. It's probably
> broken.
> 
> https://gerrit.ovirt.org/gitweb?p=ovirt-engine.git;a=blob;f=backend/manager/
> modules/utils/src/main/java/org/ovirt/engine/core/utils/ovf/OvfReader.java;
> h=70b5b8a1ec6f3c20843d7d95c9db8b6a807b5332;hb=HEAD#l272

Note that the code being referenced here sets empty spec-params when spec-params are not specified. The problem happens afterward, because some devices (like RNG and memballoon) hold in their spec-params mandatory properties in oVirt.

IMHO, the simplest solution (because of a technical issue to provide defaults in those cases in oVirt) would be to produce those properties by virt-v2v, like RNG source:
<SpecParams>
  <source>urandom</source>
</SpecParams>

Comment 6 Arik 2018-02-28 15:39:15 UTC
(In reply to Richard W.M. Jones from comment #3)
> Similar issue exists in memballoon:
> 
> nd] (default task-31) [a2b8be14-3f72-405f-8ea4-1115443bdf4f] Failed to
> create VM
> : java.lang.NullPointerException
>         at
> org.ovirt.engine.core.vdsbroker.builder.vminfo.LibvirtVmXmlBuilder.
> writeBalloon(LibvirtVmXmlBuilder.java:2155) [vdsbroker.jar:]

For memballoon:
<SpecParams>
  <model>virtio</model>
</SpecParams>

Comment 7 Arik 2018-02-28 15:44:28 UTC
For smartcard:
<SpecParams>
  <mode>passthrough</mode>
  <type>spicevmc</type>
</SpecParams>

For serial console:
<SpecParams>
  <consoleType>serial</consoleType>
</SpecParams>

Comment 8 Doron Fediuck 2018-06-14 09:08:14 UTC
Is this still relevant?

Comment 9 Richard W.M. Jones 2018-06-14 09:31:40 UTC
Possibly.  We have worked around it in virt-v2v so we will no
longer see it with virt-v2v, but other API clients which
supply OVF might see this.

Comment 10 Ryan Barry 2018-11-14 11:24:38 UTC
This will not make it in a reasonable time. Please re-open if you still feel this should be fixed


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