Преглед изворни кода

Merge branch 'master' of https://github.com/gvlproject/cloudbridge

Nuwan Goonasekera пре 10 година
родитељ
комит
3f49ac7c80

+ 2 - 2
cloudbridge/cloud/interfaces/services.py

@@ -190,8 +190,8 @@ class InstanceService(PageableObjectMixin, ProviderService):
 
         :type  marker: ``str``
         :param marker: The marker is an opaque identifier used to assist
-        in paging through very long lists of objects. It is returned on each
-        invocation of the list method.
+                       in paging through very long lists of objects. It is
+                       returned on each invocation of the list method.
 
         :rtype: ``ResultList`` of :class:`.Instance`
         :return: A ResultList object containing a list of Instances

+ 0 - 5
docs/api_docs/cloud/providers.rst

@@ -11,8 +11,3 @@ ContainerProvider
 -----------------
 .. autoclass:: cloudbridge.cloud.interfaces.impl.ContainerProvider
     :members:
-
-DeploymentProvider
-------------------
-.. autoclass:: cloudbridge.cloud.interfaces.resources.DeploymentProvider
-    :members:

+ 72 - 0
docs/topics/launch.rst

@@ -0,0 +1,72 @@
+Launching instances
+===================
+Depending on the cloud provider, instances can be launched using
+software-managed networking (e.g., VPC on AWS, Neutron on OpenStack) or the
+classic networking approach. Before being able to run below command, you will
+need a ``provider`` object (see `this page <setup.html>`_).
+
+Common launch data
+------------------
+Before launching an instane, you need to decide on what image to launch
+as well as what type of instance. We will create those objects here are use
+them in both options below. The specified image ID is a base Ubuntu image on
+AWS so feel free to change it as desired.
+
+.. code-block:: python
+
+    img = provider.compute.images.get('ami-d85e75b0')
+    inst_type = provider.compute.instance_types.find(name='m1.small')
+
+When launching an instance, you can also specify several optional arguments
+such as the security group, a key pair, or instance user data. To allow you to
+connect to the launched instances, we will also supply those parameters.
+
+.. code-block:: python
+
+    kp = provider.security.key_pairs.find(name='cloudbridge_intro')
+    sg = provider.security.security_groups.list()[0]
+
+Launch with classic networking
+------------------------------
+Launching an instance with the traditional networking model is straighforward,
+only needing to specify the basic parameters:
+
+.. code-block:: python
+
+    inst = provider.compute.instances.create(
+        name='Cloudbridge-basic', image=img, instance_type=inst_type,
+        keypair=kp, security_groups=[sg])
+
+Launch with private networking
+------------------------------
+Before we can launch an instance into a private newtork, we need to supply a
+network into which the instance will get launched. To aggregate multiple such
+launch configuration options, we create a launch config object and supply it
+when launching an instance. Note that for the time being (Cloudbridge v0.1)
+there is no support for exploring the networking resources so it is necessary
+to get the network IDs via other means (e.g., native API, web dashboard).
+
+.. code-block:: python
+
+    lc = provider.compute.instances.create_launch_config()
+    lc.add_network_interface('subnet-c24aeaff')
+    inst = provider.compute.instances.create(
+        name='Cloudbridge-VPC', image=img,  instance_type=inst_type,
+        launch_config=lc, keypair=kp, security_groups=[sg])
+
+For OpenStack, the process is the same and you only need to specify the
+appropriate network interface ID (e.g.,
+``lc.add_network_interface('5820c766-75fe-4fc6-96ef-798f67623238')``).
+
+------------
+
+After an instance has launched, you can access it's properties:
+
+.. code-block:: python
+
+    # Refresh the state
+    inst.refresh()
+    inst.state
+    # 'running'
+    inst.public_ips
+    # [u'54.166.125.219']

+ 5 - 3
docs/topics/overview.rst

@@ -2,7 +2,9 @@ Using Cloudbridge
 =================
 Introductions to all the key parts of Cloudbridge you'll need to know:
 
-- `How to install Cloudbridge <install.html>`_
-- `Connection and authentication setup <setup.html>`_
-
+.. toctree::
+   :maxdepth: 1
 
+    How to install Cloudbridge <install.rst>
+    Connection and authentication setup <setup.rst>
+    Launching instances <launch.rst>