Bug 890329 - REST-API: adding host specifying cluster by-name is not supported
Summary: REST-API: adding host specifying cluster by-name is not supported
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise Virtualization Manager
Classification: Red Hat
Component: ovirt-engine-restapi
Version: 3.1.0
Hardware: Unspecified
OS: Unspecified
medium
unspecified
Target Milestone: ---
: 3.2.0
Assignee: Ravi Nori
QA Contact: Barak Dagan
URL:
Whiteboard: infra
Depends On:
Blocks: 915537 917401
TreeView+ depends on / blocked
 
Reported: 2012-12-26 12:33 UTC by Barak Dagan
Modified: 2016-02-10 19:32 UTC (History)
9 users (show)

Fixed In Version: sf9
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed:
oVirt Team: Infra
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
oVirt gerrit 10726 0 None None None Never
oVirt gerrit 11947 0 None None None Never

Description Barak Dagan 2012-12-26 12:33:48 UTC
Description of problem:
* when performing action on an object there is an option to use both object name and id.
* add storagedomain - host-id|name
* add vm - template-id|name, cluster-id|name
* add cluster - data_center-id|name
* add network - data_center-id|name
* add snapshot - data_center-id|name
* add template - vm-id|name
* add vmpool - cluster-id|name, template-id|name

** list reveals only ids for objects of higher level
** add host - cluster-id

unknown error: not enough arguments for format string

[RHEVM shell (connected)]#

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


How reproducible:


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


Expected results:
to be able to use both name and id in all actions

Additional info:

Comment 1 Michael Pasternak 2012-12-26 12:36:38 UTC
Barak, can you elaborate please, i've failed to understand your comment.

Comment 2 Barak Dagan 2012-12-26 12:48:16 UTC
(In reply to comment #1)
> Barak, can you elaborate please, i've failed to understand your comment.

I'm trying to say that in some cases (*) one can use either id or name of higher level object, but in other cases (**) only the id is given or can be used, for example, when adding host - cluster name is not available as a parameter - only cluster id is, which is not as intuitive as the name. I'm sure that there are more examples, which I don't remember at the moment, but will add when I find them.

Comment 3 Michael Pasternak 2012-12-26 12:59:42 UTC
(In reply to comment #2)
> (In reply to comment #1)
> > Barak, can you elaborate please, i've failed to understand your comment.
> 
> I'm trying to say that in some cases (*) one can use either id or name of
> higher level object, but in other cases (**) only the id is given or can be
> used, for example, when adding host - cluster name is not available as a
> parameter - only cluster id is, which is not as intuitive as the name. I'm
> sure that there are more examples, which I don't remember at the moment, but
> will add when I find them.

this is not related to cli, this is api gaps, you more then welcome file
bugs against api on this.

Comment 5 Ravi Nori 2013-01-07 15:08:19 UTC
link : http://gerrit.ovirt.org/#/c/10726/

change id : I6b8268b016d83f3a963774b097f78f980503e8dd

I could not find other cases where we need to expose both name and id. Please lust them if you find any

Comment 6 Michael Pasternak 2013-01-08 07:31:44 UTC
(In reply to comment #5)
> I could not find other cases where we need to expose both name and id.
> Please lust them if you find any

this is basic RESTapi principal that in params resource can be referenced by
both id/name, if you see that this is not a case - this is gap.

Comment 7 Michael Pasternak 2013-01-08 07:35:15 UTC
Ravi,

Does patch from the Comment 5 covers all mentioned gaps?

Comment 8 Ravi Nori 2013-01-08 13:44:31 UTC
(In reply to comment #7)
> Ravi,
> 
> Does patch from the Comment 5 covers all mentioned gaps?

Yes as far I can see this patch closes the mentioned gaps.

Comment 9 Barak Dagan 2013-02-11 17:52:28 UTC
on sf6.
Add host can use cluster name as well.

* update host can use cluster id and not cluster name.
* update vm can use placement_policy-host-id and not placement_policy-host-name

Comment 10 Ravi Nori 2013-02-11 21:58:06 UTC
update vm can already use placement_policy host id or name

Comment 11 Barak Dagan 2013-02-12 15:31:35 UTC
(In reply to comment #10)
> update vm can already use placement_policy host id or name

Right I missed it in the interface. So we are left with update host

Comment 12 Barak Dagan 2013-03-04 09:34:56 UTC
Verified on SF9, in both RSDL and CLI:

<link href="/api/hosts" rel="add">
<request>
<http_method>POST</http_method>
<headers>...</headers>
<body>
<type>Host</type>
<parameters_set>
...
<parameter required="true" type="xs:string">
<name>host.cluster.id|name</name>


<link href="/api/hosts/{host:id}" rel="update">
<request>
<http_method>PUT</http_method>
<headers>...</headers>
<url>...</url>
<body>
<type>Host</type>
<parameters_set>
...
<parameter required="false" type="xs:string">
<name>host.cluster.id|name</name>



[RHEVM shell (connected)]# add host 
address                          name                             power_management-options-option  reboot_after_installation
cluster-id                       port                             power_management-password        root_password
cluster-name                     power_management-address         power_management-pm_proxy        storage_manager-priority
correlation_id                   power_management-agents-agent    power_management-type            value
expect                           power_management-enabled         power_management-user_name       

[RHEVM shell (connected)]# update host 
address                          port                             power_management-options-option  power_management-user_name
cluster-id                       power_management-address         power_management-password        root_password
correlation_id                   power_management-agents-agent    power_management-pm_proxy        storage_manager-priority
name                             power_management-enabled         power_management-type            value
[RHEVM shell (connected)]# update host

Comment 15 Barak Dagan 2013-03-21 12:13:28 UTC
Verify SF 10.1 (CLI):

[RHEVM shell (connected)]# add host 
address                          display-address                  power_management-address         power_management-password        reboot_after_installation
cluster-id                       expect                           power_management-agents-agent    power_management-pm_proxy        root_password
cluster-name                     name                             power_management-enabled         power_management-type            storage_manager-priority
correlation_id                   port                             power_management-options-option  power_management-user_name       value
[RHEVM shell (connected)]# update host 
address                          display-address                  power_management-agents-agent    power_management-pm_proxy        storage_manager-priority
cluster-id                       name                             power_management-enabled         power_management-type            value
cluster-name                     port                             power_management-options-option  power_management-user_name       
correlation_id                   power_management-address         power_management-password        root_password

Comment 16 Itamar Heim 2013-06-11 08:47:19 UTC
3.2 has been released

Comment 17 Itamar Heim 2013-06-11 08:47:19 UTC
3.2 has been released

Comment 18 Itamar Heim 2013-06-11 08:47:30 UTC
3.2 has been released

Comment 19 Itamar Heim 2013-06-11 08:52:52 UTC
3.2 has been released

Comment 20 Itamar Heim 2013-06-11 09:23:32 UTC
3.2 has been released


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