Merge "Add timestamp to cluster instance name"

This commit is contained in:
Zuul 2017-12-02 06:10:26 +00:00 committed by Gerrit Code Review
commit 3d1fe4ab41

View File

@ -15,6 +15,7 @@
from novaclient import exceptions as nova_exceptions from novaclient import exceptions as nova_exceptions
from oslo_log import log as logging from oslo_log import log as logging
import time
from trove.cluster import models as cluster_models from trove.cluster import models as cluster_models
from trove.cluster.tasks import ClusterTasks from trove.cluster.tasks import ClusterTasks
@ -101,7 +102,7 @@ class GaleraCommonCluster(cluster_models.Cluster):
configuration_id): configuration_id):
member_config = {"id": db_info.id, member_config = {"id": db_info.id,
"instance_type": "member"} "instance_type": "member"}
name_index = 1 name_index = int(time.time())
for instance in instances: for instance in instances:
if not instance.get("name"): if not instance.get("name"):
instance['name'] = "%s-member-%s" % (db_info.name, instance['name'] = "%s-member-%s" % (db_info.name,