Difference between revisions of "Occi"
(added details on implementation.) |
|||
Line 5: | Line 5: | ||
== Summary == | == Summary == | ||
− | This will implement the | + | 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 == | == 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 === | |
− | + | <pre><nowiki>{ | |
− | + | curl -d '{"auth":{"passwordCredentials":{"username": "admin", "password": "<password>"</nowiki></pre> | |
− | + | ' -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: | ||
− | |||
− | |||
− | + | <pre><nowiki> | |
+ | export TEN_ID=<tenant ID> | ||
+ | </nowiki></pre> | ||
+ | |||
+ | |||
+ | === Get a valid Tenant User === | ||
+ | |||
+ | <pre><nowiki> | ||
+ | export OS_USER=<open stack user name> | ||
+ | </nowiki></pre> | ||
+ | |||
+ | |||
+ | 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: | ||
+ | |||
+ | <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/-/ | ||
+ | </nowiki></pre> | ||
+ | |||
+ | |||
+ | === Create a VM === | ||
+ | |||
+ | <pre><nowiki> | ||
+ | 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> | ||
+ | |||
+ | |||
+ | For ease of this OCCI exercise, place the VM id into a shell variable e.g. | ||
+ | |||
+ | |||
+ | <pre><nowiki> | ||
+ | export VM=d54b4344-16be-486a-9871-2c566ef2263d | ||
+ | </nowiki></pre> | ||
+ | |||
+ | |||
+ | === Get a Listing of VMs === | ||
+ | |||
+ | |||
+ | <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 | ||
+ | </nowiki></pre> | ||
+ | |||
+ | |||
+ | === Get an Individual VM's Details === | ||
+ | |||
+ | |||
+ | <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 | ||
+ | </nowiki></pre> | ||
+ | |||
+ | |||
+ | === Execute a Stop Action Upon a VM === | ||
+ | |||
+ | <pre><nowiki> | ||
+ | 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> | ||
+ | |||
+ | |||
+ | === Execute a Start Action Upon a VM === | ||
+ | |||
+ | <pre><nowiki> | ||
+ | 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> | ||
+ | |||
+ | |||
+ | === Scale Up a VM === | ||
+ | Scalling up the VM from m1.tiny (128 RAM, 1 Core) to a m1.tiny flavour (256 RAM, 1 Core). | ||
+ | |||
+ | |||
+ | <pre><nowiki> | ||
+ | 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> | ||
+ | |||
+ | |||
+ | === Confirm the Scaled Up VM === | ||
+ | |||
+ | <pre><nowiki> | ||
+ | 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> | ||
+ | |||
+ | |||
+ | === Delete a VM === | ||
+ | |||
+ | <pre><nowiki> | ||
+ | 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> | ||
+ | |||
− | == | + | == Release Note == |
− | + | TBD | |
− | |||
− | |||
− | |||
== Implementation == | == Implementation == | ||
− | This | + | 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 === | === UI Changes === | ||
− | + | Does not affect any GUI elements. | |
=== Code Changes === | === 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 === | === Migration === | ||
− | + | * N/A | |
− | |||
− | * | ||
− | |||
− | |||
== Test/Demo Plan == | == 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 == | == Unresolved issues == | ||
− | + | * N/A | |
− | |||
− | |||
− | |||
---- | ---- | ||
[[Category:Spec]] [[Category:Nova]] | [[Category:Spec]] [[Category:Nova]] |
Revision as of 09:06, 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