mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 01:18:58 +00:00
Merge pull request #38965 from toanju/2016.11
salt-cloud will use list_floating_ips for OpenStack
This commit is contained in:
commit
ec690a0a12
@ -851,14 +851,13 @@ def _assign_floating_ips(vm_, conn, kwargs):
|
|||||||
pool = OpenStack_1_1_FloatingIpPool(
|
pool = OpenStack_1_1_FloatingIpPool(
|
||||||
net['floating'], conn.connection
|
net['floating'], conn.connection
|
||||||
)
|
)
|
||||||
for idx in [pool.create_floating_ip()]:
|
for idx in pool.list_floating_ips():
|
||||||
if idx.node_id is None:
|
if idx.node_id is None:
|
||||||
floating.append(idx)
|
floating.append(idx)
|
||||||
if not floating:
|
if not floating:
|
||||||
# Note(pabelanger): We have no available floating IPs.
|
try:
|
||||||
# For now, we raise an exception and exit.
|
floating.append(pool.create_floating_ip())
|
||||||
# A future enhancement might be to allow salt-cloud
|
except Exception as e:
|
||||||
# to dynamically allocate new address but that might
|
|
||||||
raise SaltCloudSystemExit(
|
raise SaltCloudSystemExit(
|
||||||
'Floating pool \'{0}\' does not have any more '
|
'Floating pool \'{0}\' does not have any more '
|
||||||
'please create some more or use a different '
|
'please create some more or use a different '
|
||||||
@ -879,11 +878,9 @@ def _assign_floating_ips(vm_, conn, kwargs):
|
|||||||
if idx.node_id is None:
|
if idx.node_id is None:
|
||||||
floating.append(idx)
|
floating.append(idx)
|
||||||
if not floating:
|
if not floating:
|
||||||
# Note(pabelanger): We have no available floating IPs.
|
try:
|
||||||
# For now, we raise an exception and exit.
|
floating.append(pool.create_floating_ip())
|
||||||
# A future enhancement might be to allow salt-cloud to
|
except Exception as e:
|
||||||
# dynamically allocate new address but that might be
|
|
||||||
# tricky to manage.
|
|
||||||
raise SaltCloudSystemExit(
|
raise SaltCloudSystemExit(
|
||||||
'There are no more floating IP addresses '
|
'There are no more floating IP addresses '
|
||||||
'available, please create some more'
|
'available, please create some more'
|
||||||
|
Loading…
Reference in New Issue
Block a user