Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gutyán Gábor
/
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
7a0b9b2b
authored
Apr 16, 2018
by
Szabolcs Gelencser
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add public network icon, ipv4 address to interfaces
parent
0cfffed4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
21 deletions
+30
-21
.idea/workspace.xml
+0
-0
circle/dashboard/templates/dashboard/vm-detail/network.html
+15
-15
circle/dashboard/views/vm.py
+15
-6
No files found.
.idea/workspace.xml
View file @
7a0b9b2b
This diff is collapsed.
Click to expand it.
circle/dashboard/templates/dashboard/vm-detail/network.html
View file @
7a0b9b2b
...
...
@@ -15,9 +15,9 @@
{% for i in networks %}
<div>
<h3
class=
"list-group-item-heading dashboard-vm-details-network-h3"
>
<i
class=
"fa fa-{% if i.
host
%}globe{% else %}link{% endif %}"
></i>
<i
class=
"fa fa-{% if i.
internet_access
%}globe{% else %}link{% endif %}"
></i>
{{ i.name }}
{% if not i.subnet
s.0
.enable_dhcp %}({% trans "unmanaged" %}){% endif %}
{% if not i.subnet.enable_dhcp %}({% trans "unmanaged" %}){% endif %}
{% if user.is_superuser and i.host %}
<a
href=
"{{ i.host.get_absolute_url }}"
class=
"btn btn-default btn-xs"
>
{% trans "edit" %}
</a>
...
...
@@ -32,23 +32,23 @@
</span>
{% endif %}{% endwith %}
</h3>
{% if i.host %}
<div
class=
"row"
>
<div
class=
"col-md-5"
>
<dl>
<dt>
{% trans "IPv4 address" %}:
</dt>
<dd>
{{ i.
host.
ipv4 }}
</dd>
<dt>
{% trans "IPv6 address" %}:
</dt>
<dd>
{{ i.host.ipv6 }}
</dd>
<dt>
{% trans "DNS name" %}:
</dt>
<dd>
{{ i.host.get_fqdn }}
</dd>
<dt>
{% trans "Groups" %}:
</dt>
<dd>
{% for g in i.host.groups.all %
}
{{ g }}{% if not forloop.last %},{% endif %
}
{% empty %
}
-
{% endfor %
}
</dd>
<dt>
{% trans "IPv4 address" %}:
</dt>
<dd>
{{ i.ipv4 }}
</dd>
{#
<dt>
{% trans "IPv6 address" %}:
</dt>
<dd>
{{ i.ipv6 }}
</dd>
#}
{#
<dt>
{% trans "DNS name" %}:
</dt>
<dd>
{{ i.host.get_fqdn }}
</dd>
#}
{#
<dt>
{% trans "Groups" %}:
</dt>
#}
{#
<dd>
#}
{# {% for g in i.host.groups.all %}#
}
{# {{ g }}{% if not forloop.last %},{% endif %}#
}
{# {% empty %}#
}
{# -#}
{# {% endfor %}#
}
{#
</dd>
#}
</dl>
</div>
{% if i.host %}
<div
class=
"col-md-7"
>
<ul
class=
"nav nav-pills pull-right"
>
<li
class=
"active"
><a
href=
"#ipv4_{{ i.host.vlan.pk }}"
data-toggle=
"pill"
class=
"text-center"
>
{% trans "IPv4" %}
</a></li>
...
...
@@ -136,7 +136,7 @@
{% include "dashboard/vm-detail/_network-port-add.html" %}
</div>
</div>
{% endif %}
</div>
{% endif %}
</div>
{% endfor %}
circle/dashboard/views/vm.py
View file @
7a0b9b2b
...
...
@@ -148,21 +148,30 @@ class VmDetailView(LoginRequiredMixin, GraphMixin, DetailView):
activities
=
openstack_api
.
nova
.
instance_action_list
(
self
.
request
,
instance
.
id
)
ports
=
openstack_api
.
neutron
.
port_list
(
self
.
request
)
instance_ports
=
[
p
for
p
in
ports
if
p
.
device_id
==
self
.
object
.
id
]
instance_net_ids
=
[
p
.
network_id
for
p
in
ports
if
p
.
device_id
==
self
.
object
.
id
]
instance_net_ids
=
[
p
.
network_id
for
p
in
instance_ports
]
all_networks
=
openstack_api
.
neutron
.
network_list
(
self
.
request
)
instance_networks
=
[
n
for
n
in
all_networks
if
n
.
id
in
instance_net_ids
and
len
(
n
.
subnets
)
>
0
]
instance_networks
=
{
n
.
id
:
n
for
n
in
all_networks
if
n
.
id
in
instance_net_ids
and
len
(
n
.
subnets
)
>
0
}
router_ports
=
[
p
for
p
in
ports
if
p
.
device_owner
==
'network:router_interface'
]
routers
=
openstack_api
.
neutron
.
router_list
(
self
.
request
)
router_by_id
=
{
r
.
id
:
r
for
r
in
routers
}
for
n
in
instance_networks
:
n
.
subnet
=
n
.
subnets
[
0
]
#TODO: mark network public if it is based on router ports and router
# mark networks with internet access
for
rtr_port
in
router_ports
:
if
router_by_id
[
rtr_port
.
device_id
]
.
external_gateway_info
is
not
None
\
and
rtr_port
.
network_id
in
instance_networks
.
keys
():
instance_networks
[
rtr_port
.
network_id
]
.
internet_access
=
True
for
port
in
instance_ports
:
instance_networks
[
port
.
network_id
]
.
ipv4
=
port
.
fixed_ips
[
0
][
'ip_address'
]
# set default subnets for networks
for
id
in
instance_networks
:
instance_networks
[
id
]
.
subnet
=
instance_networks
[
id
]
.
subnets
[
0
]
context
[
'networks'
]
=
instance_networks
context
[
'networks'
]
=
instance_networks
.
values
()
# context['vlans'] = Vlan.get_objects_with_level(
# 'user', self.request.user
...
...
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