From 92790227d711553d25ab751dad9aa2a0df99167f Mon Sep 17 00:00:00 2001 From: Alex Rothberg Date: Mon, 15 Dec 2014 23:33:30 -0500 Subject: [PATCH] allow overriding the volumes --- starcluster/commands/start.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/starcluster/commands/start.py b/starcluster/commands/start.py index 27ba14ef6..d75838267 100644 --- a/starcluster/commands/start.py +++ b/starcluster/commands/start.py @@ -22,6 +22,7 @@ from starcluster import completion from starcluster.templates import user_msgs from starcluster.logger import log +from starcluster.utils import AttributeDict from completers import ClusterCompleter @@ -180,6 +181,9 @@ def addopts(self, parser): parser.add_option("-N", "--subnet-id", dest="subnet_id", action="store", type="string", help=("Launch cluster into a VPC subnet")) + parser.add_option("--volumes", dest="volumes", + action="append", default=None, + help="Specify the volumes to use with cluster") def execute(self, args): if len(args) != 1: @@ -223,6 +227,17 @@ def execute(self, args): raise e log.info("Using default cluster template: %s" % template) scluster = self.cm.get_cluster_template(template, tag) + + if self.opts.volumes is not None: + volumes_orig = [x for x in (y.strip() + for y in self.opts.volumes) + if x] + self.opts.volumes = AttributeDict() + for key in volumes_orig: + self.opts.volumes[key] = vol = self.cfg.vols.get(key).copy() + del vol['__name__'] + self.opts.volumes = scluster.load_volumes(self.opts.volumes) + scluster.update(self.specified_options_dict) if self.opts.keyname and not self.opts.key_location: key = self.cfg.get_key(self.opts.keyname)