Upload
cesar-augusto-trujillo-marin
View
16
Download
0
Embed Size (px)
Citation preview
7/14/2019 ONE 3.8 Interfaces for Cloud Consumers(1)
http://slidepdf.com/reader/full/one-38-interfaces-for-cloud-consumers1 1/26
Interfaces for Cloud Consumers
OpenNebula 3.8
C12G Labs S.L.
Rev20121022
7/14/2019 ONE 3.8 Interfaces for Cloud Consumers(1)
http://slidepdf.com/reader/full/one-38-interfaces-for-cloud-consumers1 2/26
Copyright 2012 C12G Labs
Although the information in this document has been care-fully reviewed, C12G Labs does not warrant it to be free of errorsor omissions. C12G Labs reserves the right to make corrections,updates, revisions, or changes to the information in this document.
UNLESS OTHERWISE EXPRESSLY STATED BY C12GLABS THE SOFTWARE DESCRIBED IN THIS DOCUMENT
IS PROVIDED ON ”AS IS” BASIS, WITHOUT ANY WAR-RANTIES OF ANY KIND, INCLUDING, BUT NOT LIMITEDTO, WARRANTIES CONCERNING THE INSTALLATION,USE OR PERFORMANCE OF PRODUCT. C12G AND ITSSUPPLIERS DISCLAIM ANY AND ALL WARRANTIES,EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOTLIMITED TO ANY WARRANTY OF MERCHANTABIL-ITY FITNESS FOR A PARTICULAR PURPOSE AND/ORNON-INFRINGEMENT. C12G AND ITS SUPPLIERS DONOT WARRANT THAT PRODUCT WILL MEET USER’SREQUIREMENTS OR THAT THE OPERATION THEREOFWILL BE UNINTERRUPTED OR ERROR-FREE, OR THAT
ERRORS WILL BE CORRECTED. YOU ARE SOLELYRESPONSIBLE FOR DETERMINING THE APPROPRIATE-NESS OF USING THE WORK AND ASSUME ANY RISKSASSOCIATED WITH YOUR EXERCISE OF PERMISSIONSUNDER THIS LICENSE.
Document redistributionand translation
This document is protected by copyright and you may not re-distribute it or translate it intro another language, in part or inwhole.
Internal redistribution You may only redistribute this document internally within yourorganization (for example, on an intranet) provided that you con-tinue to check the C12G Labs Partner Portal site for updates andupdate your version of the documentation. You may not make itavailable to your organization over the Internet.
Trademarks C12G and OpenNebula are trademarks in the European Unionand are pending trademarks in the United States. All other tra-dermakrs are property of their respective owners. Other productor company names mentioned may be trademarks or trade namesof their respective companies.
7/14/2019 ONE 3.8 Interfaces for Cloud Consumers(1)
http://slidepdf.com/reader/full/one-38-interfaces-for-cloud-consumers1 3/26
Contents
1 Cloud Interfaces 5
1.1 OpenNebula OCCI User Guide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51.1.1 Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51.1.2 User Account Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61.1.3 Create resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.1.4 Updating resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81.1.5 OCCI GUI: OpenNebula Self-Service . . . . . . . . . . . . . . . . . . . . . . . . . . 121.2 OpenNebula EC2 User Guide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
1.2.1 User Account Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131.2.2 Hello Cloud! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2 References 15
2.1 OpenNebula EC2 Client Cheat Sheet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152.1.1 CLI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152.1.2 OCCI Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152.1.3 ECONE Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
2.2 EC2 Ecosystem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162.2.1 ElasticFox . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
2.2.2 Euca2ools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
3 Self-service Portal 22
3.1 Using OpenNebula Self-Service . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223.1.1 Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223.1.2 Considerations and limitations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233.1.3 Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
3.2 Customizing OpenNebula Self-Service . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243.2.1 Customizable options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243.2.2 Customizing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
C12G Labs S.L. 3/26 Rev20121022
7/14/2019 ONE 3.8 Interfaces for Cloud Consumers(1)
http://slidepdf.com/reader/full/one-38-interfaces-for-cloud-consumers1 4/26
C12G Labs S.L. 4/26 Rev20121022
7/14/2019 ONE 3.8 Interfaces for Cloud Consumers(1)
http://slidepdf.com/reader/full/one-38-interfaces-for-cloud-consumers1 5/26
Chapter 1
Cloud Interfaces
1.1 OpenNebula OCCI User Guide
The OpenNebula OCCI API1 is a RESTful service to create, control and monitor cloud resources usingan implementation of the OGF OCCI API specification based on the draft 0.8. This implementation alsoincludes some extensions, requested by the community, to support OpenNebula specific functionality.Interactions with the resources are done through HTTP2 verbs (GET, POST, PUT and DELETE).
inlinetoc
1.1.1 Commands
There are four kind of resources, listed below with their implemented actions:
Storage:
– occi-storage list [verbose]
– occi-storage create xml_template
– occi-storage update xml_template
– occi-storage show resource_id
– occi-storage delete resource_id
Network:
– occi-network list [verbose]
–occi-network create xml_template
– occi-network update xml_template
– occi-network show resource_id
– occi-network delete resource_id
Compute:
– occi-compute list [verbose]
– occi-compute create xml_template
– occi-compute update xml_template
– occi-compute show resource_id
– occi-compute delete resource_id
– occi-compute attachdisk resource_id storage_id
1Application Programming Interface2Hyper Text Transfer Protocol
C12G Labs S.L. 5/26 Rev20121022
7/14/2019 ONE 3.8 Interfaces for Cloud Consumers(1)
http://slidepdf.com/reader/full/one-38-interfaces-for-cloud-consumers1 6/26
– occi-compute detachdisk resource_id storage_id
Instance type:– occi-instance-type list [verbose]
– occi-instance-type show resource_id
1.1.2 User Account Configuration
An account is needed in order to use the OpenNebula OCCI cloud. The cloud administrator will beresponsible for assigning these accounts, which have a one to one correspondence with OpenNebulaaccounts, so all the cloud administrator has to do is check the managing users guide to setup accounts,and automatically the OpenNebula OCCI cloud account will be created.
In order to use such an account, the end user can make use of clients programmed to access theservices described in the previous section. For this, she has to set up her environment, particularly the
following aspects:
Authentication: This can be achieved in two different ways, listed here in order of priority (i.e.values specified in the argument line supersede environmental variables)
– Using the commands arguments. All the commands accept a username (as the OpenNeb-ula username) and a password (as the OpenNebula password)
– If the above is not available, the ONE AUTH variable will be checked for authentication(with the same used for OpenNebula CLI, pointing to a file containing a single line: ”user-name:password”).
Server location: The command need to know where the OpenNebula OCCI service is running.You can pass the OCCI service endpoint using the ”url” flag in the commands. If that is not present,
the OCCI URL3 environment variable is used (in the form of a http URL3, including the portif it is not the standard 80). Again, if the OCCI URL3 variable is not present, it will default to”http://localhost:4567 ”
The OCCI URL3 has to use the FQDN of the OCCI Service
1.1.3 Create resources
Lets take a walk through a typical usage scenario. In this brief scenario it will be shown how to upload animage to the OCCI OpenNebula Storage repository, how to create a Network in the OpenNebula OCCIcloud and how to create Compute resource using the image and the network previously created.
Storage
Assuming we have a working Ubuntu installation residing in an .img file, we can upload it into theOpenNebula OCCI cloud using the following OCCI representation of the image:
1 <STORAGE>2 <NAME>U bunt u D eskt op</NAME>3 <DESCRIPTION>Ubu ntu 1 0 . 0 4 d e s kt o p f o r s t u d e n t s .</DESCRIPTION>4 <TYPE>OS</TYPE>5 <URL> f i l e : ///im ag es/ubunt u/ jaun t y . im g</URL>6 </STORAGE>
Next, using the occi-storage command we will create the Storage resource:
$ occi-storage --url http://cloud.server:4567 --username oneadmin --password opennebula create
image.xml
<STORAGE href=’http://cloud.server:4567/storage/0’>
<ID>3</ID>
<NAME>Ubuntu Desktop</NAME>
3Uniform Resource Locator
C12G Labs S.L. 6/26 Rev20121022
7/14/2019 ONE 3.8 Interfaces for Cloud Consumers(1)
http://slidepdf.com/reader/full/one-38-interfaces-for-cloud-consumers1 7/26
<TYPE>OS</TYPE>
<DESCRIPTION>Ubuntu 10.04 desktop for students.</DESCRIPTION>
<PUBLIC>NO</PUBLIC><PERSISTENT>NO</PERSISTENT>
<SIZE>41943040</SIZE>
</STORAGE>
The user should take note of this ID, as it will be needed to add it to the Compute resource.
Network
The next step would be to create a Network resource
1 <NETWORK>2 <NAME>MySer viceN et wor k</NAME>3 <ADDRESS>1 9 2 . 1 6 8 . 1 . 1</ADDRESS>
4 <SIZE>20 0</SIZE>5 <PUBLIC>NO</PUBLIC>6 </NETWORK>
Next, using the occi-network command we will create the Network resource:
$ occi-network --url http://cloud.server:4567 --username oneadmin --password opennebula create
vnet.xml
<NETWORK href=’http://cloud.server:4567/network/0’>
<ID>0</ID>
<NAME>MyServiceNetwork</NAME>
<ADDRESS>192.168.1.1/ADDRESS>
<SIZE>200/SIZE>
<PUBLIC>NO</PUBLIC>
</NETWORK>
Compute
The last step would be to create a Compute resource referencing the Storage and Networks resourcepreviously created by means of their ID, using a representation like the following:
1 <COMPUTE>2 <NAME>MyCompute</NAME>3 <INSTANCE TYPE hr ef=”ht t p : //www. openne bula . or g / in st an ce t y pe /s m al l ”/>4 <DISK>5 <STORAGE hr ef=”ht t p : //www. opennebu la . or g/ st or ag e /0”/>6 </DISK>7 <NIC>8 <NETWORK hr ef=”h tt p: //www. open nebu la . org /n etwork /0 ”/>
9 <IP>1 9 2 . 1 6 8 . 1 . 1 2</ IP>10 </NIC>11 <CONTEXT>12 <HOSTNAME>MAINHOST</HOSTNAME>13 <DATA>DATA1</DATA>14 </CONTEXT>15 </COMPUTE>
Next, using the occi-compute command we will create the Compute resource:
$ occi-compute --url http://cloud.server:4567 --username oneadmin --password opennebula create
vm.xml
<COMPUTE href=’http://cloud.server:4567/compute/0’>
<ID>0</ID>
<CPU>1</CPU>
<MEMORY>1024</MEMORY><NAME>MyCompute</NAME>
<INSTANCE_TYPE href="http://www.opennebula.org/instance_type/small"/>
<STATE>PENDING</STATE>
<DISK id=’0’>
C12G Labs S.L. 7/26 Rev20121022
7/14/2019 ONE 3.8 Interfaces for Cloud Consumers(1)
http://slidepdf.com/reader/full/one-38-interfaces-for-cloud-consumers1 8/26
<STORAGE href=’http://cloud.server:4567/storage/3’ name=’Ubuntu Desktop’/>
<TYPE>DISK</TYPE>
<TARGET>hda</TARGET></DISK>
<NIC>
<NETWORK href=’http://cloud.server:4567/network/0’ name=’MyServiceNetwork’/>
<IP>192.168.1.12</IP>
<MAC>02:00:c0:a8:01:0c</MAC>
</NIC>
<CONTEXT>
<DATA>DATA1</DATA>
<HOSTNAME>MAINHOST</HOSTNAME>
<TARGET>hdb</TARGET>
</CONTEXT>
</COMPUTE>
1.1.4 Updating resources
Storage
Some of the characteristics of an storage entity can be modified using the occi-storage update command:Only one characteristic can be updated per request
Storage persistence In order to make a storage entity persistent we can update the resource usingthe following xml:
1 <STORAGE h r e f = ’ h t t p : / / c l o u d . s e r v e r : 4 5 6 7 / s t o r a g e / 0 ’>2 <ID>3</ID>3 <PERSISTENT>YES</PERSISTENT>
4 </STORAGE>
Next, using the occi-storage command we will create the Storage resource:
$ occi-storage --url http://cloud.server:4567 --username oneadmin --password opennebula update
image.xml
<STORAGE href=’http://cloud.server:4567/storage/0’>
<ID>3</ID>
<NAME>Ubuntu Desktop</NAME>
<TYPE>OS</TYPE>
<DESCRIPTION>Ubuntu 10.04 desktop for students.</DESCRIPTION>
<PUBLIC>NO</PUBLIC>
<PERSISTENT>YES</PERSISTENT>
<SIZE>41943040</SIZE></STORAGE>
Publish an Storage In order to publish a storage entity so that other users can use it, we can updatethe resource using the following xml:
1 <STORAGE h r e f = ’ h t t p : / / c l o u d . s e r v e r : 4 5 6 7 / s t o r a g e / 0 ’>2 <ID>3</ID>3 <PUBLIC>YES</PUBLIC>4 </STORAGE>
Next, using the occi-storage command we will create the Storage resource:
$ occi-storage --url http://cloud.server:4567 --username oneadmin --password opennebula updateimage.xml
<STORAGE href=’http://cloud.server:4567/storage/0’>
<ID>3</ID>
<NAME>Ubuntu Desktop</NAME>
C12G Labs S.L. 8/26 Rev20121022
7/14/2019 ONE 3.8 Interfaces for Cloud Consumers(1)
http://slidepdf.com/reader/full/one-38-interfaces-for-cloud-consumers1 9/26
<TYPE>OS</TYPE>
<DESCRIPTION>Ubuntu 10.04 desktop for students.</DESCRIPTION>
<PUBLIC>YES</PUBLIC><PERSISTENT>YES</PERSISTENT>
<SIZE>41943040</SIZE>
</STORAGE>
Network
Some of the characteristics of an network entity can be modified using the occi-network update command:Only one characteristic can be updated per request
Publish a Network In order to publish a network entity so that other users can use it, we can updatethe resource using the following xml:
1 <NETWORK hr ef=’ ht t p: //c loud . ser ve r : 45 67 /net wor k /0 ’>2 <ID>0</ID>3 <PUBLIC>YES</PUBLIC>4 </NETWORK>
Next, using the occi-network command we will update the Network resource:
$ occi-network --url http://cloud.server:4567 --username oneadmin --password opennebula update
vnet.xml
<NETWORK href=’http://cloud.server:4567/network/0’>
<ID>0</ID>
<NAME>MyServiceNetwork</NAME>
<ADDRESS>192.168.1.1/ADDRESS>
<SIZE>200/SIZE>
<PUBLIC>YES</PUBLIC></NETWORK>
Compute
Some of the characteristics of a compute entity can be modified using the occi-compute update command:Only one characteristic can be updated per request
Change the Compute state In order to change the Compute state, we can update the resource usingthe following xml:
1 <COMPUTE hr ef=’ ht t p: //c loud . ser ve r : 45 67 /com pute/0 ’>2 <ID>0</ID>
3 <STATE>STOPPED</STATE>4 </COMPUTE>
Next, using the occi-compute command we will update the Compute resource:The available states to update a Compute resource are:
STOPPED
SUSPENDED
RESUME
CANCEL
SHUTDOWN
REBOOT
RESET
DONE
C12G Labs S.L. 9/26 Rev20121022
7/14/2019 ONE 3.8 Interfaces for Cloud Consumers(1)
http://slidepdf.com/reader/full/one-38-interfaces-for-cloud-consumers1 10/26
Save a Compute disk in a new Storage In order to save a Compute disk in a new image, we canupdate the resource using the following xml. The disk will be saved after shutting down the Compute.
1 <COMPUTE hr ef=’ ht t p: //c loud . ser ve r : 45 67 /com pute/0 ’>2 <ID>0</ID>3 <DISK i d=”0 ”>4 <STORAGE h r e f =” h t t p : / / c l o u d . s e r v e r : 4 5 6 7 / s t o r a g e / 0 ” n ame= ” f i r s t i m a g e ” />5 <SAVE AS name=”sa ve as 1 ”/>6 </DISK>7 </COMPUTE>
Next, using the occi-compute command we will update the Compute resource:
$ occi-compute --url http://cloud.server:4567 --username oneadmin --password opennebula update
vm.xml
<COMPUTE href=’http://cloud.server:4567/compute/0’>
<ID>0</ID>
<CPU>1</CPU><MEMORY>1024</MEMORY>
<NAME>MyCompute</NAME>
<INSTANCE_TYPE>small</INSTANCE_TYPE>
<STATE>STOPPED</STATE>
<DISK id=’0’>
<STORAGE href=’http://cloud.server:4567/storage/3’ name=’Ubuntu Desktop’/>
<SAVE_AS href="http://cloud.server:4567/storage/7"/>
<TYPE>DISK</TYPE>
<TARGET>hda</TARGET>
</DISK>
<NIC>
<NETWORK href=’http://cloud.server:4567/network/0’ name=’MyServiceNetwork’/>
<IP>192.168.1.12</IP>
<MAC>02:00:c0:a8:01:0c</MAC></NIC>
<CONTEXT>
<DATA>DATA1</DATA>
<HOSTNAME>MAINHOST</HOSTNAME>
<TARGET>hdb</TARGET>
</CONTEXT>
</COMPUTE>
Create a volume and Attach it to a running VM In this example we will show how to create anew volume using the following template and attach it to a running compute resource.
1 <STORAGE>
2 <NAME>Volume1</NAME>3 <TYPE>DATABLOCK</TYPE>4 <DESCRIPTION>V ol ume t o b e h o t p l u g g e d</DESCRIPTION>5 <PUBLIC>NO</PUBLIC>6 <PERSISTENT>NO</PERSISTENT>7 <FSTYPE>e x t 3</FSTYPE>8 <SIZE>10</SIZE>9 </STORAGE>
$ cat /tmp/storage
<STORAGE>
<NAME>Volume1</NAME>
<TYPE>DATABLOCK</TYPE>
<DESCRIPTION>Volume to be hotplugged</DESCRIPTION>
<PUBLIC>NO</PUBLIC><PERSISTENT>NO</PERSISTENT>
<FSTYPE>ext3</FSTYPE>
<SIZE>10</SIZE>
</STORAGE>
C12G Labs S.L. 10/26 Rev20121022
7/14/2019 ONE 3.8 Interfaces for Cloud Consumers(1)
http://slidepdf.com/reader/full/one-38-interfaces-for-cloud-consumers1 11/26
$ occi-storage create /tmp/storage
<STORAGE href=’http://127.0.0.1:4567/storage/5’><ID>5</ID>
<NAME>Volume1</NAME>
<USER href=’http://127.0.0.1:4567/user/0’ name=’oneadmin’/>
<GROUP>oneadmin</GROUP>
<STATE>READY</STATE>
<TYPE>DATABLOCK</TYPE>
<DESCRIPTION>Volume to be hotplugged</DESCRIPTION>
<SIZE>10</SIZE>
<FSTYPE>ext3</FSTYPE>
<PUBLIC>NO</PUBLIC>
<PERSISTENT>NO</PERSISTENT>
</STORAGE>
$ occi-compute list
<COMPUTE_COLLECTION>
<COMPUTE href=’http://127.0.0.1:4567/compute/4’ name=’one-4’/>
<COMPUTE href=’http://127.0.0.1:4567/compute/6’ name=’one-6’/>
</COMPUTE_COLLECTION>
$ occi-storage list
<STORAGE_COLLECTION>
<STORAGE name=’ttylinux - kvm’ href=’http://127.0.0.1:4567/storage/1’/>
<STORAGE name=’Ubuntu Server 12.04 (Precise Pangolin) - kvm’
href=’http://127.0.0.1:4567/storage/2’/>
<STORAGE name=’Volume1’ href=’http://127.0.0.1:4567/storage/5’/>
</STORAGE_COLLECTION>
$ occi-compute attachdisk 6 5
<COMPUTE href=’http://127.0.0.1:4567/compute/6’>
<ID>6</ID>
<USER name=’oneadmin’ href=’http://127.0.0.1:4567/user/0’/>
<GROUP>oneadmin</GROUP>
<CPU>1</CPU>
<MEMORY>512</MEMORY>
<NAME>one-6</NAME>
<STATE>ACTIVE</STATE>
<DISK id=’0’>
<STORAGE name=’Ubuntu Server 12.04 (Precise Pangolin) - kvm’
href=’http://127.0.0.1:4567/storage/2’/>
<TYPE>FILE</TYPE>
<TARGET>hda</TARGET></DISK>
<DISK id=’1’>
<STORAGE name=’Volume1’ href=’http://127.0.0.1:4567/storage/5’/>
<TYPE>FILE</TYPE>
<TARGET>sda</TARGET>
</DISK>
<NIC>
<NETWORK name=’local-net’ href=’http://127.0.0.1:4567/network/0’/>
<IP>192.168.122.6</IP>
<MAC>02:00:c0:a8:7a:06</MAC>
</NIC>
</COMPUTE>
You can obtain more information on how to use the above commands accessing their Usage helppassing them the -h flag. For instance, a -T option is available to set a connection timeout.
C12G Labs S.L. 11/26 Rev20121022
7/14/2019 ONE 3.8 Interfaces for Cloud Consumers(1)
http://slidepdf.com/reader/full/one-38-interfaces-for-cloud-consumers1 12/26
In platforms where ’curl’ is not available or buggy (i.e. CentOS), a ’-M’ option is available toperform upload using the native ruby Net::HTTP2 using http multipart
1.1.5 OCCI GUI: OpenNebula Self-Service
OpenNebula offers a graphical user interface via the OCCI server. Check OpenNebula Self-Service doc-umentation for more information.
1.2 OpenNebula EC2 User Guide
The EC2 Query API offers the functionality exposed by Amazon EC2: upload images, register them,run, monitor and terminate instances, etc. In short, Query requests are HTTP2 or HTTPS requests thatuse the HTTP2 verb GET or POST and a Query parameter.
OpenNebula implements a subset of the EC2 Query interface, enabling the creation of public cloudsmanaged by OpenNebula. In this last release of the API1 implementation, the methods implemented are:
AMIs
upload image: Uploads an image to OpenNebula
describe images: Lists all registered images belonging to one particular user.
Instances
run instances: Runs an instance of a particular image (that needs to be referenced).
describe instances: Outputs a list of launched images belonging to one particular user.
terminate instances: Shutdowns a set ofvirtual machines (or cancel, depending on its state).
reboot instances: Reboots a set ofvirtual machines.
start instances: Starts a set ofvirtual machines.
stop instances: Stops a set ofvirtual machines.
EBS
create volume: Creates a new DATABLOCK in OpenNebula
delete volume: Deletes an existing DATABLOCK.
describe volumes: Describe all available DATABLOCKs for this user
attach volume: Attaches a DATABLOCK to an instance
detach volume: Detaches a DATABLOCK from an instance
Elastic IPs
allocate address: Allocates a new elastic IP address for the user
release address: Releases a publicIP of the user
describe addresses: Lists elastic IP addresses
associate address: Associates a publicIP of the user with a given instance
disassociate address: Disasociate a publicIP of the user currently associated with an instance
C12G Labs S.L. 12/26 Rev20121022
7/14/2019 ONE 3.8 Interfaces for Cloud Consumers(1)
http://slidepdf.com/reader/full/one-38-interfaces-for-cloud-consumers1 13/26
Keypairs
create keypair: Creates the named keypair delete keypair: Deletes the named keypair, removes the associated keys
describe keypairs: List and describe the key pairs available to the user
Commands description can be accessed from the Command Line Reference.
1.2.1 User Account Configuration
An account is needed in order to use the OpenNebula cloud. The cloud administrator will be responsiblefor assigning these accounts, which have a one to one correspondence with OpenNebula accounts, so allthe cloud administrator has to do is check the configuration guide to setup accounts, and automatically
the OpenNebula cloud account will be created.In order to use such an account, the end user can make use of clients programmed to access theservices described in the previous section. For this, she has to set up his environment, particularly thefollowing aspects:
Authentication: This can be achieved in three different ways, here listed in order of priority (i.e.values specified in the argument line supersede environmental variables)
– Using the commands arguments. All the commands accept an Access Key (as the Open-Nebula username) and a Secret Key (as the OpenNebula hashed password)
– Using EC2 ACCESS KEY and EC2 SECRET KEY environment variables the same wayas the arguments
– If none of the above is available, the ONE AUTH variable will be checked for authentication(with the same used for OpenNebula CLI).
Server location: The command need to know where the OpenNebula cloud service is running.That information needs to be stored within the EC2 URL3 environment variable (in the form of a http URL3, including the port if it is not the standard 80).
The EC2_URL3 has to use the FQDN of the EC2-Query Server
1.2.2 Hello Cloud!
Lets take a walk through a typical usage scenario. In this brief scenario it will be shown how to uploadan image to the OpenNebula image repository, how to register it in the OpenNebula cloud and perform
operations upon it.
upload image
Assuming we have a working Gentoo installation residing in an .img file, we can upload it into theOpenNebula cloud using the econe-upload command:
$ econe-upload /images/gentoo.img
Success: ImageId ami-00000001
The user should take note of this ImageId, as it will be needed to register the image.
register image
The next step should be registering the image to enable its instantiation. We can do this with theecone-register command:
C12G Labs S.L. 13/26 Rev20121022
7/14/2019 ONE 3.8 Interfaces for Cloud Consumers(1)
http://slidepdf.com/reader/full/one-38-interfaces-for-cloud-consumers1 14/26
$ econe-register ami-00000001
Success: ImageId ami-00000001
describe images
We will need the ImageId to launch the image, so in case we forgotten we can list registered imagesusing the econe-describe-images command:
$ econe-describe-images -H
Owner ImageId Status Visibility Location
------------------------------------------------------------------------------
helen ami-00000001 available private 19ead5de585f43282acab4060bfb7a07
run instanceOnce we recall the ImageId, we will need to use the econe-run-instances command to launch an
Virtual Machine instance of our image:
$ econe-run-instances -H ami-00000001
Owner ImageId InstanceId InstanceType
------------------------------------------------------------------------------
helen ami-00000001 i-15 m1.small
We will need the InstanceId to monitor and shutdown our instance, so we better write down that i-15.
describe instances
If we have too many instances launched and we don’t remember everyone of them, we can ask econe-describe-instances to show us which instances we have submitted.
$ econe-describe-instances -H
Owner Id ImageId State IP Type
------------------------------------------------------------------------------------------------------------
helen i-15 ami-00000001 pending 147.96.80.33 m1.small
We can see that the instances with Id i-15 has been launched, but it is still pending, i.e., it still needs tobe deployed into a physical host. If we try the same command again after a short while, we should beseeing it running as in the following excerpt:
$ econe-describe-instances -H
Owner Id ImageId State IP Type
------------------------------------------------------------------------------------------------------------
helen i-15 ami-00000001 running 147.96.80.33 m1.small
terminate instances
After we put the Virtual Machine to a good use, it is time to shut it down to make space for other Vir-tual Machines (and, presumably, to stop being billed for it). For that we can use the econe-terminate-
instances passing to it as an argument the InstanceId that identifies our Virtual Machine:
$ econe-terminate-instances i-15
Success: Terminating i-15 in running state
You can obtain more information on how to use the above commands accessing their Usage helppassing them the -h flag
C12G Labs S.L. 14/26 Rev20121022
7/14/2019 ONE 3.8 Interfaces for Cloud Consumers(1)
http://slidepdf.com/reader/full/one-38-interfaces-for-cloud-consumers1 15/26
Chapter 2
References
2.1 OpenNebula EC2 Client Cheat Sheet
OpenNebula provides a set commands to interact with the system:
2.1.1 CLI
oneacct: gets accounting data from OpenNebula
oneacl: manages OpenNebula ACLs
onecluster: manages OpenNebula clusters
onedatastore: manages OpenNebula datastores
onedb: OpenNebula database migration tool
onegroup: manages OpenNebula groups
onehost: manages OpenNebula hosts
oneimage: manages OpenNebula images
onetemplate: manages OpenNebula templates
oneuser: manages OpenNebula users
onevdc: manages OpenNebula Virtual DataCenters
onevm: manages OpenNebula virtual machines
onevnet: manages OpenNebula networks
onezone: manages OpenNebula zones
The output of these commands can be customized by modifying the configuration files that can be foundin /etc/one/cli/. They also can be customized on a per-user basis, in this case the configuration filesshould be placed in $HOME/.one/cli.
2.1.2 OCCI Commands
occi-compute: manages compute objects
occi-network: manages network objects
occi-storage: manages storage objects
occi-instance-type: Retrieve instance types
C12G Labs S.L. 15/26 Rev20121022
7/14/2019 ONE 3.8 Interfaces for Cloud Consumers(1)
http://slidepdf.com/reader/full/one-38-interfaces-for-cloud-consumers1 16/26
2.1.3 ECONE Commands
econe-upload: Uploads an image to OpenNebula
econe-describe-images: Lists all registered images belonging to one particular user.
econe-run-instances: Runs an instance of a particular image (that needs to be referenced).
econe-describe-instances: Outputs a list of launched images belonging to one particular user.
econe-terminate-instances: Shutdowns a set ofvirtual machines (or cancel, depending on itsstate).
econe-reboot-instances: Reboots a set ofvirtual machines.
econe-start-instances: Starts a set ofvirtual machines.
econe-stop-instances: Stops a set ofvirtual machines.
econe-create-volume: Creates a new DATABLOCK in OpenNebula
econe-delete-volume: Deletes an existing DATABLOCK.
econe-describe-volumes: Describe all available DATABLOCKs for this user
econe-attach-volume: Attaches a DATABLOCK to an instance
econe-detach-volume: Detaches a DATABLOCK from an instance
econe-allocate-address: Allocates a new elastic IP address for the user
econe-release-address: Releases a publicIP of the user
econe-describe-addresses: Lists elastic IP addresses
econe-associate-address: Associates a publicIP of the user with a given instance
econe-disassociate-address: Disasociate a publicIP of the user currently associated with aninstance
econe-create-keypair: Creates the named keypair
econe-delete-keypair: Deletes the named keypair, removes the associated keys
econe-describe-keypairs: List and describe the key pairs available to the user
econe-register: Registers an image
2.2 EC2 Ecosystem
In order to interact with the EC2 Service that OpenNebula implements you can use the client included
in the OpenNebula distribution, but also you can choose one of the well known tools that are supposedto interact with cloud servers through the EC2 Query API1, like the Firefox extensions, ElasticFox andHybridFox, or the command line tools, Euca2ools.
1Application Programming Interface
C12G Labs S.L. 16/26 Rev20121022
7/14/2019 ONE 3.8 Interfaces for Cloud Consumers(1)
http://slidepdf.com/reader/full/one-38-interfaces-for-cloud-consumers1 17/26
2.2.1 ElasticFox
ElasticFox is a Mozilla Firefox extension for managing your Amazon EC2 account. Launch new instances,mount Elastic Block Storage volumes, map Elastic IP addresses, and more.Configuration
You have to set up the credentials to interact with OpenNebula, by pressing the ”Credentials”button:
1. Account Name, add a name for this account
2. AWS Access Key, add your OpenNebula username
3. AWS Secret Access Key, add your OpenNebula SHA1 hashed password
Figure 2.1:
Also you have to specify in a new ”Region” the endpoint in which the EC2 Service is running, bypressing on the Regions button. Take care of using exactly the same url and port that is specifiedin the econe.conf file, otherwise you will get ”AuthFailure”:
If you have problems adding a new region, try to add it manually in the ec2ui.endpoints variableinside the Firefox about:config
Typical usage scenarios
List images
Run instances
C12G Labs S.L. 17/26 Rev20121022
7/14/2019 ONE 3.8 Interfaces for Cloud Consumers(1)
http://slidepdf.com/reader/full/one-38-interfaces-for-cloud-consumers1 18/26
Figure 2.2:
Control instances
You can also use HybridFox a similar Mozilla Firefox extension to interact with cloud services throughthe EC2 Query API1
2.2.2 Euca2ools
Euca2ools are command-line tools for interacting with Web services that export a REST/Query-basedAPI1 compatible with Amazon EC2 and S3 services.
You have to set the following environment variables in order to interact with the OpenNebula EC2Query Server. The EC2_URL2 will be the same endpoint as defined in the /etc/one/econe.conf fileof Opennebula. The EC2_ACCESS_KEY will be the OpenNebula username and the EC2_SECRET_KEY theOpenNebula sha1 hashed user password
~$ env | grep EC2
EC2_SECRET_KEY=e17a13.0834936f71bb3242772d25150d40791e72
EC2_URL=http://localhost:4567
EC2_ACCESS_KEY=oneadmin
Typical usage scenarios
List images
2Uniform Resource Locator
C12G Labs S.L. 18/26 Rev20121022
7/14/2019 ONE 3.8 Interfaces for Cloud Consumers(1)
http://slidepdf.com/reader/full/one-38-interfaces-for-cloud-consumers1 19/26
Figure 2.3:
~$ euca-describe-images
IMAGE ami-00000001 srv/cloud/images/1 daniel available private i386 machine
IMAGE ami-00000002 srv/cloud/images/2 daniel available private i386 machine
IMAGE ami-00000003 srv/cloud/images/3 daniel available private i386 machine
IMAGE ami-00000004 srv/cloud/images/4 daniel available private i386 machine
List instances
~$ euca-describe-instances
RESERVATION default daniel default
INSTANCE i-0 ami-00000002 192.168.0.1 192.168.0.1 running default 0
2010-06-21T18:51:13+02:00 default eki-EA801065 eri-1FEE1144
INSTANCE i-3 ami-00000002 192.168.0.4 192.168.0.4 running default 0
2010-06-21T18:53:30+02:00 default eki-EA801065 eri-1FEE1144
Run instances
~$ euca-run-instances --instance-type m1.small ami-00000001RESERVATION r-47a5402e daniel default
INSTANCE i-4 ami-00000001 192.168.0.2 192.168.0.2 pending default 2010-06-22T11:54:07+02:
C12G Labs S.L. 19/26 Rev20121022
7/14/2019 ONE 3.8 Interfaces for Cloud Consumers(1)
http://slidepdf.com/reader/full/one-38-interfaces-for-cloud-consumers1 20/26
Figure 2.4:
C12G Labs S.L. 20/26 Rev20121022
7/14/2019 ONE 3.8 Interfaces for Cloud Consumers(1)
http://slidepdf.com/reader/full/one-38-interfaces-for-cloud-consumers1 21/26
Figure 2.5:
C12G Labs S.L. 21/26 Rev20121022
7/14/2019 ONE 3.8 Interfaces for Cloud Consumers(1)
http://slidepdf.com/reader/full/one-38-interfaces-for-cloud-consumers1 22/26
Chapter 3
Self-service Portal
3.1 Using OpenNebula Self-Service
OpenNebula Self-Service is a simplified GUI1 aimed to end-users of the OpenNebula cloud. Its aim is tooffer a simplified access to shared infrastructure for non-IT end users.
Self-Service works on top of OpenNebula’s OCCI server and it allows users to easily create, deployand manage compute, storage (including the upload of images) and network resources.
Figure 3.1:
inlinetoc
3.1.1 Requirements
OpenNebula Self-Service requires working installation of OpenNebula OCCI server. Check the followingpages for more information on setting up OpenNebula OCCI:
OCCI Server Configuration: Specially the information provided in the requirements, configuration
and usage sections.OpenNebula SelfService supports Firefox (> 3.5) and Chrome browsers. Internet Explorer, Opera
and others are not supported and may not work well.
1Graphical User Interface
C12G Labs S.L. 22/26 Rev20121022
7/14/2019 ONE 3.8 Interfaces for Cloud Consumers(1)
http://slidepdf.com/reader/full/one-38-interfaces-for-cloud-consumers1 23/26
3.1.2 Considerations and limitations
OpenNebula Self-Service is a simplified UI, therefore it implements only most of the operations sup-ported by OpenNebula OCCI. For more advanced controls of your OpenNebula cloud, please checkOpenNebula Sunstone Cloud Operations Center
3.1.3 Usage
Start the OCCI server:
occi-server start
Point your browser to http://occi.server.url:port/ui. For example, by default you could access bypointing your browser to http://localhost:4567/ui.
You will be able to use your OpenNebula user credentials to login.
Figure 3.2:
Managing compute resources
In the Compute tab, OpenNebula Self-Service will display a list of current compute resources and anindicator of their state (green for active, red for fail and yellow for the rest. You can see moreinformation for each resource by clicking on them.
Users can create easily a new resource filling in the creation form, selecting the storage and networkresources you would like to associate to it.
VNC console From OpenNebula 3.4, Self-Service UI allows to open websockets-based VNC connectionto the virtual machines.
In order to setup this connections follow the instructions in the Sunstone documentation. in-
stall_novnc.sh will setup occi-server.conf vnc proxy variable.Additionally, you will need to enable vnc sessions in ”occi-server.conf”(variable :vnc_enable).Finally, make sure that the OCCI templates for VMs include the necessary graphics section, since
users cannot manually include it when creating new VMs.For troubleshooting, you can check the Sunstone VNC troubleshooting section.
C12G Labs S.L. 23/26 Rev20121022
7/14/2019 ONE 3.8 Interfaces for Cloud Consumers(1)
http://slidepdf.com/reader/full/one-38-interfaces-for-cloud-consumers1 24/26
Figure 3.3:
Managing storage resources
In the Storage tab, you will find a list of current storages defined. You can find more information byclicking on them.
Users can upload new images to OpenNebula at the time of creating a new storage resources. Anupload progress bar will be shown. Take into account that large images can take a long time to upload.
Check Sunstone upload for more information on how this process works and the problems that mayocurr.
Managing network resources
In the Network tab, you will see a list of your current networks. You can see extended information clickingon them.
OpenNebula Self-Service (and OCCI) currently only supports the creation of ranged virtual networks.
User-based configuration
Users can configure specific options in the configuration tab. So far only the language selection is available,but we expect it to grow in the future.
User configuration is saved using browser persistent storage.
3.2 Customizing OpenNebula Self-Service
OpenNebula Self-Service can be easily customized to include the informations you consider more relevantto its users.
inlinetoc
3.2.1 Customizable options
Customizable options are:
Login Self-Service logo and top-left logo in the main views.
Title, texts and images in the dashboard boxes.
C12G Labs S.L. 24/26 Rev20121022
7/14/2019 ONE 3.8 Interfaces for Cloud Consumers(1)
http://slidepdf.com/reader/full/one-38-interfaces-for-cloud-consumers1 25/26
Figure 3.4:
List of useful links in the dashboard.
Right-pane text and image in compute dashboard.
Right-pane text and image in storage dashboard. Right-pane text and image in network dashboard.
3.2.2 Customizing
The strings and urls defining the contents of the above elements have been gathered in one javascript file:/usr/lib/one/ruby/cloud/occi/public/customize/custom.js. This is an extract of that file:
////
//Dashboard Welcome box
////
var dashboard_welcome_title = tr("Welcome to OpenNebula Self-Service");
var dashboard_welcome_image = "images/opennebula-selfservice-icon.png"
var dashboard_welcome_html = ’<p>’+tr("OpenNebula Self-Service is a simplified user interface to manage OpenNebula compute, storage and network resources. It is focused on easiness and usability
and features a limited set of operations directed towards end-users.")+’</p>\
<p>’+tr("Additionally, OpenNebula Self-Service allows easy customization of the interface (e.g. this
text) and brings multi-language support.")+’</p>\
<p>’+tr("Have a cloudy experience!")+’</p>’;
The file is formed by pairs of ”var variable name = variable value”. It should be quite straighforwardto adapt the current content of the file to your own needs. Some values (like those related to images)indicate a url or relative path. Others are simply html text.
In the example, the function tr(String) is used to allow translation of these strings into differentlanguages when available, but it’s not strictly necessary.
Finally, if writing a String over several lines, remember to end each line with \.
C12G Labs S.L. 25/26 Rev20121022
7/14/2019 ONE 3.8 Interfaces for Cloud Consumers(1)
http://slidepdf.com/reader/full/one-38-interfaces-for-cloud-consumers1 26/26
Figure 3.5: