Merge "Allow complex scheduler hints for AWS Instance"
This commit is contained in:
commit
3a61debdec
|
@ -12,6 +12,7 @@
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
from oslo.config import cfg
|
from oslo.config import cfg
|
||||||
|
import six
|
||||||
|
|
||||||
cfg.CONF.import_opt('instance_user', 'heat.common.config')
|
cfg.CONF.import_opt('instance_user', 'heat.common.config')
|
||||||
|
|
||||||
|
@ -424,7 +425,15 @@ class Instance(resource.Resource):
|
||||||
scheduler_hints = {}
|
scheduler_hints = {}
|
||||||
if self.properties[self.NOVA_SCHEDULER_HINTS]:
|
if self.properties[self.NOVA_SCHEDULER_HINTS]:
|
||||||
for tm in self.properties[self.NOVA_SCHEDULER_HINTS]:
|
for tm in self.properties[self.NOVA_SCHEDULER_HINTS]:
|
||||||
scheduler_hints[tm[self.TAG_KEY]] = tm[self.TAG_VALUE]
|
# adopted from novaclient shell
|
||||||
|
hint = tm[self.TAG_KEY]
|
||||||
|
hint_value = tm[self.TAG_VALUE]
|
||||||
|
if hint in scheduler_hints:
|
||||||
|
if isinstance(scheduler_hints[hint], six.string_types):
|
||||||
|
scheduler_hints[hint] = [scheduler_hints[hint]]
|
||||||
|
scheduler_hints[hint].append(hint_value)
|
||||||
|
else:
|
||||||
|
scheduler_hints[hint] = hint_value
|
||||||
else:
|
else:
|
||||||
scheduler_hints = None
|
scheduler_hints = None
|
||||||
|
|
||||||
|
|
|
@ -52,6 +52,10 @@ wp_template = '''
|
||||||
"ImageId" : "F17-x86_64-gold",
|
"ImageId" : "F17-x86_64-gold",
|
||||||
"InstanceType" : "m1.large",
|
"InstanceType" : "m1.large",
|
||||||
"KeyName" : "test",
|
"KeyName" : "test",
|
||||||
|
"NovaSchedulerHints" : [{"Key": "foo", "Value": "spam"},
|
||||||
|
{"Key": "bar", "Value": "eggs"},
|
||||||
|
{"Key": "foo", "Value": "ham"},
|
||||||
|
{"Key": "foo", "Value": "baz"}],
|
||||||
"UserData" : "wordpress"
|
"UserData" : "wordpress"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -101,7 +105,8 @@ class InstancesTest(HeatTestCase):
|
||||||
instance.name,
|
instance.name,
|
||||||
limit=instance.physical_resource_name_limit),
|
limit=instance.physical_resource_name_limit),
|
||||||
security_groups=None,
|
security_groups=None,
|
||||||
userdata=mox.IgnoreArg(), scheduler_hints=None,
|
userdata=mox.IgnoreArg(),
|
||||||
|
scheduler_hints={'foo': ['spam', 'ham', 'baz'], 'bar': 'eggs'},
|
||||||
meta=None, nics=None, availability_zone=None).AndReturn(
|
meta=None, nics=None, availability_zone=None).AndReturn(
|
||||||
return_server)
|
return_server)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue