Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
ansible
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
ansible
Commits
917ad8da
Commit
917ad8da
authored
Jun 10, 2014
by
James Cammarata
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #7687 from ryanpetrello/devel
Fix neutron floating IP allocation for networks w/ multiple subnets
parents
2240f8ef
bb0ca4c1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
6 deletions
+11
-6
library/cloud/quantum_floating_ip
+11
-6
No files found.
library/cloud/quantum_floating_ip
View file @
917ad8da
...
...
@@ -144,11 +144,15 @@ def _get_server_state(module, nova):
def
_get_port_info
(
neutron
,
module
,
instance_id
,
internal_network_name
=
None
):
subnet_id
=
None
if
internal_network_name
:
kwargs
=
{
'name'
:
internal_network_name
}
networks
=
neutron
.
list_networks
(
**
kwargs
)
network_id
=
networks
[
'networks'
][
0
][
'id'
]
kwargs
=
{
'name'
:
internal_network_name
,
'network_id'
:
network_id
,
'ip_version'
:
4
}
networks
=
neutron
.
list_network
s
(
**
kwargs
)
subnet_id
=
networks
[
'networks'
][
0
][
'subnets'
][
0
]
subnets
=
neutron
.
list_subnet
s
(
**
kwargs
)
subnet_id
=
subnets
[
'subnets'
][
0
][
'id'
]
kwargs
=
{
'device_id'
:
instance_id
,
}
...
...
@@ -179,10 +183,11 @@ def _get_floating_ip(module, neutron, fixed_ip_address):
return
None
,
None
return
ips
[
'floatingips'
][
0
][
'id'
],
ips
[
'floatingips'
][
0
][
'floating_ip_address'
]
def
_create_floating_ip
(
neutron
,
module
,
port_id
,
net_id
):
def
_create_floating_ip
(
neutron
,
module
,
port_id
,
net_id
,
fixed_ip
):
kwargs
=
{
'port_id'
:
port_id
,
'floating_network_id'
:
net_id
'floating_network_id'
:
net_id
,
'fixed_ip_address'
:
fixed_ip
}
try
:
result
=
neutron
.
create_floatingip
({
'floatingip'
:
kwargs
})
...
...
@@ -252,7 +257,7 @@ def main():
net_id
=
_get_net_id
(
neutron
,
module
)
if
not
net_id
:
module
.
fail_json
(
msg
=
"cannot find the network specified, please check"
)
_create_floating_ip
(
neutron
,
module
,
port_id
,
net_id
)
_create_floating_ip
(
neutron
,
module
,
port_id
,
net_id
,
fixed_ip
)
if
module
.
params
[
'state'
]
==
'absent'
:
if
floating_ip
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment