Last active
December 24, 2015 14:29
Heat template dependency of service type
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Suppose we want to provide custom heat template for specific service type. | |
Now trove uses only one heat template for VM pre-configuration and guestagent launching. | |
----------------------------------------------------------------------------------------- | |
We should provide dependency between service(mysql, percona, mongo, redis, cassandra) | |
and specific heat template. | |
Also, we should externalize heat template from trove.common.template | |
to trove.extensions.service."service_type".template_module | |
----------------------------------------------------------------------------------------- | |
This is what Trove does now: | |
heat_template = template.HeatTemplate().template() | |
parameters = {"KeyName": "heatkey", | |
"Flavor": flavor["name"], | |
"VolumeSize": volume_size, | |
"ServiceType": "mysql", | |
"InstanceId": self.id, | |
"AvailabilityZone": availability_zone} | |
stack_name = 'trove-%s' % self.id | |
stack = client.stacks.create(stack_name=stack_name, | |
template=heat_template, | |
parameters=parameters) | |
stack = client.stacks.get(stack_name) | |
----------------------------------------------------------------------------------------- | |
What it should do: | |
This is what Trove does now: | |
service_template_class = | |
utils.import_class('trove.extension.service.%d.template' | |
% service_type) | |
service_template = service_template_class() | |
if hasattr(service_template, 'get_template'): | |
heat_template = service_template.get_template() | |
parameters = {"KeyName": "heatkey", | |
"Flavor": flavor["name"], | |
"VolumeSize": volume_size, | |
"ServiceType": "mysql", | |
"InstanceId": self.id, | |
"AvailabilityZone": availability_zone} | |
stack_name = 'trove-%s' % self.id | |
stack = client.stacks.create(stack_name=stack_name, | |
template=service_template, | |
parameters=parameters) | |
stack = client.stacks.get(stack_name) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment