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 2013/12/13 13:09:40 UTC
[1/5] git commit: docs: Add documentation for CloudStack driver.
Updated Branches:
refs/heads/trunk dbe5259ae -> 9e073990e
docs: Add documentation for CloudStack driver.
Signed-off-by: Tomaz Muraus <to...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/b262190c
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/b262190c
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/b262190c
Branch: refs/heads/trunk
Commit: b262190c9c3dcb03513008dd8c0408bf4feda647
Parents: dbe5259
Author: Sebastien Goasguen <ru...@gmail.com>
Authored: Thu Dec 12 15:59:27 2013 +0100
Committer: Tomaz Muraus <to...@apache.org>
Committed: Fri Dec 13 12:32:18 2013 +0100
----------------------------------------------------------------------
docs/compute/_supported_providers.rst | 2 +-
docs/compute/drivers/cloudstack.rst | 190 +++++++++++++++++++
.../create_cloudstack_node_keypair_secgroup.py | 29 +++
.../cloudstack/create_node_advanced_zone.py | 21 ++
.../deploy_node_with_keypair_security_group.py | 21 ++
.../cloudstack/instantiate_driver_host_path.py | 4 +
.../instantiate_driver_insecure_port.py | 6 +
.../cloudstack/instantiate_driver_url.py | 3 +
.../cloudstack/port_forwarding_management.py | 15 ++
.../cloudstack/security_groups_management.py | 30 +++
.../ssh_keypairs_management_exoscale.py | 28 +++
.../start_interactive_shell_exoscale.py | 14 ++
.../start_interactive_shell_ikoula.py | 17 ++
.../cloudstack/turn_off_ssl_verification.py | 2 +
.../create_cloudstack_node_keypair_secgroup.py | 29 ---
15 files changed, 381 insertions(+), 30 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/b262190c/docs/compute/_supported_providers.rst
----------------------------------------------------------------------
diff --git a/docs/compute/_supported_providers.rst b/docs/compute/_supported_providers.rst
index d10ff7b..e20bfad 100644
--- a/docs/compute/_supported_providers.rst
+++ b/docs/compute/_supported_providers.rst
@@ -7,7 +7,7 @@ Provider Documentation
`CloudFrames`_ :doc:`Click </compute/drivers/cloudframes>` CLOUDFRAMES :mod:`libcloud.compute.drivers.cloudframes` :class:`CloudFramesNodeDriver`
`CloudSigma`_ CLOUDSIGMA :mod:`libcloud.compute.drivers.cloudsigma` :class:`CloudSigmaZrhNodeDriver`
`CloudSigma`_ CLOUDSIGMA_US :mod:`libcloud.compute.drivers.cloudsigma` :class:`CloudSigmaLvsNodeDriver`
-`CloudStack`_ CLOUDSTACK :mod:`libcloud.compute.drivers.cloudstack` :class:`CloudStackNodeDriver`
+`CloudStack`_ :doc:`Click </compute/drivers/cloudstack>` CLOUDSTACK :mod:`libcloud.compute.drivers.cloudstack` :class:`CloudStackNodeDriver`
`Digital Ocean`_ DIGITAL_OCEAN :mod:`libcloud.compute.drivers.digitalocean` :class:`DigitalOceanNodeDriver`
`Dreamhost`_ DREAMHOST :mod:`libcloud.compute.drivers.dreamhost` :class:`DreamhostNodeDriver`
`Amazon EC2`_ :doc:`Click </compute/drivers/ec2>` EC2 :mod:`libcloud.compute.drivers.ec2` :class:`EC2NodeDriver`
http://git-wip-us.apache.org/repos/asf/libcloud/blob/b262190c/docs/compute/drivers/cloudstack.rst
----------------------------------------------------------------------
diff --git a/docs/compute/drivers/cloudstack.rst b/docs/compute/drivers/cloudstack.rst
new file mode 100644
index 0000000..e5f0630
--- /dev/null
+++ b/docs/compute/drivers/cloudstack.rst
@@ -0,0 +1,190 @@
+CloudStack Driver Documentation
+===============================
+
+`CloudStack`_ is an Apache Software Foundation open source software designed to
+deploy and manage large networks of virtual machines, as a highly available,
+highly scalable Infrastructure as a Service (IaaS) cloud computing platform.
+CloudStack is used by a number of service providers to offer public cloud
+services, and by many companies to provide an on-premises (private) cloud
+offering, or as part of a hybrid cloud solution.
+
+`CloudStack`_ has its own non-standard `API`_ , `libcloud` provides a Python
+wrapper on top of this `API`_ with common methods with other IaaS solutions and
+Public cloud providers. Therefore, you can use use the `CloudStack` libcloud
+driver to communicate with your local CloudStack based private cloud as well
+as CloudStack based public clouds.
+
+Instantiating a driver
+----------------------
+
+When you instantiate a driver you need to pass the following arguments to the
+driver constructor:
+
+* ``key`` - Your CloudStack API key
+* ``secret`` - Your CloudStack secret key
+* ``host`` - The host of your CloudStack endpoint
+ (e.g `localhost` for http://localhost:8080/client/api)
+* ``path`` - The path to your CloudStack endpoint
+ (e.g `/client/api` for http://localhost:8080/client/api)
+* ``url`` - The url to your CloudStack endpoint,
+ mutually exclusive with `host` and `path`
+* ``secure`` - True or False. True by default
+
+Typically this will lead to:
+
+.. literalinclude:: /examples/compute/cloudstack/instantiate_driver_host_path.py
+ :language: python
+
+A complete `url` can be used instead:
+
+.. literalinclude:: /examples/compute/cloudstack/instantiate_driver_url.py
+ :language: python
+
+In the testing scenario where you are running CloudStack locally, the connection
+may be insecure and you may run it on a specific port. In that case, the
+instantiation would look like this
+
+.. literalinclude:: /examples/compute/cloudstack/instantiate_driver_insecure_port.py
+ :language: python
+
+If you are making a connection to a secure cloud that does not use a trusted
+certificate, you will have to disable the SSL verification like so:
+
+.. literalinclude:: /examples/compute/cloudstack/turn_off_ssl_verification.py
+ :language: python
+
+`libcloud` now features CloudStack based drivers for the `exoscale`_ and
+`ikoula`_ public clouds. Instantiating drivers to those clouds is shown
+in the example section below.
+
+The base `libcloud` API allows you to:
+
+* list nodes, images, instance types, locations
+* list, create, attach, detach, delete volumes
+
+Non-standard functionality and extension methods
+------------------------------------------------
+
+The CloudStack driver exposes a lot of `libcloud` non-standard
+functionalities through extension methods and arguments.
+
+These functionalities include:
+
+* start and stop a node
+* list disk offerings
+* list networks
+* list, allocate and release public IPs,
+* list, create and delete port forwarding rules
+* list, create and delete IP forwarding rules
+* list, create, delete and authorize security groups
+
+.. compound::
+
+ Some methods are only valid for `CloudStack`_ advanced zones, while others
+ are suited for basic zones.
+
+For information on how to use these functionalities please see the method
+docstrings below. You can also use an interactive shell for exploration as
+shown in the examples.
+
+Basic Zone Examples
+--------------------
+
+To start experimenting with libcloud, starting an ipython interactive shell can
+ be very handy. Tab completion and shell history are available. Below is an
+ example of starting such an interactive shell for the exoscale public cloud.
+ Once started you can explore the libcloud API.
+
+1. Start an interactive shell on Exoscale public cloud
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+.. literalinclude:: /examples/compute/cloudstack/start_interactive_shell_exoscale.py
+ :language: python
+
+After experimenting through an interactive shell, you can write scripts that
+will directly execute libcloud commands. For instance starting a node with a
+specific ssh keypair and a couple of security groups can be done as shown in
+the following example:
+
+2. SSH Keypairs management on Exoscale public cloud
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+The base libcloud API has been extended to handle management of ssh keypairs.
+This is very useful for CloudStack basic zones. SSH Keypairs, can be listed,
+created, deleted and imported. This new base API is only available in libcloud
+trunk.
+
+.. literalinclude:: /examples/compute/cloudstack/ssh_keypairs_management_exoscale.py
+ :language: python
+
+3. Security Groups management on Exoscale public cloud
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Currently there is no security group class defined, hence the result of
+`ex_list_securitry_groups()` is a list of dictionaries and not classes.
+
+.. literalinclude:: /examples/compute/cloudstack/security_groups_management.py
+ :language: python
+
+4. Create a node with a keypair and a list of security groups
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+.. literalinclude:: /examples/compute/cloudstack/create_cloudstack_node_keypair_secgroup.py
+ :language: python
+
+5. Deploying a node with a keypair
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Executing deployment scripts when creating node is currently only support in
+basic zones. The `deploy_node` method is used instead of the `create_node`,
+ssh key are passed as arguments as well as a list of scripts.
+
+.. literalinclude:: /examples/compute/cloudstack/deploy_node_with_keypair_security_group.py
+ :language: python
+
+Advanced Zone examples
+-----------------------
+
+Advanced zones in CloudStack provide tenant isolation via VLANs or SDN
+technologies like GRE/STT meshes. In a typical advanced zones, users will
+deploy nodes on a private network and will use NAT to access their nodes.
+Therefore one needs to specifiy the network a node needs to be deployed on,
+and needs to setup port forwarding or IP forwarding rules.
+
+1. Start an interactive shell on Ikoula public cloud
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Instantiation of driver for an advanced zone is the same as with a basic zone,
+for example on the `ikoula`_ cloud:
+
+.. literalinclude:: /examples/compute/cloudstack/start_interactive_shell_ikoula.py
+ :language: python
+
+2. Create a node on a guest network and allocate an IP
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Starting a node requires a specific guest network.
+
+.. literalinclude:: /examples/compute/cloudstack/create_node_advanced_zone.py
+ :language: python
+
+3. List, create and delete a Port forwarding rule
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+To access the node via ssh you need you can create a port forwarding rule like so:
+
+.. literalinclude:: /examples/compute/cloudstack/port_forwarding_management.py
+ :language: python
+
+
+API Docs
+--------
+
+.. autoclass:: libcloud.compute.drivers.cloudstack.CloudStackNodeDriver
+ :members:
+ :inherited-members:
+
+.. _`CloudStack`: http://cloudstack.apache.org
+.. _`API`: http://cloudstack.apache.org/docs/api/
+.. _`exoscale`: http://exoscale.ch
+.. _`ikoula`: http://ikoula.com
http://git-wip-us.apache.org/repos/asf/libcloud/blob/b262190c/docs/examples/compute/cloudstack/create_cloudstack_node_keypair_secgroup.py
----------------------------------------------------------------------
diff --git a/docs/examples/compute/cloudstack/create_cloudstack_node_keypair_secgroup.py b/docs/examples/compute/cloudstack/create_cloudstack_node_keypair_secgroup.py
new file mode 100644
index 0000000..b912fbf
--- /dev/null
+++ b/docs/examples/compute/cloudstack/create_cloudstack_node_keypair_secgroup.py
@@ -0,0 +1,29 @@
+from libcloud.compute.types import Provider
+from libcloud.compute.providers import get_driver
+
+ACCESS_ID = 'your access id'
+SECRET_KEY = 'your secret key'
+HOST = 'hostname or ip address of your management server'
+PATH = 'path to the api endpoint, e.g: /client/api'
+
+SIZE_ID = 'id of the computer offering you want to use'
+IMAGE_ID = 'id of the template you want to use'
+
+# Name of the existing keypair you want to use
+KEYPAIR_NAME = 'keypairname'
+
+# The security groups you want this node to be added to
+SECURITY_GROUP_NAMES = ['secgroup1', 'secgroup2']
+
+cls = get_driver(Provider.CLOUDSTACK)
+driver = cls(key=ACCESS_ID, secret=SECRET_KEY, secure=True,
+ host=HOST, path=PATH)
+
+sizes = driver.list_sizes()
+images = driver.list_images()
+size = [s for s in sizes if s.id == SIZE_ID][0]
+image = [i for i in images if i.id == IMAGE_ID][0]
+
+node = driver.create_node(name='test-node-1', image=image, size=size,
+ ex_security_groups=SECURITY_GROUP_NAMES,
+ ex_keyname=KEYPAIR_NAME)
http://git-wip-us.apache.org/repos/asf/libcloud/blob/b262190c/docs/examples/compute/cloudstack/create_node_advanced_zone.py
----------------------------------------------------------------------
diff --git a/docs/examples/compute/cloudstack/create_node_advanced_zone.py b/docs/examples/compute/cloudstack/create_node_advanced_zone.py
new file mode 100644
index 0000000..a174752
--- /dev/null
+++ b/docs/examples/compute/cloudstack/create_node_advanced_zone.py
@@ -0,0 +1,21 @@
+# List the guest networks
+# This returns a list of CloudStackNetwork objects
+nets = driver.ex_list_networks()
+
+# List the images/templates available
+# This returns a list of NodeImage objects
+images = driver.list_images()
+
+# List the instance types
+# This returns a list of NodeSize objects
+sizes = driver.list_sizes()
+
+# Create the node
+# This returns a Node object
+node = driver.create_node(name='libcloud', image=images[0],
+ size=sizes[0], network=[nets[0]])
+
+# The node has a private IP in the guest network used
+# No public IPs and no rules
+pprint(node.extra)
+pprint(node.private_ips)
http://git-wip-us.apache.org/repos/asf/libcloud/blob/b262190c/docs/examples/compute/cloudstack/deploy_node_with_keypair_security_group.py
----------------------------------------------------------------------
diff --git a/docs/examples/compute/cloudstack/deploy_node_with_keypair_security_group.py b/docs/examples/compute/cloudstack/deploy_node_with_keypair_security_group.py
new file mode 100755
index 0000000..d018142
--- /dev/null
+++ b/docs/examples/compute/cloudstack/deploy_node_with_keypair_security_group.py
@@ -0,0 +1,21 @@
+from libcloud.compute.types import Provider
+from libcloud.compute.providers import get_driver
+
+# Import the deployment specific modules
+from libcloud.compute.deployment import ScriptDeployment
+from libcloud.compute.deployment import MultiStepDeployment
+
+cls = get_driver(Provider.EXOSCALE)
+driver = cls('api key', 'api secret key')
+
+# Define the scripts that you want to run during deployment
+script = ScriptDeployment("/bin/date")
+msd = MultiStepDeployment([script])
+
+node = conn.deploy_node(name='test', image=image, size=size,
+ ssh_key='~/.ssh/id_rsa_test',
+ ex_keyname='test-keypair',
+ deploy=msd)
+
+# The stdout of the deployment can be checked on the `script` object
+script.stdout
http://git-wip-us.apache.org/repos/asf/libcloud/blob/b262190c/docs/examples/compute/cloudstack/instantiate_driver_host_path.py
----------------------------------------------------------------------
diff --git a/docs/examples/compute/cloudstack/instantiate_driver_host_path.py b/docs/examples/compute/cloudstack/instantiate_driver_host_path.py
new file mode 100644
index 0000000..0314ba2
--- /dev/null
+++ b/docs/examples/compute/cloudstack/instantiate_driver_host_path.py
@@ -0,0 +1,4 @@
+host = 'example.com'
+path = '/path/to/api'
+Driver = get_driver(Provider.CLOUDSTACK)
+conn = Driver(key=apikey, secret=secretkey, host=host, path=path)
http://git-wip-us.apache.org/repos/asf/libcloud/blob/b262190c/docs/examples/compute/cloudstack/instantiate_driver_insecure_port.py
----------------------------------------------------------------------
diff --git a/docs/examples/compute/cloudstack/instantiate_driver_insecure_port.py b/docs/examples/compute/cloudstack/instantiate_driver_insecure_port.py
new file mode 100644
index 0000000..a3171e3
--- /dev/null
+++ b/docs/examples/compute/cloudstack/instantiate_driver_insecure_port.py
@@ -0,0 +1,6 @@
+host = 'localhost'
+path = '/path/to/api'
+port = 8080
+Driver = get_driver(Provider.CLOUDSTACK)
+conn = Driver(key=apikey, secret=secretkey, host=host,
+ path=path, port=port, secure=False)
http://git-wip-us.apache.org/repos/asf/libcloud/blob/b262190c/docs/examples/compute/cloudstack/instantiate_driver_url.py
----------------------------------------------------------------------
diff --git a/docs/examples/compute/cloudstack/instantiate_driver_url.py b/docs/examples/compute/cloudstack/instantiate_driver_url.py
new file mode 100644
index 0000000..5fc33b9
--- /dev/null
+++ b/docs/examples/compute/cloudstack/instantiate_driver_url.py
@@ -0,0 +1,3 @@
+url = 'http://example.com/path/to/api'
+Driver = get_driver(Provider.CLOUDSTACK)
+conn = Driver(key=apikey, secret=secretkey, url=url)
http://git-wip-us.apache.org/repos/asf/libcloud/blob/b262190c/docs/examples/compute/cloudstack/port_forwarding_management.py
----------------------------------------------------------------------
diff --git a/docs/examples/compute/cloudstack/port_forwarding_management.py b/docs/examples/compute/cloudstack/port_forwarding_management.py
new file mode 100644
index 0000000..73ec09c
--- /dev/null
+++ b/docs/examples/compute/cloudstack/port_forwarding_management.py
@@ -0,0 +1,15 @@
+# Allocate a public IP
+# This returns a CloudStackAddress object
+driver.ex_allocate_public_ip()
+
+# You can now see this address when listing public IPs
+ip = driver.ex_list_public_ips()[0]
+
+# Create a port forwarding rule for the node
+# This returns a CloudStackPortForwardingRule object
+rule = conn.ex_create_port_forwarding_rule(ip, 22, 22, 'TCP', node)
+pprint(rule)
+
+# The node now has a public IP and a rule associated to it
+print node
+print node.extra
http://git-wip-us.apache.org/repos/asf/libcloud/blob/b262190c/docs/examples/compute/cloudstack/security_groups_management.py
----------------------------------------------------------------------
diff --git a/docs/examples/compute/cloudstack/security_groups_management.py b/docs/examples/compute/cloudstack/security_groups_management.py
new file mode 100644
index 0000000..c8dc37d
--- /dev/null
+++ b/docs/examples/compute/cloudstack/security_groups_management.py
@@ -0,0 +1,30 @@
+import os
+from pprint import pprint
+
+from libcloud.compute.types import Provider
+from libcloud.compute.providers import get_driver
+
+cls = get_driver(Provider.EXOSCALE)
+driver = cls('api key', 'api secret key')
+
+# List all security groups
+sg = driver.ex_list_security_groups()
+pprint(sg)
+
+# Create a new security group.
+security_group = driver.ex_create_security_group(name='test-security-group')
+pprint(security_group)
+
+# Authorize an ingress rule on a security group
+# If `startport` is used alone, this will be the only port open
+# If `endport` is also used then the entire range will be authorized
+sg = driver.ex_authorize_security_group_ingress(securitygroupname=
+ 'test-security-group',
+ protocol='tcp',
+ startport='22',
+ cidrlist='0.0.0.0/0')
+pprint(sg)
+
+# Delete a security group we have previously created
+status = driver.ex_delete_security_group(name='test-security-group')
+pprint(status)
http://git-wip-us.apache.org/repos/asf/libcloud/blob/b262190c/docs/examples/compute/cloudstack/ssh_keypairs_management_exoscale.py
----------------------------------------------------------------------
diff --git a/docs/examples/compute/cloudstack/ssh_keypairs_management_exoscale.py b/docs/examples/compute/cloudstack/ssh_keypairs_management_exoscale.py
new file mode 100644
index 0000000..0779754
--- /dev/null
+++ b/docs/examples/compute/cloudstack/ssh_keypairs_management_exoscale.py
@@ -0,0 +1,28 @@
+import os
+from pprint import pprint
+
+from libcloud.compute.types import Provider
+from libcloud.compute.providers import get_driver
+
+cls = get_driver(Provider.EXOSCALE)
+driver = cls('api key', 'api secret key')
+
+# Create a new key pair. Most providers will return generated private key in
+# the response which can be accessed at key_pair.private_key
+key_pair = driver.create_key_pair(name='test-key-pair-1')
+pprint(key_pair)
+
+# Import an existing public key from a file. If you have public key as a
+# string, you can use import_key_pair_from_string method instead.
+key_file_path = os.path.expanduser('~/.ssh/id_rsa_test.pub')
+key_pair = driver.import_key_pair_from_file(name='test-key-pair-2',
+ key_file_path=key_file_path)
+pprint(key_pair)
+
+# Retrieve information about previously created key pair
+key_pair = driver.get_key_pair(name='test-key-pair-1')
+pprint(key_pair)
+
+# Delete a key pair we have previously created
+status = driver.delete_key_pair(key_pair=key_pair)
+pprint(status)
http://git-wip-us.apache.org/repos/asf/libcloud/blob/b262190c/docs/examples/compute/cloudstack/start_interactive_shell_exoscale.py
----------------------------------------------------------------------
diff --git a/docs/examples/compute/cloudstack/start_interactive_shell_exoscale.py b/docs/examples/compute/cloudstack/start_interactive_shell_exoscale.py
new file mode 100755
index 0000000..3a07756
--- /dev/null
+++ b/docs/examples/compute/cloudstack/start_interactive_shell_exoscale.py
@@ -0,0 +1,14 @@
+from IPython.terminal.embed import InteractiveShellEmbed
+
+from libcloud.compute.types import Provider
+from libcloud.compute.providers import get_driver
+
+apikey = os.getenv('EXOSCALE_API_KEY')
+secretkey = os.getenv('EXOSCALE_SECRET_KEY')
+
+Driver = get_driver(Provider.EXOSCALE)
+
+conn = Driver(key=apikey, secret=secretkey)
+
+shell = InteractiveShellEmbed(banner1="Hello from Libcloud Shell !!")
+shell()
http://git-wip-us.apache.org/repos/asf/libcloud/blob/b262190c/docs/examples/compute/cloudstack/start_interactive_shell_ikoula.py
----------------------------------------------------------------------
diff --git a/docs/examples/compute/cloudstack/start_interactive_shell_ikoula.py b/docs/examples/compute/cloudstack/start_interactive_shell_ikoula.py
new file mode 100755
index 0000000..34d554f
--- /dev/null
+++ b/docs/examples/compute/cloudstack/start_interactive_shell_ikoula.py
@@ -0,0 +1,17 @@
+from IPython.terminal.embed import InteractiveShellEmbed
+
+from libcloud.compute.types import Provider
+from libcloud.compute.providers import get_driver
+import libcloud.security as sec
+
+sec.VERIFY_SSL_CERT = False
+
+apikey = os.getenv('IKOULA_API_KEY')
+secretkey = os.getenv('IKOULA_SECRET_KEY')
+
+Driver = get_driver(Provider.IKOULA)
+
+conn = Driver(key=apikey, secret=secretkey)
+
+shell = InteractiveShellEmbed(banner1="Hello from Libcloud Shell !!")
+shell()
http://git-wip-us.apache.org/repos/asf/libcloud/blob/b262190c/docs/examples/compute/cloudstack/turn_off_ssl_verification.py
----------------------------------------------------------------------
diff --git a/docs/examples/compute/cloudstack/turn_off_ssl_verification.py b/docs/examples/compute/cloudstack/turn_off_ssl_verification.py
new file mode 100644
index 0000000..d7ace61
--- /dev/null
+++ b/docs/examples/compute/cloudstack/turn_off_ssl_verification.py
@@ -0,0 +1,2 @@
+import libcloud.security as sec
+sec.VERIFY_SSL_CERT = False
http://git-wip-us.apache.org/repos/asf/libcloud/blob/b262190c/docs/examples/compute/create_cloudstack_node_keypair_secgroup.py
----------------------------------------------------------------------
diff --git a/docs/examples/compute/create_cloudstack_node_keypair_secgroup.py b/docs/examples/compute/create_cloudstack_node_keypair_secgroup.py
deleted file mode 100644
index b912fbf..0000000
--- a/docs/examples/compute/create_cloudstack_node_keypair_secgroup.py
+++ /dev/null
@@ -1,29 +0,0 @@
-from libcloud.compute.types import Provider
-from libcloud.compute.providers import get_driver
-
-ACCESS_ID = 'your access id'
-SECRET_KEY = 'your secret key'
-HOST = 'hostname or ip address of your management server'
-PATH = 'path to the api endpoint, e.g: /client/api'
-
-SIZE_ID = 'id of the computer offering you want to use'
-IMAGE_ID = 'id of the template you want to use'
-
-# Name of the existing keypair you want to use
-KEYPAIR_NAME = 'keypairname'
-
-# The security groups you want this node to be added to
-SECURITY_GROUP_NAMES = ['secgroup1', 'secgroup2']
-
-cls = get_driver(Provider.CLOUDSTACK)
-driver = cls(key=ACCESS_ID, secret=SECRET_KEY, secure=True,
- host=HOST, path=PATH)
-
-sizes = driver.list_sizes()
-images = driver.list_images()
-size = [s for s in sizes if s.id == SIZE_ID][0]
-image = [i for i in images if i.id == IMAGE_ID][0]
-
-node = driver.create_node(name='test-node-1', image=image, size=size,
- ex_security_groups=SECURITY_GROUP_NAMES,
- ex_keyname=KEYPAIR_NAME)
[3/5] git commit: docs: Fix a typo, it should be "networks",
not "network".
Posted by to...@apache.org.
docs: Fix a typo, it should be "networks", not "network".
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/0434b087
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/0434b087
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/0434b087
Branch: refs/heads/trunk
Commit: 0434b08717c58d5b8bc4aa037f9811df73e73367
Parents: 94e20cb
Author: Tomaz Muraus <to...@apache.org>
Authored: Fri Dec 13 12:51:48 2013 +0100
Committer: Tomaz Muraus <to...@apache.org>
Committed: Fri Dec 13 12:51:48 2013 +0100
----------------------------------------------------------------------
docs/examples/compute/cloudstack/create_node_advanced_zone.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/0434b087/docs/examples/compute/cloudstack/create_node_advanced_zone.py
----------------------------------------------------------------------
diff --git a/docs/examples/compute/cloudstack/create_node_advanced_zone.py b/docs/examples/compute/cloudstack/create_node_advanced_zone.py
index 8334ce6..5f7beae 100644
--- a/docs/examples/compute/cloudstack/create_node_advanced_zone.py
+++ b/docs/examples/compute/cloudstack/create_node_advanced_zone.py
@@ -23,7 +23,7 @@ sizes = driver.list_sizes()
# Create the node
# This returns a Node object
node = driver.create_node(name='libcloud', image=images[0],
- size=sizes[0], network=[nets[0]])
+ size=sizes[0], networks=[nets[0]])
# The node has a private IP in the guest network used
# No public IPs and no rules
[4/5] git commit: docs: Fix some typos and formatting.
Posted by to...@apache.org.
docs: Fix some typos and formatting.
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/9e8a6b98
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/9e8a6b98
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/9e8a6b98
Branch: refs/heads/trunk
Commit: 9e8a6b9836b5704ec4fd58a468c659dd0ec2bd14
Parents: 0434b08
Author: Tomaz Muraus <to...@apache.org>
Authored: Fri Dec 13 12:54:36 2013 +0100
Committer: Tomaz Muraus <to...@apache.org>
Committed: Fri Dec 13 12:54:36 2013 +0100
----------------------------------------------------------------------
docs/compute/drivers/cloudstack.rst | 21 ++++++++++++---------
1 file changed, 12 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/9e8a6b98/docs/compute/drivers/cloudstack.rst
----------------------------------------------------------------------
diff --git a/docs/compute/drivers/cloudstack.rst b/docs/compute/drivers/cloudstack.rst
index e5f0630..4797b40 100644
--- a/docs/compute/drivers/cloudstack.rst
+++ b/docs/compute/drivers/cloudstack.rst
@@ -23,11 +23,11 @@ driver constructor:
* ``key`` - Your CloudStack API key
* ``secret`` - Your CloudStack secret key
* ``host`` - The host of your CloudStack endpoint
- (e.g `localhost` for http://localhost:8080/client/api)
+ (e.g ``localhost`` for ``http://localhost:8080/client/api``)
* ``path`` - The path to your CloudStack endpoint
- (e.g `/client/api` for http://localhost:8080/client/api)
-* ``url`` - The url to your CloudStack endpoint,
- mutually exclusive with `host` and `path`
+ (e.g ``/client/api`` for ``http://localhost:8080/client/api``)
+* ``url`` - The url to your CloudStack endpoint, mutually exclusive with
+ ``host`` and ``path``
* ``secure`` - True or False. True by default
Typically this will lead to:
@@ -35,7 +35,7 @@ Typically this will lead to:
.. literalinclude:: /examples/compute/cloudstack/instantiate_driver_host_path.py
:language: python
-A complete `url` can be used instead:
+A complete ``url`` can be used instead:
.. literalinclude:: /examples/compute/cloudstack/instantiate_driver_url.py
:language: python
@@ -53,6 +53,9 @@ certificate, you will have to disable the SSL verification like so:
.. literalinclude:: /examples/compute/cloudstack/turn_off_ssl_verification.py
:language: python
+For more information on how SSL certificate validation works in Libcloud, see
+the :doc:`SSL Certificate Validation </other/ssl-certificate-validation>` page.
+
`libcloud` now features CloudStack based drivers for the `exoscale`_ and
`ikoula`_ public clouds. Instantiating drivers to those clouds is shown
in the example section below.
@@ -91,9 +94,9 @@ Basic Zone Examples
--------------------
To start experimenting with libcloud, starting an ipython interactive shell can
- be very handy. Tab completion and shell history are available. Below is an
- example of starting such an interactive shell for the exoscale public cloud.
- Once started you can explore the libcloud API.
+be very handy. Tab completion and shell history are available. Below is an
+example of starting such an interactive shell for the exoscale public cloud.
+Once started you can explore the libcloud API.
1. Start an interactive shell on Exoscale public cloud
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -135,7 +138,7 @@ Currently there is no security group class defined, hence the result of
5. Deploying a node with a keypair
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-Executing deployment scripts when creating node is currently only support in
+Executing deployment scripts when creating node is currently only supported in
basic zones. The `deploy_node` method is used instead of the `create_node`,
ssh key are passed as arguments as well as a list of scripts.
[5/5] git commit: Re-generate documentation fixtures.
Posted by to...@apache.org.
Re-generate documentation fixtures.
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/9e073990
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/9e073990
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/9e073990
Branch: refs/heads/trunk
Commit: 9e073990ec80a2011ef1b77ec760ea2fa64b35c4
Parents: 9e8a6b9
Author: Tomaz Muraus <to...@apache.org>
Authored: Fri Dec 13 13:05:30 2013 +0100
Committer: Tomaz Muraus <to...@apache.org>
Committed: Fri Dec 13 13:05:30 2013 +0100
----------------------------------------------------------------------
docs/compute/_supported_providers.rst | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/9e073990/docs/compute/_supported_providers.rst
----------------------------------------------------------------------
diff --git a/docs/compute/_supported_providers.rst b/docs/compute/_supported_providers.rst
index e20bfad..e43b2a9 100644
--- a/docs/compute/_supported_providers.rst
+++ b/docs/compute/_supported_providers.rst
@@ -7,7 +7,7 @@ Provider Documentation
`CloudFrames`_ :doc:`Click </compute/drivers/cloudframes>` CLOUDFRAMES :mod:`libcloud.compute.drivers.cloudframes` :class:`CloudFramesNodeDriver`
`CloudSigma`_ CLOUDSIGMA :mod:`libcloud.compute.drivers.cloudsigma` :class:`CloudSigmaZrhNodeDriver`
`CloudSigma`_ CLOUDSIGMA_US :mod:`libcloud.compute.drivers.cloudsigma` :class:`CloudSigmaLvsNodeDriver`
-`CloudStack`_ :doc:`Click </compute/drivers/cloudstack>` CLOUDSTACK :mod:`libcloud.compute.drivers.cloudstack` :class:`CloudStackNodeDriver`
+`CloudStack`_ :doc:`Click </compute/drivers/cloudstack>` CLOUDSTACK :mod:`libcloud.compute.drivers.cloudstack` :class:`CloudStackNodeDriver`
`Digital Ocean`_ DIGITAL_OCEAN :mod:`libcloud.compute.drivers.digitalocean` :class:`DigitalOceanNodeDriver`
`Dreamhost`_ DREAMHOST :mod:`libcloud.compute.drivers.dreamhost` :class:`DreamhostNodeDriver`
`Amazon EC2`_ :doc:`Click </compute/drivers/ec2>` EC2 :mod:`libcloud.compute.drivers.ec2` :class:`EC2NodeDriver`
[2/5] git commit: docs: Promote some CloudStack code snippets to full
blown code examples which can be run directly and add missing imports and
variables.
Posted by to...@apache.org.
docs: Promote some CloudStack code snippets to full blown code examples which
can be run directly and add missing imports and variables.
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/94e20cb1
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/94e20cb1
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/94e20cb1
Branch: refs/heads/trunk
Commit: 94e20cb1ce28ee206f01c105364a81176f631223
Parents: b262190
Author: Tomaz Muraus <to...@apache.org>
Authored: Fri Dec 13 12:50:05 2013 +0100
Committer: Tomaz Muraus <to...@apache.org>
Committed: Fri Dec 13 12:50:05 2013 +0100
----------------------------------------------------------------------
.../cloudstack/create_node_advanced_zone.py | 12 +++++++++++-
.../deploy_node_with_keypair_security_group.py | 17 +++++++++++------
.../cloudstack/instantiate_driver_host_path.py | 6 ++++++
.../cloudstack/instantiate_driver_insecure_port.py | 6 ++++++
.../compute/cloudstack/instantiate_driver_url.py | 6 ++++++
.../cloudstack/port_forwarding_management.py | 13 ++++++++++++-
.../cloudstack/security_groups_management.py | 1 -
.../cloudstack/start_interactive_shell_exoscale.py | 4 +++-
.../cloudstack/start_interactive_shell_ikoula.py | 4 +++-
9 files changed, 58 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/94e20cb1/docs/examples/compute/cloudstack/create_node_advanced_zone.py
----------------------------------------------------------------------
diff --git a/docs/examples/compute/cloudstack/create_node_advanced_zone.py b/docs/examples/compute/cloudstack/create_node_advanced_zone.py
index a174752..8334ce6 100644
--- a/docs/examples/compute/cloudstack/create_node_advanced_zone.py
+++ b/docs/examples/compute/cloudstack/create_node_advanced_zone.py
@@ -1,4 +1,14 @@
-# List the guest networks
+from pprint import pprint
+
+from libcloud.compute.types import Provider
+from libcloud.compute.providers import get_driver
+
+apikey = 'your api key'
+secretkey = 'your secret key'
+
+Driver = get_driver(Provider.IKOULA)
+driver = Driver(key=apikey, secret=secretkey)
+
# This returns a list of CloudStackNetwork objects
nets = driver.ex_list_networks()
http://git-wip-us.apache.org/repos/asf/libcloud/blob/94e20cb1/docs/examples/compute/cloudstack/deploy_node_with_keypair_security_group.py
----------------------------------------------------------------------
diff --git a/docs/examples/compute/cloudstack/deploy_node_with_keypair_security_group.py b/docs/examples/compute/cloudstack/deploy_node_with_keypair_security_group.py
index d018142..bef682c 100755
--- a/docs/examples/compute/cloudstack/deploy_node_with_keypair_security_group.py
+++ b/docs/examples/compute/cloudstack/deploy_node_with_keypair_security_group.py
@@ -1,3 +1,5 @@
+from pprint import pprint
+
from libcloud.compute.types import Provider
from libcloud.compute.providers import get_driver
@@ -8,14 +10,17 @@ from libcloud.compute.deployment import MultiStepDeployment
cls = get_driver(Provider.EXOSCALE)
driver = cls('api key', 'api secret key')
+image = driver.list_images()[0]
+size = driver.list_sizes()[0]
+
# Define the scripts that you want to run during deployment
-script = ScriptDeployment("/bin/date")
+script = ScriptDeployment('/bin/date')
msd = MultiStepDeployment([script])
-node = conn.deploy_node(name='test', image=image, size=size,
- ssh_key='~/.ssh/id_rsa_test',
- ex_keyname='test-keypair',
- deploy=msd)
+node = driver.deploy_node(name='test', image=image, size=size,
+ ssh_key='~/.ssh/id_rsa_test',
+ ex_keyname='test-keypair',
+ deploy=msd)
# The stdout of the deployment can be checked on the `script` object
-script.stdout
+pprint(script.stdout)
http://git-wip-us.apache.org/repos/asf/libcloud/blob/94e20cb1/docs/examples/compute/cloudstack/instantiate_driver_host_path.py
----------------------------------------------------------------------
diff --git a/docs/examples/compute/cloudstack/instantiate_driver_host_path.py b/docs/examples/compute/cloudstack/instantiate_driver_host_path.py
index 0314ba2..22fb9de 100644
--- a/docs/examples/compute/cloudstack/instantiate_driver_host_path.py
+++ b/docs/examples/compute/cloudstack/instantiate_driver_host_path.py
@@ -1,4 +1,10 @@
+from libcloud.compute.types import Provider
+from libcloud.compute.providers import get_driver
+
+apikey = 'your api key'
+secretkey = 'your secret key'
host = 'example.com'
path = '/path/to/api'
+
Driver = get_driver(Provider.CLOUDSTACK)
conn = Driver(key=apikey, secret=secretkey, host=host, path=path)
http://git-wip-us.apache.org/repos/asf/libcloud/blob/94e20cb1/docs/examples/compute/cloudstack/instantiate_driver_insecure_port.py
----------------------------------------------------------------------
diff --git a/docs/examples/compute/cloudstack/instantiate_driver_insecure_port.py b/docs/examples/compute/cloudstack/instantiate_driver_insecure_port.py
index a3171e3..0acca19 100644
--- a/docs/examples/compute/cloudstack/instantiate_driver_insecure_port.py
+++ b/docs/examples/compute/cloudstack/instantiate_driver_insecure_port.py
@@ -1,6 +1,12 @@
+from libcloud.compute.types import Provider
+from libcloud.compute.providers import get_driver
+
+apikey = 'your api key'
+secretkey = 'your secret key'
host = 'localhost'
path = '/path/to/api'
port = 8080
+
Driver = get_driver(Provider.CLOUDSTACK)
conn = Driver(key=apikey, secret=secretkey, host=host,
path=path, port=port, secure=False)
http://git-wip-us.apache.org/repos/asf/libcloud/blob/94e20cb1/docs/examples/compute/cloudstack/instantiate_driver_url.py
----------------------------------------------------------------------
diff --git a/docs/examples/compute/cloudstack/instantiate_driver_url.py b/docs/examples/compute/cloudstack/instantiate_driver_url.py
index 5fc33b9..8307380 100644
--- a/docs/examples/compute/cloudstack/instantiate_driver_url.py
+++ b/docs/examples/compute/cloudstack/instantiate_driver_url.py
@@ -1,3 +1,9 @@
+from libcloud.compute.types import Provider
+from libcloud.compute.providers import get_driver
+
+apikey = 'your api key'
+secretkey = 'your secret key'
url = 'http://example.com/path/to/api'
+
Driver = get_driver(Provider.CLOUDSTACK)
conn = Driver(key=apikey, secret=secretkey, url=url)
http://git-wip-us.apache.org/repos/asf/libcloud/blob/94e20cb1/docs/examples/compute/cloudstack/port_forwarding_management.py
----------------------------------------------------------------------
diff --git a/docs/examples/compute/cloudstack/port_forwarding_management.py b/docs/examples/compute/cloudstack/port_forwarding_management.py
index 73ec09c..e767dfc 100644
--- a/docs/examples/compute/cloudstack/port_forwarding_management.py
+++ b/docs/examples/compute/cloudstack/port_forwarding_management.py
@@ -1,3 +1,11 @@
+from pprint import pprint
+
+from libcloud.compute.types import Provider
+from libcloud.compute.providers import get_driver
+
+cls = get_driver(Provider.EXOSCALE)
+driver = cls('api key', 'api secret key')
+
# Allocate a public IP
# This returns a CloudStackAddress object
driver.ex_allocate_public_ip()
@@ -5,11 +13,14 @@ driver.ex_allocate_public_ip()
# You can now see this address when listing public IPs
ip = driver.ex_list_public_ips()[0]
+node = driver.list_nodes()[0]
+
# Create a port forwarding rule for the node
# This returns a CloudStackPortForwardingRule object
-rule = conn.ex_create_port_forwarding_rule(ip, 22, 22, 'TCP', node)
+rule = driver.ex_create_port_forwarding_rule(ip, 22, 22, 'TCP', node)
pprint(rule)
+
# The node now has a public IP and a rule associated to it
print node
print node.extra
http://git-wip-us.apache.org/repos/asf/libcloud/blob/94e20cb1/docs/examples/compute/cloudstack/security_groups_management.py
----------------------------------------------------------------------
diff --git a/docs/examples/compute/cloudstack/security_groups_management.py b/docs/examples/compute/cloudstack/security_groups_management.py
index c8dc37d..5e12a13 100644
--- a/docs/examples/compute/cloudstack/security_groups_management.py
+++ b/docs/examples/compute/cloudstack/security_groups_management.py
@@ -1,4 +1,3 @@
-import os
from pprint import pprint
from libcloud.compute.types import Provider
http://git-wip-us.apache.org/repos/asf/libcloud/blob/94e20cb1/docs/examples/compute/cloudstack/start_interactive_shell_exoscale.py
----------------------------------------------------------------------
diff --git a/docs/examples/compute/cloudstack/start_interactive_shell_exoscale.py b/docs/examples/compute/cloudstack/start_interactive_shell_exoscale.py
index 3a07756..979a6b7 100755
--- a/docs/examples/compute/cloudstack/start_interactive_shell_exoscale.py
+++ b/docs/examples/compute/cloudstack/start_interactive_shell_exoscale.py
@@ -1,3 +1,5 @@
+import os
+
from IPython.terminal.embed import InteractiveShellEmbed
from libcloud.compute.types import Provider
@@ -10,5 +12,5 @@ Driver = get_driver(Provider.EXOSCALE)
conn = Driver(key=apikey, secret=secretkey)
-shell = InteractiveShellEmbed(banner1="Hello from Libcloud Shell !!")
+shell = InteractiveShellEmbed(banner1='Hello from Libcloud Shell !!')
shell()
http://git-wip-us.apache.org/repos/asf/libcloud/blob/94e20cb1/docs/examples/compute/cloudstack/start_interactive_shell_ikoula.py
----------------------------------------------------------------------
diff --git a/docs/examples/compute/cloudstack/start_interactive_shell_ikoula.py b/docs/examples/compute/cloudstack/start_interactive_shell_ikoula.py
index 34d554f..895bcae 100755
--- a/docs/examples/compute/cloudstack/start_interactive_shell_ikoula.py
+++ b/docs/examples/compute/cloudstack/start_interactive_shell_ikoula.py
@@ -1,3 +1,5 @@
+import os
+
from IPython.terminal.embed import InteractiveShellEmbed
from libcloud.compute.types import Provider
@@ -13,5 +15,5 @@ Driver = get_driver(Provider.IKOULA)
conn = Driver(key=apikey, secret=secretkey)
-shell = InteractiveShellEmbed(banner1="Hello from Libcloud Shell !!")
+shell = InteractiveShellEmbed(banner1='Hello from Libcloud Shell !!')
shell()