Skip to content

Commit

Permalink
Merge pull request #158 from mbookman/boot-disk
Browse files Browse the repository at this point in the history
Adds support for "boot_disk_type" and "boot_disk_size" instance configuration parameters.
  • Loading branch information
nicolasbaer committed Jun 13, 2015
2 parents b710dc4 + a8d6565 commit fbdf384
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 1 deletion.
10 changes: 10 additions & 0 deletions docs/config.template
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,16 @@ worker_groups=ipython_engine
# configured anyway, otherwise creation of the cluster will
# fail.
#
# boot_disk_type: Define the type of boot disk to use.
# Only supported when the cloud provider is google.
# Supported values are pd-standard and pd-ssd.
# Default value is pd-standard.
#
# boot_disk_size: Define the size of boot disk to use.
# Only supported when the cloud provider is google.
# Values are specified in gigabytes.
# Default value is 10.

# Some (working) examples:

[cluster/slurm]
Expand Down
12 changes: 12 additions & 0 deletions docs/configure.rst
Original file line number Diff line number Diff line change
Expand Up @@ -592,6 +592,18 @@ Optional configuration keys
The maximum number of process to be created when virtual machines
are started. Default is 10.

``boot_disk_type``
Define the type of boot disk to use.
Only supported when the cloud provider is `google`.
Supported values are `pd-standard` and `pd-ssd`.
Default value is `pd-standard`.

``boot_disk_size``
Define the size of boot disk to use.
Only supported when the cloud provider is `google`.
Values are specified in gigabytes.
Default value is 10.

Examples
--------

Expand Down
13 changes: 13 additions & 0 deletions docs/html/configure.html
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,19 @@ <h3>Optional configuration keys<a class="headerlink" href="#optional-configurati
creation of some instances may fail. If at least min_nodes are
started correctly (i.e. are not in error state), the cluster is
configured anyway, otherwise creation of the cluster will fail.</div></blockquote>
<p><tt class="docutils literal"><span class="pre">boot_disk_type</span></tt></p>
<blockquote>
<div>Define the type of boot disk to use.
Only supported when the cloud provider is <cite>google</cite>.
Supported values are <em>pd-standard</em> and <em>pd-ssd</em>.
Default value is <em>pd-standard</em>.
</div></blockquote>
<p><tt class="docutils literal"><span class="pre">boot_disk_size</span></tt></p>
<blockquote>
<div>Define the size of boot disk to use.
Only supported when the cloud provider is <cite>google</cite>.
Value is specified in gigabytes. Default value is 10.
</div></blockquote>
</div>
<div class="section" id="id5">
<h3>Examples<a class="headerlink" href="#id5" title="Permalink to this headline"></a></h3>
Expand Down
10 changes: 9 additions & 1 deletion elasticluster/providers/gce.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,10 @@ def start_instance(self,
username=None,
# these params are specific to the
# GoogleCloudProvider
instance_name=None, **kwargs):
instance_name=None,
boot_disk_type='pd-standard',
boot_disk_size=10,
**kwargs):
"""Starts a new instance with the given properties and returns
the instance id.
Expand All @@ -234,6 +237,9 @@ def start_instance(self,
project_url = '%s%s' % (GCE_URL, self._project_id)
machine_type_url = '%s/zones/%s/machineTypes/%s' \
% (project_url, self._zone, flavor)
boot_disk_type_url = '%s/zones/%s/diskTypes/%s' \
% (project_url, self._zone, boot_disk_type)
boot_disk_size_gb = boot_disk_size
network_url = '%s/global/networks/%s' % (project_url, self._network)
if image_id.startswith('http://') or image_id.startswith('https://'):
image_url = image_id
Expand Down Expand Up @@ -278,6 +284,8 @@ def start_instance(self,
'type': 'PERSISTENT',
'initializeParams' : {
'diskName': "%s-disk" % instance_name,
'diskType': boot_disk_type_url,
'diskSizeGb': boot_disk_size_gb,
'sourceImage': image_url
}
}],
Expand Down

0 comments on commit fbdf384

Please sign in to comment.