Improve code to reduce traverse times
There is no need to traverse 3 times to get all guestagents. Improve code to recude the count to 1. Change-Id: I134a1624f54f6ad6bee069df76fef4d7112c05a1
This commit is contained in:
parent
5f458ffc38
commit
022aa317b5
|
@ -86,8 +86,7 @@ class GaleraCommonClusterTasks(task_models.ClusterTasks):
|
||||||
in instance_ids]
|
in instance_ids]
|
||||||
|
|
||||||
cluster_ips = [self.get_ip(instance) for instance in instances]
|
cluster_ips = [self.get_ip(instance) for instance in instances]
|
||||||
instance_guests = [self.get_guest(instance)
|
instance_guests = []
|
||||||
for instance in instances]
|
|
||||||
|
|
||||||
# Create replication user and password for synchronizing the
|
# Create replication user and password for synchronizing the
|
||||||
# galera cluster
|
# galera cluster
|
||||||
|
@ -108,13 +107,12 @@ class GaleraCommonClusterTasks(task_models.ClusterTasks):
|
||||||
# password in the my.cnf will be wrong after the joiner
|
# password in the my.cnf will be wrong after the joiner
|
||||||
# instances syncs with the donor instance.
|
# instances syncs with the donor instance.
|
||||||
admin_password = str(utils.generate_random_password())
|
admin_password = str(utils.generate_random_password())
|
||||||
for guest in instance_guests:
|
|
||||||
guest.reset_admin_password(admin_password)
|
|
||||||
|
|
||||||
bootstrap = True
|
bootstrap = True
|
||||||
for instance in instances:
|
for instance in instances:
|
||||||
guest = self.get_guest(instance)
|
guest = self.get_guest(instance)
|
||||||
|
instance_guests.append(guest)
|
||||||
|
guest.reset_admin_password(admin_password)
|
||||||
# render the conf.d/cluster.cnf configuration
|
# render the conf.d/cluster.cnf configuration
|
||||||
cluster_configuration = self._render_cluster_config(
|
cluster_configuration = self._render_cluster_config(
|
||||||
context,
|
context,
|
||||||
|
|
Loading…
Reference in New Issue