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:48 UTC

[1/9] git commit: Use virtio device type.

Updated Branches:
  refs/heads/trunk 016034be2 -> ec86c9554


Use virtio device type.


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

Branch: refs/heads/trunk
Commit: 73c62ff4c1582b6c75b6d8154307c04d03af979c
Parents: 016034b
Author: Tomaz Muraus <to...@apache.org>
Authored: Fri Jan 31 21:55:31 2014 +0100
Committer: Tomaz Muraus <to...@apache.org>
Committed: Fri Jan 31 21:55:31 2014 +0100

----------------------------------------------------------------------
 libcloud/compute/drivers/cloudsigma.py | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/73c62ff4/libcloud/compute/drivers/cloudsigma.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/cloudsigma.py b/libcloud/compute/drivers/cloudsigma.py
index 4fa432c..883de6c 100644
--- a/libcloud/compute/drivers/cloudsigma.py
+++ b/libcloud/compute/drivers/cloudsigma.py
@@ -1110,7 +1110,8 @@ class CloudSigma_2_0_NodeDriver(CloudSigmaNodeDriver):
         # 2. Resize drive to the desired disk size if the desired disk size is
         # larger than the cloned drive size.
         if drive_size > drive.size:
-            drive = self.ex_resize_drive(drive=drive, size=drive_size)
+            pass
+            #drive = self.ex_resize_drive(drive=drive, size=drive_size)
 
         # Wait for drive resize to finish
         drive = self._wait_for_drive_state_transition(drive=drive,
@@ -1151,10 +1152,12 @@ class CloudSigma_2_0_NodeDriver(CloudSigmaNodeDriver):
         drive = {
             'boot_order': 1,
             'dev_channel': '0:0',
-            'device': 'ide',
+            'device': 'virtio',
             'drive': drive.id
         }
 
+        # ide for cdrom
+
         drives = [drive]
 
         data['nics'] = nics


[2/9] git commit: ex_list_drives -> ex_list_user_drives.

Posted by to...@apache.org.
ex_list_drives -> ex_list_user_drives.


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

Branch: refs/heads/trunk
Commit: 7e3f74a47d571292b0e08ecf575852ff17ae0c98
Parents: 73c62ff
Author: Tomaz Muraus <to...@apache.org>
Authored: Fri Jan 31 22:26:34 2014 +0100
Committer: Tomaz Muraus <to...@apache.org>
Committed: Fri Jan 31 22:26:34 2014 +0100

----------------------------------------------------------------------
 libcloud/compute/drivers/cloudsigma.py        |  6 +++---
 libcloud/test/compute/test_cloudsigma_v2_0.py | 12 ++++++------
 2 files changed, 9 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/7e3f74a4/libcloud/compute/drivers/cloudsigma.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/cloudsigma.py b/libcloud/compute/drivers/cloudsigma.py
index 883de6c..6a9d0a0 100644
--- a/libcloud/compute/drivers/cloudsigma.py
+++ b/libcloud/compute/drivers/cloudsigma.py
@@ -1046,8 +1046,8 @@ class CloudSigma_2_0_NodeDriver(CloudSigmaNodeDriver):
         """
         Return a list of available pre-installed library drives.
 
-        Note: If you want to list all the available images and drives, use
-        :meth:`ex_list_drives` method.
+        Note: If you want to list all the available library drives, use 
+        :meth:`ex_list_library_drives` method.
         """
         response = self.connection.request(action='/libdrives/').object
         images = [self._to_image(data=item) for item in response['objects']]
@@ -1315,7 +1315,7 @@ class CloudSigma_2_0_NodeDriver(CloudSigmaNodeDriver):
 
     # Drive extension methods
 
-    def ex_list_drives(self):
+    def ex_list_user_drives(self):
         """
         Return a list of all the available user's drives.
 

http://git-wip-us.apache.org/repos/asf/libcloud/blob/7e3f74a4/libcloud/test/compute/test_cloudsigma_v2_0.py
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/test_cloudsigma_v2_0.py b/libcloud/test/compute/test_cloudsigma_v2_0.py
index 349858e..6dd2ffe 100644
--- a/libcloud/test/compute/test_cloudsigma_v2_0.py
+++ b/libcloud/test/compute/test_cloudsigma_v2_0.py
@@ -165,8 +165,8 @@ class CloudSigmaAPI20BaseTestCase(object):
         status = self.driver.ex_close_vnc_tunnel(node=node)
         self.assertTrue(status)
 
-    def test_ex_list_drives(self):
-        drives = self.driver.ex_list_drives()
+    def test_ex_list_user_drives(self):
+        drives = self.driver.ex_list_user_drives()
 
         drive = drives[0]
         self.assertEqual(drive.name, 'test node 2-drive')
@@ -185,14 +185,14 @@ class CloudSigmaAPI20BaseTestCase(object):
         self.assertEqual(drive.media, 'disk')
 
     def test_ex_clone_drive(self):
-        drive = self.driver.ex_list_drives()[0]
+        drive = self.driver.ex_list_user_drives()[0]
         cloned_drive = self.driver.ex_clone_drive(drive=drive,
                                                   name='cloned drive')
 
         self.assertEqual(cloned_drive.name, 'cloned drive')
 
     def test_ex_resize_drive(self):
-        drive = self.driver.ex_list_drives()[0]
+        drive = self.driver.ex_list_user_drives()[0]
 
         size = 1111 * 1024 * 1024
 
@@ -399,7 +399,7 @@ class CloudSigmaAPI20BaseTestCase(object):
         self.assertEqual(len(groups[0]), 11)
 
     def test_wait_for_drive_state_transition_timeout(self):
-        drive = self.driver.ex_list_drives()[0]
+        drive = self.driver.ex_list_user_drives()[0]
         state = 'timeout'
 
         expected_msg = 'Timed out while waiting for drive transition'
@@ -409,7 +409,7 @@ class CloudSigmaAPI20BaseTestCase(object):
                                 timeout=0.5)
 
     def test_wait_for_drive_state_transition_success(self):
-        drive = self.driver.ex_list_drives()[0]
+        drive = self.driver.ex_list_user_drives()[0]
         state = 'unmounted'
 
         drive = self.driver._wait_for_drive_state_transition(drive=drive,


[6/9] git commit: Use a separate method to detect an installation cd.

Posted by to...@apache.org.
Use a separate method to detect an installation cd.


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

Branch: refs/heads/trunk
Commit: ca7fb9090155c661dcb5c7d5fa83fa07924ccf1d
Parents: b6926db
Author: Tomaz Muraus <to...@apache.org>
Authored: Fri Jan 31 22:51:08 2014 +0100
Committer: Tomaz Muraus <to...@apache.org>
Committed: Fri Jan 31 22:51:08 2014 +0100

----------------------------------------------------------------------
 libcloud/compute/drivers/cloudsigma.py | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/ca7fb909/libcloud/compute/drivers/cloudsigma.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/cloudsigma.py b/libcloud/compute/drivers/cloudsigma.py
index 647ac39..2288fc4 100644
--- a/libcloud/compute/drivers/cloudsigma.py
+++ b/libcloud/compute/drivers/cloudsigma.py
@@ -1089,7 +1089,7 @@ class CloudSigma_2_0_NodeDriver(CloudSigmaNodeDriver):
                         and 1 with the provided VLAN.
         :type ex_vlan: ``str``
         """
-        # Only pre-installed images can be used with create_node
+        is_installation_cd = self._is_installation_cd(image=image)
 
         if ex_vnc_password:
             vnc_password = ex_vnc_password
@@ -1111,8 +1111,7 @@ class CloudSigma_2_0_NodeDriver(CloudSigmaNodeDriver):
         # 2. Resize drive to the desired disk size if the desired disk size is
         # larger than the cloned drive size.
         if drive_size > drive.size:
-            pass
-            #drive = self.ex_resize_drive(drive=drive, size=drive_size)
+            drive = self.ex_resize_drive(drive=drive, size=drive_size)
 
         # Wait for drive resize to finish
         drive = self._wait_for_drive_state_transition(drive=drive,
@@ -1151,7 +1150,7 @@ class CloudSigma_2_0_NodeDriver(CloudSigmaNodeDriver):
             nics.append(nic)
 
         # Need to use IDE for installation CDs
-        if isinstance(image, CloudSigmaDrive) and image.media == 'cdrom':
+        if is_installation_cd:
             device_type = 'ide'
         else:
             device_type = 'virtio'
@@ -1163,8 +1162,6 @@ class CloudSigma_2_0_NodeDriver(CloudSigmaNodeDriver):
             'drive': drive.id
         }
 
-        # ide for cdrom
-
         drives = [drive]
 
         data['nics'] = nics
@@ -1996,6 +1993,17 @@ class CloudSigma_2_0_NodeDriver(CloudSigmaNodeDriver):
                                            params=params, data=data)
         return response
 
+    def _is_installation_cd(self, image):
+        """
+        Detect if the provided image is an installation CD.
+
+        :rtype: ``bool``
+        """
+        if isinstance(image, CloudSigmaDrive) and image.media == 'cdrom':
+            return True
+
+        return False
+
     def _extract_values(self, obj, keys):
         """
         Extract values from a dictionary and return a new dictionary with


[5/9] git commit: docs: Add an example which shows how to create a server using an installation cd.

Posted by to...@apache.org.
docs: Add an example which shows how to create a server using an installation
cd.


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

Branch: refs/heads/trunk
Commit: b6926dbf6003ac792b64d01d6683ad52c5e86dd4
Parents: 9862346
Author: Tomaz Muraus <to...@apache.org>
Authored: Fri Jan 31 22:49:06 2014 +0100
Committer: Tomaz Muraus <to...@apache.org>
Committed: Fri Jan 31 22:49:06 2014 +0100

----------------------------------------------------------------------
 docs/compute/drivers/cloudsigma.rst | 27 ++++++++++++++++++++++-----
 1 file changed, 22 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/b6926dbf/docs/compute/drivers/cloudsigma.rst
----------------------------------------------------------------------
diff --git a/docs/compute/drivers/cloudsigma.rst b/docs/compute/drivers/cloudsigma.rst
index 831ac15..781e489 100644
--- a/docs/compute/drivers/cloudsigma.rst
+++ b/docs/compute/drivers/cloudsigma.rst
@@ -57,7 +57,7 @@ to
 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_drives`
+:class:`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
@@ -114,6 +114,23 @@ and one with the provided VLAN.
 .. literalinclude:: /examples/compute/cloudsigma/create_server_with_vlan.py
    :language: python
 
+Create a server using an installation CD
+----------------------------------------
+
+This example shows how to create a server using an installation CD instead
+of a pre-installed drive (all the other create server examples in this section
+assume you are using a pre-installed drive).
+
+Creating a server using an installation CD means that you can't directly use
+the server after it has been created. Instead, you need to connect to the
+server using VNC and walk-through the installation process.
+
+The example bellow shows how to create a server using FreeBSD 8.2 installation
+CD.
+
+.. literalinclude:: /examples/compute/cloudsigma/create_server_using_installation_cd.py
+   :language: python
+
 Associate metadata with a server upon creation
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
@@ -157,8 +174,8 @@ method.
 .. literalinclude:: /examples/compute/cloudsigma/open_vnc_tunnel.py
    :language: python
 
-8. Attach firewall policy to the server
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+Attach firewall policy to the server
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 CloudSigma allows you to restrict access to your servers by using firewall
 policies. This example shows how to attach an existing policy to all your
@@ -167,8 +184,8 @@ servers tagged with ``database-server``.
 .. literalinclude:: /examples/compute/cloudsigma/attach_firewall_policy.py
    :language: python
 
-9. Starting a server in a different availability group using avoid functionality
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+Starting a server in a different availability group using avoid functionality
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 CloudSigma allows you to specify a list of server UUIDs which to avoid when
 starting a server.


[7/9] git commit: No need to clone installation CDs, update docstring.

Posted by to...@apache.org.
No need to clone installation CDs, update docstring.


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

Branch: refs/heads/trunk
Commit: e69c865ee3c215cca382e6c4ed8926b15accb25a
Parents: ca7fb90
Author: Tomaz Muraus <to...@apache.org>
Authored: Fri Jan 31 22:54:39 2014 +0100
Committer: Tomaz Muraus <to...@apache.org>
Committed: Fri Jan 31 22:56:04 2014 +0100

----------------------------------------------------------------------
 libcloud/compute/drivers/cloudsigma.py | 46 ++++++++++++++++++-----------
 1 file changed, 29 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/e69c865e/libcloud/compute/drivers/cloudsigma.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/cloudsigma.py b/libcloud/compute/drivers/cloudsigma.py
index 2288fc4..833dea2 100644
--- a/libcloud/compute/drivers/cloudsigma.py
+++ b/libcloud/compute/drivers/cloudsigma.py
@@ -1065,12 +1065,20 @@ class CloudSigma_2_0_NodeDriver(CloudSigmaNodeDriver):
         """
         Create a new server.
 
-        Server creation consists of 4 separate steps:
+        Server creation consists multiple steps depending on the type of the
+        image used.
 
-        1. Clone provided library drive so we can use it
-        2. Resize cloned drive to the desired size
-        3. Create a server and attach cloned drive
-        4. Start a server.
+        1. Installation CD:
+
+            1. Create a server and attach installation cd
+            2. Start a server
+
+        2. Pre-installed image:
+
+            1. Clone provided library drive so we can use it
+            2. Resize cloned drive to the desired size
+            3. Create a server and attach cloned drive
+            4. Start a server
 
         :param ex_metadata: Key / value pairs to associate with the
                             created node. (optional)
@@ -1101,21 +1109,25 @@ class CloudSigma_2_0_NodeDriver(CloudSigmaNodeDriver):
         drive_size = (size.disk * 1024 * 1024 * 1024)  # size is specified in
                                                        # GB
 
-        # 1. Clone library drive so we can use it
-        drive = self.ex_clone_drive(drive=image, name=drive_name)
+        if not is_installation_cd:
+            # 1. Clone library drive so we can use it
+            drive = self.ex_clone_drive(drive=image, name=drive_name)
 
-        # Wait for drive clone to finish
-        drive = self._wait_for_drive_state_transition(drive=drive,
-                                                      state='unmounted')
+            # Wait for drive clone to finish
+            drive = self._wait_for_drive_state_transition(drive=drive,
+                                                          state='unmounted')
 
-        # 2. Resize drive to the desired disk size if the desired disk size is
-        # larger than the cloned drive size.
-        if drive_size > drive.size:
-            drive = self.ex_resize_drive(drive=drive, size=drive_size)
+            # 2. Resize drive to the desired disk size if the desired disk size
+            # is larger than the cloned drive size.
+            if drive_size > drive.size:
+                drive = self.ex_resize_drive(drive=drive, size=drive_size)
 
-        # Wait for drive resize to finish
-        drive = self._wait_for_drive_state_transition(drive=drive,
-                                                      state='unmounted')
+            # Wait for drive resize to finish
+            drive = self._wait_for_drive_state_transition(drive=drive,
+                                                          state='unmounted')
+        else:
+            # No need to clone installation CDs
+            drive = image
 
         # 3. Create server and attach cloned drive
         # ide 0:0


[3/9] git commit: Add ex_list_library_drives method.

Posted by to...@apache.org.
Add ex_list_library_drives method.


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

Branch: refs/heads/trunk
Commit: 5d0123ca20bdfff1d8c5ae597a52395301d621dd
Parents: 7e3f74a
Author: Tomaz Muraus <to...@apache.org>
Authored: Fri Jan 31 22:41:56 2014 +0100
Committer: Tomaz Muraus <to...@apache.org>
Committed: Fri Jan 31 22:41:56 2014 +0100

----------------------------------------------------------------------
 libcloud/compute/drivers/cloudsigma.py | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/5d0123ca/libcloud/compute/drivers/cloudsigma.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/cloudsigma.py b/libcloud/compute/drivers/cloudsigma.py
index 6a9d0a0..110ace7 100644
--- a/libcloud/compute/drivers/cloudsigma.py
+++ b/libcloud/compute/drivers/cloudsigma.py
@@ -1046,13 +1046,14 @@ class CloudSigma_2_0_NodeDriver(CloudSigmaNodeDriver):
         """
         Return a list of available pre-installed library drives.
 
-        Note: If you want to list all the available library drives, use 
-        :meth:`ex_list_library_drives` method.
+        Note: If you want to list all the available library drives (both
+        pre-installed and installation CDs), use :meth:`ex_list_library_drives`
+        method.
         """
         response = self.connection.request(action='/libdrives/').object
         images = [self._to_image(data=item) for item in response['objects']]
 
-        # We filter out non pre-installed library drives by defafault because
+        # We filter out non pre-installed library drives by default because
         # they can't be used directly following a default Libcloud server
         # creation flow.
         images = [image for image in images if
@@ -1315,6 +1316,17 @@ class CloudSigma_2_0_NodeDriver(CloudSigmaNodeDriver):
 
     # Drive extension methods
 
+    def ex_list_library_drives(self):
+        """
+        Return a list of all the available library drives (pre-installed and
+        installation CDs).
+
+        :rtype: ``list`` of :class:`.CloudSigmaDrive` objects
+        """
+        response = self.connection.request(action='/libdrives/').object
+        drives = [self._to_drive(data=item) for item in response['objects']]
+        return drives
+
     def ex_list_user_drives(self):
         """
         Return a list of all the available user's drives.


[4/9] git commit: If user specifies an installation CD image, use ide instead of virtio device type.

Posted by to...@apache.org.
If user specifies an installation CD image, use ide instead of virtio device
type.


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

Branch: refs/heads/trunk
Commit: 98623468870b6afe2f1719eccd36612c9cb15614
Parents: 5d0123c
Author: Tomaz Muraus <to...@apache.org>
Authored: Fri Jan 31 22:47:03 2014 +0100
Committer: Tomaz Muraus <to...@apache.org>
Committed: Fri Jan 31 22:47:03 2014 +0100

----------------------------------------------------------------------
 libcloud/compute/drivers/cloudsigma.py | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/98623468/libcloud/compute/drivers/cloudsigma.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/cloudsigma.py b/libcloud/compute/drivers/cloudsigma.py
index 110ace7..647ac39 100644
--- a/libcloud/compute/drivers/cloudsigma.py
+++ b/libcloud/compute/drivers/cloudsigma.py
@@ -1150,10 +1150,16 @@ class CloudSigma_2_0_NodeDriver(CloudSigmaNodeDriver):
             }
             nics.append(nic)
 
+        # Need to use IDE for installation CDs
+        if isinstance(image, CloudSigmaDrive) and image.media == 'cdrom':
+            device_type = 'ide'
+        else:
+            device_type = 'virtio'
+
         drive = {
             'boot_order': 1,
             'dev_channel': '0:0',
-            'device': 'virtio',
+            'device': device_type,
             'drive': drive.id
         }
 


[9/9] git commit: Add test for ex_list_library_drives method.

Posted by to...@apache.org.
Add test for ex_list_library_drives method.


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

Branch: refs/heads/trunk
Commit: ec86c955469a51bfd5a732bfce811406e725f319
Parents: 25ed7ad
Author: Tomaz Muraus <to...@apache.org>
Authored: Fri Jan 31 23:00:08 2014 +0100
Committer: Tomaz Muraus <to...@apache.org>
Committed: Fri Jan 31 23:00:08 2014 +0100

----------------------------------------------------------------------
 libcloud/test/compute/test_cloudsigma_v2_0.py | 9 +++++++++
 1 file changed, 9 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/ec86c955/libcloud/test/compute/test_cloudsigma_v2_0.py
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/test_cloudsigma_v2_0.py b/libcloud/test/compute/test_cloudsigma_v2_0.py
index 6dd2ffe..6258a29 100644
--- a/libcloud/test/compute/test_cloudsigma_v2_0.py
+++ b/libcloud/test/compute/test_cloudsigma_v2_0.py
@@ -165,6 +165,15 @@ class CloudSigmaAPI20BaseTestCase(object):
         status = self.driver.ex_close_vnc_tunnel(node=node)
         self.assertTrue(status)
 
+    def test_ex_list_library_drives(self):
+        drives = self.driver.ex_list_library_drives()
+
+        drive = drives[0]
+        self.assertEqual(drive.name, 'IPCop 2.0.2')
+        self.assertEqual(drive.size, 1000000000)
+        self.assertEqual(drive.media, 'cdrom')
+        self.assertEqual(drive.status, 'unmounted')
+
     def test_ex_list_user_drives(self):
         drives = self.driver.ex_list_user_drives()
 


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

Posted by to...@apache.org.
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']))