You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by to...@apache.org on 2014/02/02 14:14:54 UTC

[1/2] git commit: docs: Add information about library drives and server creation work flow.

Updated Branches:
  refs/heads/trunk 48ce4c0ba -> f7560b202


docs: Add information about library drives and server creation work flow.


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/8e914b74
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/8e914b74
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/8e914b74

Branch: refs/heads/trunk
Commit: 8e914b74587877a44535089ed03b2642d87fec89
Parents: 48ce4c0
Author: Tomaz Muraus <to...@apache.org>
Authored: Sun Feb 2 13:30:50 2014 +0100
Committer: Tomaz Muraus <to...@apache.org>
Committed: Sun Feb 2 13:30:50 2014 +0100

----------------------------------------------------------------------
 docs/compute/drivers/cloudsigma.rst | 60 ++++++++++++++++++++++++++++++--
 1 file changed, 57 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/8e914b74/docs/compute/drivers/cloudsigma.rst
----------------------------------------------------------------------
diff --git a/docs/compute/drivers/cloudsigma.rst b/docs/compute/drivers/cloudsigma.rst
index ce2fcb2..7472723 100644
--- a/docs/compute/drivers/cloudsigma.rst
+++ b/docs/compute/drivers/cloudsigma.rst
@@ -28,6 +28,60 @@ Available arguments:
 * ``api_version`` - Which API version to use. Defaults to ``2.0``. All the
   supported values: ``1.0`` (deprecated), ``2.0``
 
+For information on how to use those arguments, see the `Examples`_ section
+bellow.
+
+Basics
+------
+
+Pre-installed library drives vs installation CD drives
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+CloudSigma has a concept of so called library drives. Library drives exist in
+two forms:
+
+1. Pre-installed library drives
+2. Installation CD drives
+
+Pre-installed library drives already have an existing operating system
+installed on them. They can be cloned and directly used when creating a server.
+
+In Libcloud, pre-installed library drives are exposed as
+:class:`libcloud.compute.base.NodeImage` objects through a standard
+:meth:`libcloud.compute.base.NodeDriver.list_images` method.
+
+Installation CD drives are different and not something which is supported by a
+big chunk of other providers. Unlike pre-installed drives which represent an
+already installed operating system, those drives represent an operating system
+installation medium (CD / DVD).
+
+Those installation CD drives don't fit well into the ``NodeImage`` concept so they
+are represented using
+:class:`libcloud.compute.drivers.cloudsigma.CloudSigmaDrive` objects through the
+:meth:`libcloud.compute.drivers.cloudsigma.CloudSigma_2_0_NodeDriver.ex_list_library_drives`
+method.
+
+For more information and examples on how to use the installation CD drives, see
+the `Create a server using an installation CD`_ example bellow.
+
+Server creation work-flow
+~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Server creation work-flow consists of multiple steps and depends on the type of
+the image you are using.
+
+If you are using a pre-installed image:
+
+1. Provided image is cloned so it can be used
+2. Cloned drive is resized to match the size specified using NodeSize
+3. Server is created and the cloned drive is attached to it
+4. Server is started
+
+If you are using an installation CD:
+
+1. Server is created and selected installation CD is attached to it
+2. Server is started
+
 Examples
 --------
 
@@ -55,14 +109,14 @@ configuration of a server and a :class:`libcloud.compute.base.NodeImage`
 represents an operating system.
 
 To comply with a standard Libcloud API,
-:class:`libcloud.compute.base.NodeDriver.list_images` method only returns
+:meth:`libcloud.compute.base.NodeDriver.list_images` method only returns
 available pre-installed library images. Those images can be passed directly
 to
-:class:`libcloud.compute.drivers.cloudsigma.CloudSigma_2_0_NodeDriver.create_node`
+:meth:`libcloud.compute.drivers.cloudsigma.CloudSigma_2_0_NodeDriver.create_node`
 method and used to create a server.
 
 If you want to list all the available images and drives, you should use
-:class:`libcloud.compute.drivers.cloudsigma.CloudSigma_2_0_NodeDriver.ex_list_library_drives`
+:meth:`libcloud.compute.drivers.cloudsigma.CloudSigma_2_0_NodeDriver.ex_list_library_drives`
 method.
 
 The example bellow shows how to list all the available sizes, images and


[2/2] git commit: Add an example of how to purchase a subscription.

Posted by to...@apache.org.
Add an example of how to purchase a subscription.


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/f7560b20
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/f7560b20
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/f7560b20

Branch: refs/heads/trunk
Commit: f7560b202dcd5a9fc3a8f474dafd1ed018a245e6
Parents: 8e914b7
Author: Tomaz Muraus <to...@apache.org>
Authored: Sun Feb 2 13:42:04 2014 +0100
Committer: Tomaz Muraus <to...@apache.org>
Committed: Sun Feb 2 13:42:04 2014 +0100

----------------------------------------------------------------------
 docs/compute/drivers/cloudsigma.rst             | 23 ++++++++++++++++++++
 .../cloudsigma/create_vlan_subscription.py      |  9 ++++++++
 2 files changed, 32 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/f7560b20/docs/compute/drivers/cloudsigma.rst
----------------------------------------------------------------------
diff --git a/docs/compute/drivers/cloudsigma.rst b/docs/compute/drivers/cloudsigma.rst
index 7472723..b7cc6bb 100644
--- a/docs/compute/drivers/cloudsigma.rst
+++ b/docs/compute/drivers/cloudsigma.rst
@@ -277,6 +277,29 @@ method as displayed bellow.
 Both of those methods return a ``list``. Servers and drives which share the same
 physical host will be stored under the same index in the returned list.
 
+Purchasing a subscription
+~~~~~~~~~~~~~~~~~~~~~~~~~
+
+A lot of resources such as SSDs, VLANs, IPs and others are created by
+purchasing a subscription.
+
+When you purchase a subscription you need to supply the following arguments:
+
+* ``amount`` - Subscription amount. Unit depends on the purchased resource.
+  For example, if you are purchasing a ``vlan`` resource, ``amount`` represents
+  a number of VLAN networks you want to purchase.
+* ``period`` - For how long to purchase the subscription. Example values:
+  ``1 month``, ``30 days``, etc.
+* ``resource`` - Resource to purchase the subscription for. Valid values:
+  ``cpu``, ``mem``, ``tx``, ``ip``, ``vlan``
+* ``auto_renew`` - ``True`` to auto renew the subscription when it expires.
+
+The example bellow shows how to purchase a single VLAN for a duration of
+30 days which will be automatically renewed when it expires.
+
+.. literalinclude:: /examples/compute/cloudsigma/create_vlan_subscription.py
+   :language: python
+
 Retrieving the account balance
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 

http://git-wip-us.apache.org/repos/asf/libcloud/blob/f7560b20/docs/examples/compute/cloudsigma/create_vlan_subscription.py
----------------------------------------------------------------------
diff --git a/docs/examples/compute/cloudsigma/create_vlan_subscription.py b/docs/examples/compute/cloudsigma/create_vlan_subscription.py
new file mode 100644
index 0000000..a29e239
--- /dev/null
+++ b/docs/examples/compute/cloudsigma/create_vlan_subscription.py
@@ -0,0 +1,9 @@
+from libcloud.compute.types import Provider
+from libcloud.compute.providers import get_driver
+
+cls = get_driver(Provider.CLOUDSIGMA)
+driver = cls('username', 'password', region='zrh', api_version='2.0')
+
+subscription = driver.ex_create_subscription(amount=1, period='30 days',
+                                             resource='vlan', auto_renew=True)
+print(subscription)