Bug 773347

Summary: document rhevm api queries
Product: [Retired] CloudForms Cloud Engine Reporter: Dave Johnson <dajohnso>
Component: DocumentationAssignee: Dan Macpherson <dmacpher>
Status: CLOSED CURRENTRELEASE QA Contact: wes hayutin <whayutin>
Severity: high Docs Contact:
Priority: unspecified    
Version: 1.0.0CC: akarol, deltacloud-maint, dgao, dmacpher, lbrindle, matt.wagner, morazi, rwsu, slinaber, ssachdev
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-06-07 06:26:07 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Dave Johnson 2012-01-11 15:32:59 UTC
Description of problem:
================================
There is now two instances where the user needs to query the rhevm api to get a id value that is not visible in the rhevm ui... initially configuring for rhevm and while importing an existing rhevm image.  

Assuming atleast some users will not know how to do this, we may want to have a brief section in the docs concerning this with perhaps a note/link to the section in the rhevm configure and rhevm image import help.

Querying the api is pretty easy, it can be logged into just like a normal website.  When prompted for credentials the user field would be in the format of 'username@rhevm_domain'.  This can also be accomplished using command line tools like 'curl'.

In the case of initially configuring for rhevm, a data center id is needed.  The user would need to go to /api/datacenters, find the name and get its id value.

    <data_centers>
      <data_center id="4c96c74b-f8b6-4c8f-aa84-a55770839b85" 
                   href="/api/datacenters/4c96c74b-f8b6-4c8f-aa84-a55770839b85">
        <name>blade27</name>
        <description/>

In the case of needing a template id...query /api/templates

    <templates>
      <template id="05618eb5-23e2-4d62-97c5-1d97fc9ab2d5" 
                href="/api/templates/05618eb5-23e2-4d62-97c5-1d97fc9ab2d5">
        <name>rhel_6.2</name>


curl commandline examples:
  curl https://rhevm.redhat.com:8443/api/datacenters --user user@rhevm_domain:password
  curl https://rhevm.redhat.com:8443/api/datacenters?search=name%3Draleigh --user user@rhevm_domain:password
  curl https://rhevm.redhat.com:8443/api/templates --user user@rhevm_domain:password
  curl https://rhevm.redhat.com:8443/api/templates?search=name%3Drhel_6.2 --user user@rhevm_domain:password

Comment 1 Richard Su 2012-01-24 17:12:55 UTC
I'll add notes in the rhevm_configure file to indicate how one can query the REST API to find the data center id.

Comment 2 Matt Wagner 2012-01-26 20:07:32 UTC
I borrowed heavily and put this up on the wiki as well: https://www.aeolusproject.org/redmine/projects/aeolus/wiki/Using_the_RHEV-M_API

Comment 3 Richard Su 2012-01-26 21:36:17 UTC
Added notes to rhevm_configure file in aeolus-configure and to -h and man pages in aeolus-image in aeolus-cli.

aeolus-cli
commit 34f1157f72d6fc841279de0f016ce9c61f7ed1e1
commit 79ddbf9ba33016f9faa252d0bad88e9c46e07815

aeolus-configure 
commit 2c03adda7cf16a4418b5b1974c8a6cb948a0db27
commit 06d74bcba7cb51baf4226390288d8242bcab4a07

Comment 4 Steve Linabery 2012-01-27 06:39:02 UTC
34f1157  79ddbf9 in rubygem-aeolus-cli-0.3.0-6
pending new build on aeolus-configure

Comment 7 Dave Johnson 2012-02-02 15:02:12 UTC
I hate to re-open for this nit pick...

Datacenters:
Querying Data Center UUIDs
To search for template with....   <-- I think you meant datacenter

Comment 9 Dave Johnson 2012-02-03 14:33:26 UTC
good 2 go

Comment 10 Lana Brindley 2012-06-07 06:26:07 UTC
Document is now available on docs.redhat.com. Please raise a new bug for any further issues.

LKB