Bug 890329 - REST-API: adding host specifying cluster by-name is not supported
REST-API: adding host specifying cluster by-name is not supported
Status: CLOSED CURRENTRELEASE
Product: Red Hat Enterprise Virtualization Manager
Classification: Red Hat
Component: ovirt-engine-restapi (Show other bugs)
3.1.0
Unspecified Unspecified
medium Severity unspecified
: ---
: 3.2.0
Assigned To: Ravi Nori
Barak Dagan
infra
:
Depends On:
Blocks: 915537 917401
  Show dependency treegraph
 
Reported: 2012-12-26 07:33 EST by Barak Dagan
Modified: 2016-02-10 14:32 EST (History)
9 users (show)

See Also:
Fixed In Version: sf9
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed:
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: Infra
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
oVirt gerrit 10726 None None None Never
oVirt gerrit 11947 None None None Never

  None (edit)
Description Barak Dagan 2012-12-26 07:33:48 EST
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 07:36:38 EST
Barak, can you elaborate please, i've failed to understand your comment.
Comment 2 Barak Dagan 2012-12-26 07:48:16 EST
(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 07:59:42 EST
(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 10:08:19 EST
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 02:31:44 EST
(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 02:35:15 EST
Ravi,

Does patch from the Comment 5 covers all mentioned gaps?
Comment 8 Ravi Nori 2013-01-08 08:44:31 EST
(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 12:52:28 EST
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 16:58:06 EST
update vm can already use placement_policy host id or name
Comment 11 Barak Dagan 2013-02-12 10:31:35 EST
(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 04:34:56 EST
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 08:13:28 EDT
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 04:47:19 EDT
3.2 has been released
Comment 17 Itamar Heim 2013-06-11 04:47:19 EDT
3.2 has been released
Comment 18 Itamar Heim 2013-06-11 04:47:30 EDT
3.2 has been released
Comment 19 Itamar Heim 2013-06-11 04:52:52 EDT
3.2 has been released
Comment 20 Itamar Heim 2013-06-11 05:23:32 EDT
3.2 has been released

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