Merge "Wrong load removed node of galera cluster."

This commit is contained in:
Zuul 2017-10-20 19:55:41 +00:00 committed by Gerrit Code Review
commit 0b10d1bccb
3 changed files with 10 additions and 2 deletions

View File

@ -0,0 +1,6 @@
---
fixes:
- |
Fixes an issue in galera_common shrink that wrong load removed nodes
which could missing a ClusterShrinkMustNotLeaveClusterEmpty exception
or meet a NotFound error. Bug 1699953

View File

@ -184,7 +184,8 @@ class GaleraCommonCluster(cluster_models.Cluster):
self.validate_cluster_available() self.validate_cluster_available()
removal_instances = [Instance.load(self.context, inst_id) removal_instances = [Instance.load(self.context, inst_id)
for inst_id in instances] for inst_id in instances]
db_instances = DBInstance.find_all(cluster_id=self.db_info.id).all() db_instances = DBInstance.find_all(
cluster_id=self.db_info.id, deleted=False).all()
if len(db_instances) - len(removal_instances) < 1: if len(db_instances) - len(removal_instances) < 1:
raise exception.ClusterShrinkMustNotLeaveClusterEmpty() raise exception.ClusterShrinkMustNotLeaveClusterEmpty()

View File

@ -285,7 +285,8 @@ class GaleraCommonClusterTasks(task_models.ClusterTasks):
LOG.error(_("timeout for instances to be marked as deleted.")) LOG.error(_("timeout for instances to be marked as deleted."))
return return
db_instances = DBInstance.find_all(cluster_id=cluster_id).all() db_instances = DBInstance.find_all(
cluster_id=cluster_id, deleted=False).all()
leftover_instances = [Instance.load(context, db_inst.id) leftover_instances = [Instance.load(context, db_inst.id)
for db_inst in db_instances for db_inst in db_instances
if db_inst.id not in removal_instance_ids] if db_inst.id not in removal_instance_ids]