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/01/31 23:12:55 UTC

[8/9] git commit: docs: Add example.

docs: Add example.


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

Branch: refs/heads/trunk
Commit: 25ed7adc4d2b56e7b963b14c1d4e9cec7405a646
Parents: e69c865
Author: Tomaz Muraus <to...@apache.org>
Authored: Fri Jan 31 22:56:27 2014 +0100
Committer: Tomaz Muraus <to...@apache.org>
Committed: Fri Jan 31 22:57:21 2014 +0100

----------------------------------------------------------------------
 .../create_server_using_installation_cd.py      | 26 ++++++++++++++++++++
 1 file changed, 26 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/25ed7adc/docs/examples/compute/cloudsigma/create_server_using_installation_cd.py
----------------------------------------------------------------------
diff --git a/docs/examples/compute/cloudsigma/create_server_using_installation_cd.py b/docs/examples/compute/cloudsigma/create_server_using_installation_cd.py
new file mode 100644
index 0000000..16f0fe9
--- /dev/null
+++ b/docs/examples/compute/cloudsigma/create_server_using_installation_cd.py
@@ -0,0 +1,26 @@
+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')
+
+name = 'test node'
+size = driver.list_sizes()[0]
+
+drives = driver.ex_list_library_drives()
+image = [drive for drive in drives if drive.name == 'FreeBSD 8.2' and
+         drive.media == 'cdrom'][0]
+
+# 1. Create a node
+node = driver.create_node(name=name, size=size, image=image)
+print(node)
+
+# 2. Wait for node to come online
+driver.wait_until_running(nodes=[node])
+
+# 3. Enable and obtain VNC URL so we can connect to the VNC server and walk
+# through the installation process
+tunnel_url = driver.ex_open_vnc_tunnel(node=node)
+
+print('VNC tunnel URL: %s' % (tunnel_url))
+print('VNC password: %s' % (node.extra['vnc_password']))