Bug 854365

Summary: ovirt-engine-cli : need to remove cdrom option from optional entities to create
Product: Red Hat Enterprise Virtualization Manager Reporter: Oded Ramraz <oramraz>
Component: ovirt-engine-cliAssignee: Michael Pasternak <mpastern>
Status: CLOSED DUPLICATE QA Contact: Oded Ramraz <oramraz>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 3.1.0CC: bazulay, dyasny, ecohen, iheim, Rhev-m-bugs, sgrinber, ykaul
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-09-10 09:16:16 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 Oded Ramraz 2012-09-04 18:33:43 UTC
Description of problem:

There is an option to create CDROM using RHEVM shell , this option is documented in the CLI guide as well . 
I'm not familiar with such option in UI . Maybe it attach CDROM to VM ( need to be done as action ) , or set default CDROM for a VM .
Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1.
2.
3.
  
Actual results:


Expected results:


Additional info:

## from the documentation 

Use the create cdrom command to create a new virtual CD-ROM for your installation media. Add the vm-identifier option to attach the CD-ROM as a sub-resource of MyVM.

[oVirt shell (connected)]# create cdrom --vm-identifier MyVM --file-id rhel-server-6.0-x86_64-dvd.iso

[RHEVM shell (connected)]# create cdrom --vm-identifier 
correlation_id  expect          file-id         vm

Comment 1 Michael Pasternak 2012-09-05 07:27:38 UTC
attach of cdrom in api done via CREATE in /api/vms/xxx/cdroms,
same in sdk/cli -> create cdrom --vm-identifier xxx --file-id yyy

Comment 2 Oded Ramraz 2012-09-05 07:36:58 UTC
What exactly the CLI create ? We have two possible ways to decide which cdrom the VM will run with:
1. During VM creation / update VM 
2. Using Change CD 

We don't have any way to create "floating" cdrom using RHEVM , I think the current behavior and documentation is misleading . 

(In reply to comment #1)
> attach of cdrom in api done via CREATE in /api/vms/xxx/cdroms,
> same in sdk/cli -> create cdrom --vm-identifier xxx --file-id yyy

Comment 3 Michael Pasternak 2012-09-05 09:16:31 UTC
(In reply to comment #2)
> What exactly the CLI create ? We have two possible ways to decide which
> cdrom the VM will run with:

oded, please see previous comment, it's not cli, it's the api structure
-> to add resource to collection, you CREATE it in this collection
-> CREATE in /api/vms/xxx/cdroms

> 1. During VM creation / update VM 
> 2. Using Change CD 
> 
> We don't have any way to create "floating" cdrom using RHEVM , I think the
> current behavior and documentation is misleading . 
> 
> (In reply to comment #1)
> > attach of cdrom in api done via CREATE in /api/vms/xxx/cdroms,
> > same in sdk/cli -> create cdrom --vm-identifier xxx --file-id yyy

Comment 4 Simon Grinberg 2012-09-05 09:23:03 UTC
I understand the confusion, however the CLI concept (concepts are to late to change) is to be compatible with the API.

In the API, to place an entity into sub collection is to create it there. What you are creating is a reference (in case of an existing object like a disk) or an object that must reside in a collection (Like nics or CDROM) 

So CDROM is a collection:
https://rhevm31.mylaptop.redhat.com/api/vms/7cfd0163-422c-4fdf-869e-37378a754761/cdroms

And you create a CDROM in the collection context, the same as you do for Nics

<cdroms><cdrom href="/api/vms/7cfd0163-422c-4fdf-869e-37378a754761/cdroms/00000000-0000-0000-0000-000000000000" id="00000000-0000-0000-0000-000000000000"><vm href="/api/vms/7cfd0163-422c-4fdf-869e-37378a754761" id="7cfd0163-422c-4fdf-869e-37378a754761"/><file id="AnyDisk.iso"/></cdrom></cdroms>


Michael, 
What I'm missing is the actions Change and Eject
Is this achieved by updating the fileid?

I think this is the confusing part. 

Reopening,
Michael, I guess to add those you'll actually need to move it to the REST, right? 

If it can't be done then in any case this bug will need documentation.

Comment 6 Michael Pasternak 2012-09-05 12:04:41 UTC
> Michael, 
> What I'm missing is the actions Change and Eject
> Is this achieved by updating the fileid?

change is UPDATE
eject is a DELETE

* same as in any other api resource

> 
> I think this is the confusing part. 
> 
> Reopening,
> Michael, I guess to add those you'll actually need to move it to the REST,
> right? 
> 
> If it can't be done then in any case this bug will need documentation.

Comment 7 Michael Pasternak 2012-09-05 12:05:35 UTC
btw cdrom is not a property by <cdrom> resource in <cdroms> collection

Comment 8 Simon Grinberg 2012-09-05 13:53:47 UTC
(In reply to comment #6)
> > Michael, 
> > What I'm missing is the actions Change and Eject
> > Is this achieved by updating the fileid?
> 
> change is UPDATE
> eject is a DELETE
> 

This is confusing, since eject will not remove the CDROM device from the VM

While the concept may work well with other sub-collections, I think we need Eject/Change CD are in order for the CLI.

Don't forget that the CLI is the UI equivalent, it has to be user friendly. 
So if it requires the API to provide those actions so be it.

Comment 9 Michael Pasternak 2012-09-05 14:18:29 UTC
(In reply to comment #8)
> (In reply to comment #6)
> > > Michael, 
> > > What I'm missing is the actions Change and Eject
> > > Is this achieved by updating the fileid?
> > 
> > change is UPDATE
> > eject is a DELETE
> > 
> 
> This is confusing, since eject will not remove the CDROM device from the VM

i don't know what the 'eject' is, this is GUI term,

in api:

UPDATE -> VdcActionType.ChangeDisk
DELETE -> removes CD from vm

* this is documented since 2.3 api

what is works perfectly well from REST/sdk/cli collection concept PoV,
don't forget that in real world cdrom is vm property, but in api we have
collection of cdroms ...

Comment 10 Oded Ramraz 2012-09-10 06:24:13 UTC
Decided to add new command : "add" in order to add cdrom to existing VM , instead of the former "create" operation .

Comment 11 Yaniv Kaul 2012-09-10 06:26:51 UTC
(In reply to comment #9)
> (In reply to comment #8)
> > (In reply to comment #6)
> > > > Michael, 
> > > > What I'm missing is the actions Change and Eject
> > > > Is this achieved by updating the fileid?
> > > 
> > > change is UPDATE
> > > eject is a DELETE
> > > 
> > 
> > This is confusing, since eject will not remove the CDROM device from the VM
> 
> i don't know what the 'eject' is, this is GUI term,

Correction - 'eject' is the term humans uses to EJECT a CD. GUI, Documentation, in writing and when people talk to each other.
'remove' is also sometimes used, but less often. 
Never heard of anyone referring to that action as 'delete'.

> 
> in api:
> 
> UPDATE -> VdcActionType.ChangeDisk
> DELETE -> removes CD from vm
> 
> * this is documented since 2.3 api
> 
> what is works perfectly well from REST/sdk/cli collection concept PoV,
> don't forget that in real world cdrom is vm property, but in api we have
> collection of cdroms ...

Comment 12 Michael Pasternak 2012-09-10 06:32:01 UTC
Oded, we did not agreed on this change on yesterday's meeting.

Comment 13 Michael Pasternak 2012-09-10 06:33:47 UTC
(In reply to comment #10)
> Decided to add new command : "add" in order to add cdrom to existing VM ,
> instead of the former "create" operation .

we decided not to add new 'add' command for the cdrom, but rename existent
'create' to 'add'

Comment 14 Michael Pasternak 2012-09-10 06:36:13 UTC
(In reply to comment #11)
> (In reply to comment #9)
> > (In reply to comment #8)
> > > (In reply to comment #6)
> > > > > Michael, 
> > > > > What I'm missing is the actions Change and Eject
> > > > > Is this achieved by updating the fileid?
> > > > 
> > > > change is UPDATE
> > > > eject is a DELETE
> > > > 
> > > 
> > > This is confusing, since eject will not remove the CDROM device from the VM
> > 
> > i don't know what the 'eject' is, this is GUI term,
> 
> Correction - 'eject' is the term humans uses to EJECT a CD. GUI,
> Documentation, in writing and when people talk to each other.
> 'remove' is also sometimes used, but less often. 
> Never heard of anyone referring to that action as 'delete'.

i don't mind renaming 'delete' to 'remove' if you find it better,
please file+approve new bug,

thanks.

> 
> > 
> > in api:
> > 
> > UPDATE -> VdcActionType.ChangeDisk
> > DELETE -> removes CD from vm
> > 
> > * this is documented since 2.3 api
> > 
> > what is works perfectly well from REST/sdk/cli collection concept PoV,
> > don't forget that in real world cdrom is vm property, but in api we have
> > collection of cdroms ...

Comment 15 Oded Ramraz 2012-09-10 09:16:16 UTC

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