-A storage_snapshot captures the point-in-time state of a storage_volume. Each snapshot has a created timestamp, and a storage_volume attribute referring to the volume from which the snapshot was made.
-
-
-
Get a list of all storage snapshots
-
-
-To list all available storage snapshots use call GET /api/storage_snapshots. For Amazon EC2 this list includes any snapshots that are available to the requesting client account, including those that may not have been created by that account. As this list is very long the example below shows only part of the response:
-
-To create a new storage_snapshot use call POST /api/storage_snapshots. Clients must specify the storage_volume from which the snapshot is created by supplying the volume_id parameter. The Deltacloud server responds with HTTP 201 Created after a succesful operation and provides details of the new storage_snapshot. Clients may specify operation parameters as multipart/form-data, or as application/x-www-form-urlencoded data:
-
-To delete the specified storage_snapshot use call DELETE /api/storage_snapshots/:id. The operation returns a HTTP 204 No Content after a succesful operation:
-
-Instead of dealing with HTTP interface you can use various clients to communicate with Deltacloud server.
-
-
The Deltacloud Ruby client
-You need to install Ruby client seperately to the Deltacloud API server. Assuming you already have Ruby and RubyGems setup, you can install the Deltacloud client by simply typing:
-
-
$ sudo gem install deltacloud-client
-
-
The Deltacloud client consists of a Ruby library (packaged as a ruby gem) which you can use to interact with the Deltacloud server and control your cloud infrastructure across cloud providers.
-
-
To use the client, you must require deltacloud:
-
-
require 'deltacloud'
-
-
Connect to a Deltacloud provider using these commands:
-
-
-require 'deltacloud'
-
-api_url = 'http://localhost:3001/api'
-api_name = 'mockuser'
-api_password = 'mockpassword'
-
-client = DeltaCloud.new( api_name, api_password, api_url )
-
-# work with client here
-
-
-
In addition to creating a client, operations may occur within a block included on the initialization.
-
-
-DeltaCloud.new( api_name, api_password, api_url ) do |client|
- # work with client here
-end
-
-
-
In case of a failure, every underlying HTTP transport exceptions will be thrown away and returned back to the caller.
-Basically, you interact with the Deltacloud server via HTTP calls, so you can use any HTTP client to talk to Deltacloud using the REST API.
-
-
-
-cURL is a popular command line tool available on most modern linux distributions. See the following examples to learn how to use cURL to interact with Deltacloud. There is an assumption that the Deltacloud server is running on locahost:3001, and was started with the 'ec2' driver (i.e., deltacloudd -i ec2 ).
-
-
-
-Get a listing of all images available in the back-end cloud:
-
-Create a blob called 'my_new_blob' within the bucket 'mybucket' from a local file with HTTP PUT specifying its content type and setting some some metadata key:value pairs:
-
-Retrieve blob metadata for the blob called 'my_new_blob':
-
-
-
-curl -iv -X HEAD
---user "pGbAJ1TsVg5PKs3BK27O:dPs47ralgBlldqYNbLg3scthsg4g8v0L9d6Mb5DK"
-http://localhost:3001/api/buckets/mybucket/my_new_blob?format=xml
-
-
-
-The '-iv' flags will ensure that cURL displays the request and response headers (blob metadata are reported in the response headers with an empty response body).
-
-
-
Libdeltacloud Client (C library)
-
-Libdeltacloud is a C/C++ library for accessing the Deltacloud API. It exports convenient structures and functions for manipulating cloud objects through the deltacloud API.
-
-Full documentation for the library contains the list of data structures, all documented files with brief descriptions and also the exapmles of working with libdeltacloud.
-
This declares that the driver supports the DEFAULT_COLLECTIONS (defined in deltacloud/server/lib/drivers.rb) except storage_snapshots and storage_volumes and also the buckets collection. A storage only cloud provider driver would support only the buckets colletion.
-
-
-Then, you can define the methods for each collection that your driver supports. The methods, as well as the routes to them, are defined in deltacloud/server/lib/deltacloud/server.rb. In general, you can look at the existing drivers to have the idea of how to implement any specific method.
-
-
-
-You should consider how the driver will be communicating with the cloud provider. Many of the existing drivers use external ruby gems for this purpose: for example, the ec2 driver uses the aws gem, the rackspace driver uses the cloudfiles and cloudservers gems. However, other drivers implement their own clients to communicate with the cloud provider, such as the IBM SBC driver and the Gogrid driver. This also explains why, under the /drivers directory, some drivers contain only the provider _driver.rb file, whilst others also define a provider_client.rb file. It is entirely up to you, whether you write your own client or use an existing one.
-
-
-
Thus, your driver for the cloud provider foo may look like:
-
-
-require 'deltacloud/base_driver'
-require 'foo_lib' # a library for talking to the foo cloud
-
-module Deltacloud
- module Drivers
- module Foo
-
-class FooDriver < Deltacloud::BaseDriver
-
- def supported_collections
- DEFAULT_COLLECTIONS + [ :buckets ]
- end
-
- def images(credentials, opts={})
- client = new_foo_client(credentials)
- # use client to get a list of images from the back-end cloud and then create
- # a Deltacloud Image object for each of these. Filter the result
- # (eg specific image requested) and return to user
- end
-
- def realms(credentials, opts={})
- (...)
- end
-
- def instances(credentials, opts={})
- (...)
- end
-
- ... ETC
-
- private
-
- def new_foo_client(credentials)
- client = FooLib::Service.new({:user => credentials.user,
- :pass => credentials.password })
- end
-
-end
- end
- end
- end
-
-
-
-An important method for drivers that implement the instances collection is instance_states. This method represents the finite-state-machine for instances which varies across cloud providers. In some clouds an instance may be in the 'running' state after creation, whereas in other clouds an instance may need to be started explicitly. For example:
-
-The definiton of .to and on. etc is defined in /deltacloud/server/lib/deltacloud/state_machine.rb.
-
-
-
Valid states are:
-
-
-
:begin
-
:pending
-
:running
-
:shutting_down
-
:stopped
-
:end
-
-
-
The instance is located in the:begin state before being created. Immediately after being destroyed the instance is removed to the :end state.
-
-
Valid transition actions are:
-
-
-
:stop
-
:start
-
:reboot
-
-
-
The action :automatically may be used to indicate a tranisition that may occur without an action being triggered (see the example above).
-
-
You can implement some other methods according to the collections you will be supporting:
-
-
-
hardware_profiles(credentials, opts=nil)
-
images(credentials, opts=nil)
-
realms(credentials, opts=nil)
-
instances(credentials, opts=nil)
-
create_instance(credentials, image_id, opts)
-
reboot_instance(credentials, id)
-
stop_instance(credentials, id)
-
destroy_instance(credentials, id)
-
-
-
-The hardware_profiles(...) method should return an array of HardwareProfile objects. The opts hash, if present, must be inspected for :id and :architecture keys. If these keys are present, the results should be filtered by the value associated with each key. The filter_on(...) helper method is used for this filtering and as you can see from existing driver method definitions, is invoked in many of the driver collection methods:
-
-You should add a test to every new feature or new driver you create to make sure, that everything is running as expected. There are two different directories in the Deltacloud project, where the tests are stored: /deltacloud/server/tests for Unit tests for drivers and /deltacloud/tests for Cucumber tests.
-
-
-
Initiate the Unit tests:
-
-
-$ cd /path/to/deltacloud/server
-$ rake test
-
-
-
This will invoke all Unit tests defined in /deltacloud/server/tests by inspecting the Rakefile in /deltacloud/server. To invoke a specific driver tests type:
Deltacloud provides the API server and drivers necessary for connecting to cloud providers.
+
About Deltacloud
+
Deltacloud provides the API server and drivers necessary for connecting to cloud providers.
Deltacloud maintains long-term stability for scripts, tools and applications and backward compatibility across different versions.
@@ -112,33 +109,21 @@
All of this means you can start an instance on an internal cloud and with the same code start another on EC2 or RHEV-M.
-
-
-
+
-
-
-
How does Deltacloud work?
-
-
Deltacloud contains a cloud abstraction API - whether the Deltacloud classic API, the DMTF CIMI API or even the EC2 API. The API works as a wrapper around a large number of clouds, abstracting their differences. For every cloud provider there is a driver "speaking" that cloud provider's native API, freeing you from dealing with the particulars of each cloud's API.
+
How does Deltacloud work?
+
Deltacloud contains a cloud abstraction API - whether the Deltacloud classic API, the DMTF CIMI API or even the EC2 API. The API works as a wrapper around a large number of clouds, abstracting their differences. For every cloud provider there is a driver "speaking" that cloud provider's native API, freeing you from dealing with the particulars of each cloud's API.
Install Deltacloud and start the deltacloudd daemon server. You can use your favourite HTTP client to talk to the server using the Deltacloud REST API, the DMTF CIMI API or even the EC2 API. Deltacloud even comes with an HTML interface so you can simply use your web browser to control your cloud infrastructure straight out of the box. The HTML interface is written with the jQuery mobile framework, so it is compatible with your mobile or tablet devices.