Bug 1067407

Summary: Changing the CD of a VM that is down generates a NPE
Product: [Retired] oVirt Reporter: Juan Hernández <juan.hernandez>
Component: ovirt-engine-coreAssignee: Martin Betak <mbetak>
Status: CLOSED CURRENTRELEASE QA Contact: Ilanit Stein <istein>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 3.4CC: bugs, gklein, iheim, iliam, michal.skrivanek, rbalakri, s.kieske, yeylon
Target Milestone: ---   
Target Release: 3.5.1   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: virt
Fixed In Version: ovirt-3.5.0_rc2 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-01-21 16:03:34 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:
Attachments:
Description Flags
Exception in engine.log none

Description Juan Hernández 2014-02-20 12:20:34 UTC
Trying to change the CD of a VM that is down triggers a NPE. The problem is that we are trying to calculate the actual path to the CD image before verifying the state of the VM and of the storage domain.

It can be reproduces as follows:

curl \
-k \
-X PUT \
-H "Accept: application/xml" \
-H "Content-Type: application/xml" \
-d '
<cdrom id="00000000-0000-0000-0000-000000000000">
  <file id="the_name_of_the_iso_file"/>
</cdrom>
' \
-u admin@internal:redhat123 \
'https://rhel.example.com/api/vms/the_id_of_the_vm/cdroms/00000000-0000-0000-0000-000000000000;current=true'

The result of this currently is the following:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<fault>
    <reason>Operation Failed</reason>
    <detail>[General command validation failure.]</detail>
</fault>

And the following exception in the attached engine.log file.

The expected result is this one:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<fault>
    <reason>Operation Failed</reason>
    <detail>[Cannot Change CD VM because it is in Down status.]</detail>
</fault>

Comment 1 Juan Hernández 2014-02-20 12:21:33 UTC
Created attachment 865487 [details]
Exception in engine.log

Comment 2 Juan Hernández 2014-02-20 12:24:21 UTC
Note that this issue was detected while working on the Java SDK bug 1060672, but it is a different issue.

Comment 3 Ilanit Stein 2014-11-02 08:24:16 UTC
Verified on vt8:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<fault>
    <reason>Operation Failed</reason>
    <detail>[Cannot Change CD VM because the VM is in Down status.]</detail>
</fault>

Comment 4 Sandro Bonazzola 2015-01-21 16:03:34 UTC
oVirt 3.5.1 has been released. If problems still persist, please make note of it in this bug report.