Fixed validation of novanetwork w/o autoassignment
Novanetwork can't work with floating ip pools with IDs. And it always fails to start cluster when novanetwork used without auto_assignment of floating IPs. So added feature to check floating ip pools by name in validation Change-Id: I9ef9897a95350e142bd0729402a8f26906349ee5 Closes-Bug: #1308541
This commit is contained in:
parent
1976adcfeb
commit
f950942649
@ -133,7 +133,16 @@ def check_flavor_exists(flavor_id):
|
||||
|
||||
|
||||
def check_floatingip_pool_exists(ng_name, pool_id):
|
||||
if not nova.get_network(id=pool_id):
|
||||
network = None
|
||||
if CONF.use_neutron:
|
||||
network = nova.get_network(id=pool_id)
|
||||
else:
|
||||
for net in nova.client().floating_ip_pools.list():
|
||||
if net.name == pool_id:
|
||||
network = net.name
|
||||
break
|
||||
|
||||
if not network:
|
||||
raise ex.InvalidException("Floating IP pool %s for node group "
|
||||
"'%s' not found" % (pool_id, ng_name))
|
||||
|
||||
|
@ -64,6 +64,10 @@ def _get_network(**kwargs):
|
||||
return 'OK'
|
||||
|
||||
|
||||
def _get_fl_ip_pool_list():
|
||||
return [FakeNetwork("d9a3bebc-f788-4b81-9a93-aa048022c1ca")]
|
||||
|
||||
|
||||
def _get_heat_stack_list():
|
||||
return [FakeStack('test-heat')]
|
||||
|
||||
@ -73,6 +77,11 @@ class FakeStack(object):
|
||||
self.stack_name = name
|
||||
|
||||
|
||||
class FakeNetwork(object):
|
||||
def __init__(self, name):
|
||||
self.name = name
|
||||
|
||||
|
||||
class FakeFlavor(object):
|
||||
def __init__(self, id):
|
||||
self.id = id
|
||||
@ -124,6 +133,7 @@ def start_patch(patch_templates=True):
|
||||
nova().flavors.list.side_effect = _get_flavors_list
|
||||
nova().keypairs.get.side_effect = _get_keypair
|
||||
nova().networks.find.side_effect = _get_network
|
||||
nova().floating_ip_pools.list.side_effect = _get_fl_ip_pool_list
|
||||
|
||||
heat = heat_p.start()
|
||||
heat().stacks.list.side_effect = _get_heat_stack_list
|
||||
|
Loading…
Reference in New Issue
Block a user