Merge "Removed useless ClusterStack class from heat engine"
This commit is contained in:
commit
721c1e3636
@ -187,11 +187,11 @@ class HeatEngine(e.Engine):
|
|||||||
True, step=_('Create Heat stack'), param=('cluster', 1))
|
True, step=_('Create Heat stack'), param=('cluster', 1))
|
||||||
def _create_instances(self, cluster, target_count, update_stack=False,
|
def _create_instances(self, cluster, target_count, update_stack=False,
|
||||||
disable_rollback=True):
|
disable_rollback=True):
|
||||||
tmpl = ht.ClusterTemplate(cluster)
|
stack = ht.ClusterStack(cluster)
|
||||||
|
|
||||||
self._configure_template(tmpl, cluster, target_count)
|
self._configure_template(stack, cluster, target_count)
|
||||||
stack = tmpl.instantiate(update_existing=update_stack,
|
stack.instantiate(update_existing=update_stack,
|
||||||
disable_rollback=disable_rollback)
|
disable_rollback=disable_rollback)
|
||||||
heat.wait_stack_completion(stack.heat_stack)
|
heat.wait_stack_completion(stack.heat_stack)
|
||||||
return self._populate_cluster(cluster, stack)
|
return self._populate_cluster(cluster, stack)
|
||||||
|
|
||||||
|
@ -89,10 +89,11 @@ def _get_volume_name(ng):
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class ClusterTemplate(object):
|
class ClusterStack(object):
|
||||||
def __init__(self, cluster):
|
def __init__(self, cluster):
|
||||||
self.cluster = cluster
|
self.cluster = cluster
|
||||||
self.node_groups_extra = {}
|
self.node_groups_extra = {}
|
||||||
|
self.heat_stack = None
|
||||||
|
|
||||||
def add_node_group_extra(self, node_group_id, node_count,
|
def add_node_group_extra(self, node_group_id, node_count,
|
||||||
gen_userdata_func):
|
gen_userdata_func):
|
||||||
@ -133,7 +134,7 @@ class ClusterTemplate(object):
|
|||||||
b.execute_with_retries(stack.update, **kwargs)
|
b.execute_with_retries(stack.update, **kwargs)
|
||||||
break
|
break
|
||||||
|
|
||||||
return ClusterStack(self, h.get_stack(self.cluster.name))
|
self.heat_stack = h.get_stack(self.cluster.name)
|
||||||
|
|
||||||
def _need_aa_server_group(self, node_group):
|
def _need_aa_server_group(self, node_group):
|
||||||
for node_process in node_group.node_processes:
|
for node_process in node_group.node_processes:
|
||||||
@ -423,12 +424,6 @@ class ClusterTemplate(object):
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class ClusterStack(object):
|
|
||||||
def __init__(self, tmpl, heat_stack):
|
|
||||||
self.tmpl = tmpl
|
|
||||||
self.heat_stack = heat_stack
|
|
||||||
|
|
||||||
def get_node_group_instances(self, node_group):
|
def get_node_group_instances(self, node_group):
|
||||||
for output in self.heat_stack.outputs:
|
for output in self.heat_stack.outputs:
|
||||||
if output['output_key'] == node_group.name + "-instances":
|
if output['output_key'] == node_group.name + "-instances":
|
||||||
|
@ -50,7 +50,7 @@ class TestClusterTemplate(base.SaharaWithDbTestCase):
|
|||||||
anti_affinity=anti_affinity)
|
anti_affinity=anti_affinity)
|
||||||
|
|
||||||
def _make_heat_template(self, cluster, ng1, ng2):
|
def _make_heat_template(self, cluster, ng1, ng2):
|
||||||
heat_template = h.ClusterTemplate(cluster)
|
heat_template = h.ClusterStack(cluster)
|
||||||
heat_template.add_node_group_extra(ng1['id'], 1,
|
heat_template.add_node_group_extra(ng1['id'], 1,
|
||||||
get_ud_generator('line1\nline2'))
|
get_ud_generator('line1\nline2'))
|
||||||
heat_template.add_node_group_extra(ng2['id'], 1,
|
heat_template.add_node_group_extra(ng2['id'], 1,
|
||||||
|
Loading…
Reference in New Issue
Block a user