Fix MariaDB clusters failing with TypeError
This would apply to any type of cluster that uses the galera strategy while setting the nics on a create call. When we called cast to set() the object was a list of lists. The set method can not has a list so this was causesing a unhashable error. The change is to make the instance_nics a list of strings (what we originaly expected) to resolve this issue. Change-Id: I6b04f8b580720e5791e0977a9347d031cdbf9710 Closes-Bug: #1570602
This commit is contained in:
parent
ebb3bfa79d
commit
15ea555624
@ -0,0 +1,8 @@
|
||||
---
|
||||
fixes:
|
||||
- This would apply to any type of cluster that uses the galera strategy
|
||||
while setting the nics on a create call. When we called cast to set()
|
||||
the object was a list of lists. The set method can not has a list so
|
||||
this was causesing a unhashable error. The change is to make the
|
||||
instance_nics a list of strings (what we originaly expected) to
|
||||
resolve this issue. Bug 1570602.
|
@ -98,12 +98,16 @@ class GaleraCommonCluster(cluster_models.Cluster):
|
||||
check_quotas(context.tenant, deltas)
|
||||
|
||||
# Checking networks are same for the cluster
|
||||
instance_nics = [instance.get('nics', None) for instance in instances]
|
||||
if len(set(instance_nics)) != 1:
|
||||
instance_nics = []
|
||||
for instance in instances:
|
||||
nics = instance.get('nics')
|
||||
if nics:
|
||||
instance_nics.append(nics[0].get('net-id'))
|
||||
if len(set(instance_nics)) > 1:
|
||||
raise exception.ClusterNetworksNotEqual()
|
||||
instance_nic = instance_nics[0]
|
||||
if instance_nic is None:
|
||||
if not instance_nics:
|
||||
return
|
||||
instance_nic = instance_nics[0]
|
||||
try:
|
||||
nova_client.networks.get(instance_nic)
|
||||
except nova_exceptions.NotFound:
|
||||
|
@ -65,9 +65,13 @@ class ClusterTest(trove_testtools.TestCase):
|
||||
self.datastore_version = self.dv
|
||||
self.cluster = galera_api.GaleraCommonCluster(
|
||||
self.context, self.db_info, self.datastore, self.datastore_version)
|
||||
self.instances = [{'volume_size': 1, 'flavor_id': '1234'},
|
||||
{'volume_size': 1, 'flavor_id': '1234'},
|
||||
{'volume_size': 1, 'flavor_id': '1234'}]
|
||||
self.instances = [
|
||||
{'volume_size': 1, 'flavor_id': '1234',
|
||||
'nics': [{"net-id": "foo-bar"}]},
|
||||
{'volume_size': 1, 'flavor_id': '1234',
|
||||
'nics': [{"net-id": "foo-bar"}]},
|
||||
{'volume_size': 1, 'flavor_id': '1234',
|
||||
'nics': [{"net-id": "foo-bar"}]}]
|
||||
|
||||
def tearDown(self):
|
||||
super(ClusterTest, self).tearDown()
|
||||
|
Loading…
Reference in New Issue
Block a user