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

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

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