Bug 876994

Summary: REST: The api doesn't reveal a new CD, changed when the VM was up (using [;?] current=True, but show the one in config
Product: Red Hat Enterprise Virtualization Manager Reporter: Barak Dagan <bdagan>
Component: ovirt-engineAssignee: Martin Betak <mbetak>
Status: CLOSED DUPLICATE QA Contact: Ilanit Stein <istein>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 3.1.0CC: acathrow, bazulay, ecohen, iheim, istein, jkt, lpeer, michal.skrivanek, oramraz, pstehlik, Rhev-m-bugs, yeylon
Target Milestone: ---Keywords: Reopened
Target Release: 3.5.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: virt
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-01-30 10:00:30 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 Barak Dagan 2012-11-15 13:41:55 UTC
Description of problem:
After A CD is changed from the rest API:
PUT api/vms/xxx/cdroms/yyy;current=True

<cdrom id="xxx">
    <file id="zzz.iso"/>
</cdrom>

and getting status 200, 

trying to verify the change, and senging PUT api/vms/xxx/cdroms/yyy

I'm getting 
<cdrom id="xxx">
    <file id="from_config.iso"/> --- instead of zzz.iso
</cdrom>


Version-Release number of selected component (if applicable):
- Found on si24.1

How reproducible:
every time

Steps to Reproduce:
1. see above
2.
3.
  
Actual results:
Getting file from the config:
psql -U postgres -d engine -c "select spec_params from vm_device where vm_id = 'd7fc1f3c-8933-4fc6-987b-ef36e40b5199' and device = 'cdrom';" | less -S

Expected results:
to get the new CD

Additional info:

Comment 1 Michael Pasternak 2012-11-15 13:56:00 UTC
(In reply to comment #0)
> Description of problem:
> After A CD is changed from the rest API:
> PUT api/vms/xxx/cdroms/yyy;current=True
> 
> <cdrom id="xxx">
>     <file id="zzz.iso"/>
> </cdrom>
> 
> and getting status 200, 
> 
> trying to verify the change, and senging PUT api/vms/xxx/cdroms/yyy

PUT is update, did you mean GET?

> 
> I'm getting 
> <cdrom id="xxx">
>     <file id="from_config.iso"/> --- instead of zzz.iso
> </cdrom>
> 
> 
> Version-Release number of selected component (if applicable):
> - Found on si24.1
> 
> How reproducible:
> every time
> 
> Steps to Reproduce:
> 1. see above
> 2.
> 3.
>   
> Actual results:
> Getting file from the config:
> psql -U postgres -d engine -c "select spec_params from vm_device where vm_id
> = 'd7fc1f3c-8933-4fc6-987b-ef36e40b5199' and device = 'cdrom';" | less -S
> 
> Expected results:
> to get the new CD

this is by design, new cd is for current session only and does not 
saved in the db (only passed to vdsm)

> 
> Additional info:

Comment 2 Barak Dagan 2012-11-15 14:00:57 UTC
(In reply to comment #1)
> (In reply to comment #0)
> > Description of problem:
> > After A CD is changed from the rest API:
> > PUT api/vms/xxx/cdroms/yyy;current=True
> > 
> > <cdrom id="xxx">
> >     <file id="zzz.iso"/>
> > </cdrom>
> > 
> > and getting status 200, 
> > 
> > trying to verify the change, and senging PUT api/vms/xxx/cdroms/yyy
> 
> PUT is update, did you mean GET?
> 
Yes that what I ment:

trying to verify the change, and senging GET api/vms/xxx/cdroms/yyy

> > 
> > I'm getting 
> > <cdrom id="xxx">
> >     <file id="from_config.iso"/> --- instead of zzz.iso
> > </cdrom>
> > 
> > 
> > Version-Release number of selected component (if applicable):
> > - Found on si24.1
> > 
> > How reproducible:
> > every time
> > 
> > Steps to Reproduce:
> > 1. see above
> > 2.
> > 3.
> >   
> > Actual results:
> > Getting file from the config:
> > psql -U postgres -d engine -c "select spec_params from vm_device where vm_id
> > = 'd7fc1f3c-8933-4fc6-987b-ef36e40b5199' and device = 'cdrom';" | less -S
> > 
> > Expected results:
> > to get the new CD
> 
> this is by design, new cd is for current session only and does not 
> saved in the db (only passed to vdsm)
> 
> > 
> > Additional info:

Comment 3 Oded Ramraz 2012-11-15 14:02:30 UTC
The problem is that there is no way to know which cdrom is currently attached to the VM. 
I have a VM which defined to use CD as second device and attach rhev-tools-setup.iso to it .
After running the VM and changing the CD to another one ( with  successful event: CD WindowsXP-sp2-vlk.iso was inserted to VM vm1 by vdcadmin ) I still get the original CD which attached to it , even when the VM is still up:

https://aqua-rhel.qa.lab.tlv.redhat.com/api/vms/d7fc1f3c-8933-4fc6-987b-ef36e40b5199/cdroms


<cdroms><cdrom href="/api/vms/d7fc1f3c-8933-4fc6-987b-ef36e40b5199/cdroms/00000000-0000-0000-0000-000000000000" id="00000000-0000-0000-0000-000000000000"><vm href="/api/vms/d7fc1f3c-8933-4fc6-987b-ef36e40b5199" id="d7fc1f3c-8933-4fc6-987b-ef36e40b5199"/><file id="rhev-tools-setup.iso"/></cdrom></cdroms>

The behavior should be same as display type or other dynamic fields.

Comment 4 Michael Pasternak 2012-11-15 18:50:15 UTC
*** Bug 877003 has been marked as a duplicate of this bug. ***

Comment 6 Itamar Heim 2013-06-02 07:54:44 UTC
Closing old bugs. If this issue is still relevant/important in current version, please re-open the bug.

Comment 7 Barak Dagan 2013-06-05 12:29:19 UTC
The bug is still there, could be nice if it is fixed in the near future.

Comment 9 Itamar Heim 2013-12-08 07:20:22 UTC
michael - is this in api or in backend in your view?

Comment 10 Michael Pasternak 2013-12-08 07:29:22 UTC
(In reply to Itamar Heim from comment #9)
> michael - is this in api or in backend in your view?

both, we need to make the engine being able differentiating between the runtime
and config representation of the entity, vm is a good example cause it has
RunOnce where config is not persistent (cdrom is a part of vm btw)

and api to be able showing both of them (in a generic form of course by adding extra url param).

Comment 11 Martin Betak 2014-01-30 10:00:30 UTC

*** This bug has been marked as a duplicate of bug 1014039 ***