Jump to: navigation, search

Difference between revisions of "Occi"

Line 28: Line 28:
 
export TEN_ID=<tenant ID>
 
export TEN_ID=<tenant ID>
 
</nowiki></pre>
 
</nowiki></pre>
 
  
 
=== Get a valid Tenant User ===
 
=== Get a valid Tenant User ===
Line 35: Line 34:
 
export OS_USER=<open stack user name>
 
export OS_USER=<open stack user name>
 
</nowiki></pre>
 
</nowiki></pre>
 
  
 
Note: this requirement will go by having an OCCI-specific authentication middleware
 
Note: this requirement will go by having an OCCI-specific authentication middleware
Line 41: Line 39:
 
=== See What Can be Provisioned ===
 
=== See What Can be Provisioned ===
 
The following command will use the query interface to query the capabilities of the service provider:
 
The following command will use the query interface to query the capabilities of the service provider:
 +
  
 
<pre><nowiki>
 
<pre><nowiki>
 
curl -v -H 'X-Auth-Token: '$KID -H 'X-Auth-Tenant-Id: '$TEN_ID -H 'X-Auth-User: '$OS_USER -X GET localhost:8787/-/
 
curl -v -H 'X-Auth-Token: '$KID -H 'X-Auth-Tenant-Id: '$TEN_ID -H 'X-Auth-User: '$OS_USER -X GET localhost:8787/-/
 
</nowiki></pre>
 
</nowiki></pre>
 
  
 
=== Create a VM ===
 
=== Create a VM ===
Line 52: Line 50:
 
curl -v -X POST localhost:8787/compute/ -H 'Category: compute; scheme="http://schemas.ogf.org/occi/infrastructure#"; class="kind"' -H 'Content-Type: text/occi' -H 'X-Auth-Token: '$KID -H 'X-Auth-Tenant-Id: '$TEN_ID -H 'X-Auth-User: '$OS_USER -H 'Category: m1.tiny; scheme="http://schemas.openstack.org/template/resource#"; class="mixin"' -H 'Category: cirros-0.3.0-x86_64-blank; scheme="http://schemas.openstack.org/template/os#"; class="mixin"'
 
curl -v -X POST localhost:8787/compute/ -H 'Category: compute; scheme="http://schemas.ogf.org/occi/infrastructure#"; class="kind"' -H 'Content-Type: text/occi' -H 'X-Auth-Token: '$KID -H 'X-Auth-Tenant-Id: '$TEN_ID -H 'X-Auth-User: '$OS_USER -H 'Category: m1.tiny; scheme="http://schemas.openstack.org/template/resource#"; class="mixin"' -H 'Category: cirros-0.3.0-x86_64-blank; scheme="http://schemas.openstack.org/template/os#"; class="mixin"'
 
</nowiki></pre>
 
</nowiki></pre>
 
  
 
For ease of this OCCI exercise, place the VM id into a shell variable e.g.
 
For ease of this OCCI exercise, place the VM id into a shell variable e.g.
Line 60: Line 57:
 
export VM=d54b4344-16be-486a-9871-2c566ef2263d
 
export VM=d54b4344-16be-486a-9871-2c566ef2263d
 
</nowiki></pre>
 
</nowiki></pre>
 
  
 
=== Get a Listing of VMs ===
 
=== Get a Listing of VMs ===
 
  
 
<pre><nowiki>
 
<pre><nowiki>
 
curl -v -X GET localhost:8787/compute/ -H 'Content-Type: text/occi' -H 'X-Auth-Token: '$KID -H 'X-Auth-Tenant-Id: '$TEN_ID -H 'X-Auth-User: '$OS_USER
 
curl -v -X GET localhost:8787/compute/ -H 'Content-Type: text/occi' -H 'X-Auth-Token: '$KID -H 'X-Auth-Tenant-Id: '$TEN_ID -H 'X-Auth-User: '$OS_USER
 
</nowiki></pre>
 
</nowiki></pre>
 
  
 
=== Get an Individual VM's Details ===
 
=== Get an Individual VM's Details ===
 
  
 
<pre><nowiki>
 
<pre><nowiki>
 
curl -v -X GET localhost:8787/compute/$VM -H 'Content-Type: text/occi' -H 'X-Auth-Token: '$KID -H 'X-Auth-Tenant-Id: '$TEN_ID -H 'X-Auth-User: '$OS_USER
 
curl -v -X GET localhost:8787/compute/$VM -H 'Content-Type: text/occi' -H 'X-Auth-Token: '$KID -H 'X-Auth-Tenant-Id: '$TEN_ID -H 'X-Auth-User: '$OS_USER
 
</nowiki></pre>
 
</nowiki></pre>
 
  
 
=== Execute a Stop Action Upon a VM ===
 
=== Execute a Stop Action Upon a VM ===
Line 83: Line 75:
 
curl -v -X POST "localhost:8787/compute/$VM?action=stop" -H 'Content-Type: text/occi' -H 'X-Auth-Token: '$KID -H 'X-Auth-Tenant-Id: '$TEN_ID -H 'X-Auth-User: '$OS_USER -H 'Category: stop; scheme="http://schemas.ogf.org/occi/infrastructure/compute/action#"; class="action"'
 
curl -v -X POST "localhost:8787/compute/$VM?action=stop" -H 'Content-Type: text/occi' -H 'X-Auth-Token: '$KID -H 'X-Auth-Tenant-Id: '$TEN_ID -H 'X-Auth-User: '$OS_USER -H 'Category: stop; scheme="http://schemas.ogf.org/occi/infrastructure/compute/action#"; class="action"'
 
</nowiki></pre>
 
</nowiki></pre>
 
  
 
=== Execute a Start Action Upon a VM ===
 
=== Execute a Start Action Upon a VM ===
Line 90: Line 81:
 
curl -v -X POST localhost:8787/compute/$VM?action=start -H 'Content-Type: text/occi' -H 'X-Auth-Token: '$KID -H 'X-Auth-Tenant-Id: '$TEN_ID -H 'X-Auth-User: '$OS_USER -H 'Category: start; scheme="http://schemas.ogf.org/occi/infrastructure/compute/action#"; class="action"'
 
curl -v -X POST localhost:8787/compute/$VM?action=start -H 'Content-Type: text/occi' -H 'X-Auth-Token: '$KID -H 'X-Auth-Tenant-Id: '$TEN_ID -H 'X-Auth-User: '$OS_USER -H 'Category: start; scheme="http://schemas.ogf.org/occi/infrastructure/compute/action#"; class="action"'
 
</nowiki></pre>
 
</nowiki></pre>
 
  
 
=== Scale Up a VM ===
 
=== Scale Up a VM ===
Line 99: Line 89:
 
curl -v -X POST localhost:8787/compute/$VM -H 'Content-Type: text/occi' -H 'X-Auth-Token: '$KID -H 'X-Auth-Tenant-Id: '$TEN_ID -H 'X-Auth-User: '$OS_USER -H 'Category: m1.tiny; scheme="http://schemas.openstack.org/template/resource#"; class="mixin"'
 
curl -v -X POST localhost:8787/compute/$VM -H 'Content-Type: text/occi' -H 'X-Auth-Token: '$KID -H 'X-Auth-Tenant-Id: '$TEN_ID -H 'X-Auth-User: '$OS_USER -H 'Category: m1.tiny; scheme="http://schemas.openstack.org/template/resource#"; class="mixin"'
 
</nowiki></pre>
 
</nowiki></pre>
 
  
 
=== Confirm the Scaled Up VM ===
 
=== Confirm the Scaled Up VM ===
Line 106: Line 95:
 
curl -v -X POST "localhost:8787/compute/$VM?action=confirm_resize" -H 'Content-Type: text/occi' -H 'X-Auth-Token: '$KID -H 'X-Auth-Tenant-Id: '$TEN_ID -H 'X-Auth-User: '$OS_USER -H 'Category: confirm_resize; scheme="http://schemas.openstack.org/instance/action#"; class="action"'
 
curl -v -X POST "localhost:8787/compute/$VM?action=confirm_resize" -H 'Content-Type: text/occi' -H 'X-Auth-Token: '$KID -H 'X-Auth-Tenant-Id: '$TEN_ID -H 'X-Auth-User: '$OS_USER -H 'Category: confirm_resize; scheme="http://schemas.openstack.org/instance/action#"; class="action"'
 
</nowiki></pre>
 
</nowiki></pre>
 
  
 
=== Delete a VM ===
 
=== Delete a VM ===
Line 113: Line 101:
 
curl -v -X DELETE localhost:8787/compute/$VM -H 'Content-Type: text/occi' -H 'X-Auth-Token: '$KID -H 'X-Auth-Tenant-Id: '$TEN_ID -H 'X-Auth-User: '$OS_USER
 
curl -v -X DELETE localhost:8787/compute/$VM -H 'Content-Type: text/occi' -H 'X-Auth-Token: '$KID -H 'X-Auth-Tenant-Id: '$TEN_ID -H 'X-Auth-User: '$OS_USER
 
</nowiki></pre>
 
</nowiki></pre>
 
  
 
== Release Note ==
 
== Release Note ==
Line 119: Line 106:
  
 
== Implementation ==
 
== Implementation ==
The integration will use the pyssf software package which delivers a OCCI WSGI application. This code will be used to integrate the OCCI interface.
+
The integration will use the [http://pyssf.sf.net pyssf] software package which delivers a OCCI WSGI application. This code will be used to integrate the OCCI interface.
  
 
=== UI Changes ===
 
=== UI Changes ===

Revision as of 09:08, 1 March 2012

  • Launchpad Entry: NovaSpec:bexar-open-cloud-compute-interface
  • Created: 11/10/2010
  • Contributors: Thijs Metsch (tmetsch), Andy Edmonds (dizz)

Summary

This will implement the Open Cloud Computing Interface (OCCI) within nova/api. The specification of OCCI can be found here: http://www.occi-wg.org

Implementation details

The OCCI interface is integrated using an WSGI application - it can coexist to the current APIs but offers a rich, flexible interoperable way to interact with OpenStack through a standardized interface.

How to use the OCCI interface

The following sections demonstrate how OCCI can be used - it just shows the general operations - not the full feature set.

Get Authentication Credentials from Keystone

{
curl -d '{"auth":{"passwordCredentials":{"username": "admin", "password": "<password>"

' -H "Content-type: application/json" export $KID=<Token from Keystone> </nowiki></pre> }

Get the Tenant ID from OpenStack

There are two ways to get your Tenant id: through the dashboard or the command line. After retrieving it:


export TEN_ID=<tenant ID>

Get a valid Tenant User

export OS_USER=<open stack user name>

Note: this requirement will go by having an OCCI-specific authentication middleware

See What Can be Provisioned

The following command will use the query interface to query the capabilities of the service provider:


curl -v -H 'X-Auth-Token: '$KID -H 'X-Auth-Tenant-Id: '$TEN_ID -H 'X-Auth-User: '$OS_USER -X GET localhost:8787/-/

Create a VM

curl -v -X POST localhost:8787/compute/ -H 'Category: compute; scheme="http://schemas.ogf.org/occi/infrastructure#"; class="kind"' -H 'Content-Type: text/occi' -H 'X-Auth-Token: '$KID -H 'X-Auth-Tenant-Id: '$TEN_ID -H 'X-Auth-User: '$OS_USER -H 'Category: m1.tiny; scheme="http://schemas.openstack.org/template/resource#"; class="mixin"' -H 'Category: cirros-0.3.0-x86_64-blank; scheme="http://schemas.openstack.org/template/os#"; class="mixin"'

For ease of this OCCI exercise, place the VM id into a shell variable e.g.


export VM=d54b4344-16be-486a-9871-2c566ef2263d

Get a Listing of VMs

curl -v -X GET localhost:8787/compute/ -H 'Content-Type: text/occi' -H 'X-Auth-Token: '$KID -H 'X-Auth-Tenant-Id: '$TEN_ID -H 'X-Auth-User: '$OS_USER

Get an Individual VM's Details

curl -v -X GET localhost:8787/compute/$VM -H 'Content-Type: text/occi' -H 'X-Auth-Token: '$KID -H 'X-Auth-Tenant-Id: '$TEN_ID -H 'X-Auth-User: '$OS_USER

Execute a Stop Action Upon a VM

curl -v -X POST "localhost:8787/compute/$VM?action=stop" -H 'Content-Type: text/occi' -H 'X-Auth-Token: '$KID -H 'X-Auth-Tenant-Id: '$TEN_ID -H 'X-Auth-User: '$OS_USER -H 'Category: stop; scheme="http://schemas.ogf.org/occi/infrastructure/compute/action#"; class="action"'

Execute a Start Action Upon a VM

curl -v -X POST localhost:8787/compute/$VM?action=start -H 'Content-Type: text/occi' -H 'X-Auth-Token: '$KID -H 'X-Auth-Tenant-Id: '$TEN_ID -H 'X-Auth-User: '$OS_USER -H 'Category: start; scheme="http://schemas.ogf.org/occi/infrastructure/compute/action#"; class="action"'

Scale Up a VM

Scalling up the VM from m1.tiny (128 RAM, 1 Core) to a m1.tiny flavour (256 RAM, 1 Core).


curl -v -X POST localhost:8787/compute/$VM -H 'Content-Type: text/occi' -H 'X-Auth-Token: '$KID -H 'X-Auth-Tenant-Id: '$TEN_ID -H 'X-Auth-User: '$OS_USER -H 'Category: m1.tiny; scheme="http://schemas.openstack.org/template/resource#"; class="mixin"'

Confirm the Scaled Up VM

curl -v -X POST "localhost:8787/compute/$VM?action=confirm_resize" -H 'Content-Type: text/occi' -H 'X-Auth-Token: '$KID -H 'X-Auth-Tenant-Id: '$TEN_ID -H 'X-Auth-User: '$OS_USER -H 'Category: confirm_resize; scheme="http://schemas.openstack.org/instance/action#"; class="action"'

Delete a VM

curl -v -X DELETE localhost:8787/compute/$VM -H 'Content-Type: text/occi' -H 'X-Auth-Token: '$KID -H 'X-Auth-Tenant-Id: '$TEN_ID -H 'X-Auth-User: '$OS_USER

Release Note

TBD

Implementation

The integration will use the pyssf software package which delivers a OCCI WSGI application. This code will be used to integrate the OCCI interface.

UI Changes

Does not affect any GUI elements.

Code Changes

These are the changes we would love to see in the OpenStack compute api:

  • Specify the size of a volume as float
  • A way to retrieve the speed of an CPU

Migration

  • N/A

Test/Demo Plan

Unittests have been implemented and will be extended. Code is checked on a regularly basis to verify it meets the OpenStack coding guidelines.

Unresolved issues

  • N/A