Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1550123

Summary: NullPointerException in LibvirtVmXmlBuilder.writeRng if SpecParams is missing
Product: Red Hat Enterprise Virtualization Manager Reporter: Richard W.M. Jones <rjones>
Component: ovirt-engineAssignee: Nobody <nobody>
Status: CLOSED WONTFIX QA Contact: meital avital <mavital>
Severity: medium Docs Contact:
Priority: low    
Version: 4.2.2CC: dfediuck, lsurette, michal.skrivanek, Rhev-m-bugs, rjones, srevivo, tgolembi
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1550168 (view as bug list) Environment:
Last Closed: 2018-11-14 11:24:38 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Virt RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1550168    
Attachments:
Description Flags
engine.log none

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