libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From to...@apache.org
Subject svn commit: r1479992 - /libcloud/site/trunk/content/docs/compute-examples.mdtext
Date Tue, 07 May 2013 17:53:28 GMT
Author: tomaz
Date: Tue May  7 17:53:28 2013
New Revision: 1479992

URL: http://svn.apache.org/r1479992
Log:
CMS commit to libcloud by tomaz

Modified:
    libcloud/site/trunk/content/docs/compute-examples.mdtext

Modified: libcloud/site/trunk/content/docs/compute-examples.mdtext
URL: http://svn.apache.org/viewvc/libcloud/site/trunk/content/docs/compute-examples.mdtext?rev=1479992&r1=1479991&r2=1479992&view=diff
==============================================================================
--- libcloud/site/trunk/content/docs/compute-examples.mdtext (original)
+++ libcloud/site/trunk/content/docs/compute-examples.mdtext Tue May  7 17:53:28 2013
@@ -2,9 +2,37 @@ title: Compute -> Examples
 
 ## Examples
 
+* [Create an OpenStack node using a local OpenStack provider](#example-3-openstack-node-using-local-openstack)
 * [Create an OpenStack node using trystack.org provider](#example-1-openstack-node-using-trystack)
 * [Create a VMware vCloud v1.5 node using generic provider](#example-2-vcloud-generic-provider)
 
+<h3 id="example-3-openstack-node-using-local-openstack">Create an OpenStack node using
a local OpenStack provider</h3>
+
+<p>This example shows how to create a node using a local OpenStack installation.
+To make it work with your installation make sure to replace
+`your_auth_username`, `your_auth_password` and `ex_force_auth_url` with a
+correct value.</p>
+
+<p>Note: This example works with Libcloud 0.9.0 and above.</p>
+
+    ::python
+    from libcloud.compute.types import Provider
+    from libcloud.compute.providers import get_driver
+
+    import libcloud.security
+
+    # This assumes you don't have SSL set up.
+    # Note: Code like this poses a security risk (MITM attack) and
+    # that's the reason why you should never use it for anything else
+    # besides testing. You have been warned.
+    libcloud.security.VERIFY_SSL_CERT = False
+
+    OpenStack = get_driver(Provider.OPENSTACK)
+    driver = OpenStack('your_auth_username', 'your_auth_password',
+                       ex_force_auth_url='http://192.168.1.101:5000/v2.0',
+                       ex_force_auth_version='2.0_password',
+                       ex_tenant_name='your_tenant_name')
+
 <h3 id="example-1-openstack-node-using-trystack">Create an OpenStack node using trystack.org
provider</h3>
 
 <p><a href="https://trystack.org/">trystack.org</a> allows users to try
out OpenStack for free.
@@ -99,3 +127,102 @@ OpenStack driver.</p>
     # Create node with guest OS customisation script to be run at first boot
     node = driver.create_node(name='test node 5', image=image,
                               ex_vm_script='filesystem path to your script')
+* [Create an OpenStack node using trystack.org provider](#example-1-openstack-node-using-trystack)
+* [Create a VMware vCloud v1.5 node using generic provider](#example-2-vcloud-generic-provider)
+
+<h3 id="example-1-openstack-node-using-local-openstack">Create an OpenStack node using
a local OpenStack provider</h3>
+
+<h3 id="example-1-openstack-node-using-trystack">Create an OpenStack node using trystack.org
provider</h3>
+
+<p><a href="https://trystack.org/">trystack.org</a> allows users to try
out OpenStack for free.
+This example demonstrates how to launch an OpenStack node on the trystack.org provider using
a generic
+OpenStack driver.</p>
+
+<p>Note: This example works with Libcloud 0.9.0 and above.</p>
+
+    ::python
+    from libcloud.compute.types import Provider
+    from libcloud.compute.providers import get_driver
+
+    import libcloud.security
+
+    # At the time this example was written, https://nova-api.trystack.org:5443
+    # was using a certificate issued by a Certificate Authority (CA)
+    # which is not included in the default Ubuntu certificates bundle (ca-certificates).
+    # Note: Code like this poses a security risk (MITM attack) and
+    # that's the reason why you should never use it for anything else
+    # besides testing. You have been warned.
+    libcloud.security.VERIFY_SSL_CERT = False
+
+    OpenStack = get_driver(Provider.OPENSTACK)
+
+    driver = OpenStack('your username', 'your password',
+                       ex_force_auth_url='https://nova-api.trystack.org:5443/v2.0',
+                       ex_force_auth_version='2.0_password')
+
+    nodes = driver.list_nodes()
+
+    images = driver.list_images()
+    sizes = driver.list_sizes()
+    size = [s for s in sizes if s.ram == 512][0]
+    image = [i for i in images if i.name == 'natty-server-cloudimg-amd64'][0]
+
+    node = driver.create_node(name='test node', image=image, size=size)
+
+
+<h3 id="example-2-vcloud-generic-provider">Create a VMware vCloud v1.5 node using generic
provider</h3>
+
+<p>This example demonstrates how to launch a VMware vCloud v1.5 node on a generic provider
such as a test lab.</p>
+
+<p>Note: This example works with Libcloud version 0.10.1 and above.</p>
+
+    ::python
+    from libcloud.compute.types import Provider
+    from libcloud.compute.providers import get_driver
+
+    import libcloud.security
+
+	# Skip this step if you are launching nodes on an official vCloud
+	# provider. It is intended only for self signed SSL certs in 
+	# vanilla vCloud Director v1.5 test deployments.
+    # Note: Code like this poses a security risk (MITM attack) and
+    # that's the reason why you should never use it for anything else
+    # besides testing. You have been warned.
+    libcloud.security.VERIFY_SSL_CERT = False
+
+    vcloud = get_driver(Provider.VCLOUD)
+
+    driver = vcloud('you username@organisation', 'your password',
+                    host='vcloud.local', api_version='1.5')
+
+    # List all instantiated vApps
+    nodes = driver.list_nodes()
+    # List all VMs within the first vApp instance
+    print nodes[0].extra['vms']
+
+    # List all available vApp Templates
+    images = driver.list_images()
+    image = [i for i in images if i.name == 'natty-server-cloudimg-amd64'][0]
+
+	# Create node with minimum set of parameters
+    node = driver.create_node(name='test node 1', image=image)
+    # Destroy the node
+    driver.destroy_node(node)
+
+    # Create node without deploying and powering it on
+    node = driver.create_node(name='test node 2', image=image, ex_deploy=False)
+
+    # Create node with custom CPU & Memory values
+    node = driver.create_node(name='test node 3', image=image, ex_vm_cpu=3, ex_vm_memory=1024)
+
+    # Create node with customised networking parameters (eg. for OVF imported images)
+    node = driver.create_node(name='test node 4', image=image,
+                              ex_vm_network='your vm net name', ex_network='your org net
name',
+                              ex_vm_fence='bridged', ex_vm_ipmode='DHCP')
+
+    # Create node in a custom virtual data center
+    node = driver.create_node(name='test node 4', image=image, ex_vdc='your vdc name')
+
+    # Create node with guest OS customisation script to be run at first boot
+    node = driver.create_node(name='test node 5', image=image,
+                              ex_vm_script='filesystem path to your script')
\ No newline at end of file



Mime
View raw message