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 <[email protected]> Authored: Fri Jan 31 22:54:39 2014 +0100 Committer: Tomaz Muraus <[email protected]> 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
