Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gelencsér Szabolcs
/
circlestack
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
d162945d
authored
Aug 26, 2018
by
Szabolcs Gelencsér
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add flat ip support to connection details
parent
f8478254
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
3 deletions
+9
-3
circle/dashboard/views/vm.py
+9
-3
No files found.
circle/dashboard/views/vm.py
View file @
d162945d
...
...
@@ -102,12 +102,18 @@ class VmDetailView(LoginRequiredMixin, GraphMixin, DetailView):
def
get_instance_connection
(
self
):
all_floating_ips
=
openstack_api
.
neutron
.
tenant_floating_ip_list
(
self
.
request
)
instance_floating_ips
=
[
ip
for
ip
in
all_floating_ips
if
ip
.
instance_id
==
self
.
object
.
id
]
instance_floating_ips
=
[
ip
for
ip
in
all_floating_ips
if
ip
.
instance_id
==
self
.
object
.
id
]
if
len
(
instance_floating_ips
)
>
0
:
return
instance_floating_ips
[
0
]
.
ip
,
22
all_ports
=
openstack_api
.
neutron
.
port_list
(
self
.
request
)
instance_ports
=
[
p
for
p
in
all_ports
if
p
.
instance_id
==
self
.
object
.
id
]
all_networks
=
openstack_api
.
neutron
.
network_list_for_tenant
(
self
.
request
,
self
.
request
.
user
.
tenant_id
)
flat_network_ids
=
[
n
.
id
for
n
in
all_networks
if
n
.
name
in
settings
.
FLAT_EXTERNAL_NETWORKS
]
instance_flat_ports
=
[
p
for
p
in
all_ports
if
p
.
device_id
==
self
.
object
.
id
and
p
.
network_id
in
flat_network_ids
]
if
len
(
instance_flat_ports
)
>
0
:
return
instance_flat_ports
[
0
]
.
fixed_ips
[
0
][
"ip_address"
],
22
return
None
,
None
...
...
@@ -167,7 +173,7 @@ class VmDetailView(LoginRequiredMixin, GraphMixin, DetailView):
'vnc_url'
:
vnc_console
.
url
if
vnc_console
else
None
,
'ops'
:
ops
,
'op'
:
{
i
.
op
:
i
for
i
in
ops
},
'connect_commands'
:
[
connection_cmd
,],
'connect_commands'
:
[
connection_cmd
,]
if
connection_port
else
None
,
'hide_tutorial'
:
hide_tutorial
,
'fav'
:
Favourite
.
objects
.
filter
(
user
=
user
.
id
,
instance
=
instance
.
id
)
.
exists
(),
'instance'
:
self
.
object
,
...
...
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