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
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
Show 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 @@
...
@@ -15,9 +15,9 @@
{% for i in networks %}
{% for i in networks %}
<div>
<div>
<h3
class=
"list-group-item-heading dashboard-vm-details-network-h3"
>
<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 }}
{{ 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 %}
{% if user.is_superuser and i.host %}
<a
href=
"{{ i.host.get_absolute_url }}"
<a
href=
"{{ i.host.get_absolute_url }}"
class=
"btn btn-default btn-xs"
>
{% trans "edit" %}
</a>
class=
"btn btn-default btn-xs"
>
{% trans "edit" %}
</a>
...
@@ -32,23 +32,23 @@
...
@@ -32,23 +32,23 @@
</span>
</span>
{% endif %}{% endwith %}
{% endif %}{% endwith %}
</h3>
</h3>
{% if i.host %}
<div
class=
"row"
>
<div
class=
"row"
>
<div
class=
"col-md-5"
>
<div
class=
"col-md-5"
>
<dl>
<dl>
<dt>
{% trans "IPv4 address" %}:
</dt>
<dd>
{{ i.
host.
ipv4 }}
</dd>
<dt>
{% trans "IPv4 address" %}:
</dt>
<dd>
{{ i.ipv4 }}
</dd>
<dt>
{% trans "IPv6 address" %}:
</dt>
<dd>
{{ i.host.ipv6 }}
</dd>
{#
<dt>
{% trans "IPv6 address" %}:
</dt>
<dd>
{{ i.ipv6 }}
</dd>
#}
<dt>
{% trans "DNS name" %}:
</dt>
<dd>
{{ i.host.get_fqdn }}
</dd>
{#
<dt>
{% trans "DNS name" %}:
</dt>
<dd>
{{ i.host.get_fqdn }}
</dd>
#}
<dt>
{% trans "Groups" %}:
</dt>
{#
<dt>
{% trans "Groups" %}:
</dt>
#}
<dd>
{#
<dd>
#}
{% for g in i.host.groups.all %
}
{# {% for g in i.host.groups.all %}#
}
{{ g }}{% if not forloop.last %},{% endif %
}
{# {{ g }}{% if not forloop.last %},{% endif %}#
}
{% empty %
}
{# {% empty %}#
}
-
{# -#}
{% endfor %
}
{# {% endfor %}#
}
</dd>
{#
</dd>
#}
</dl>
</dl>
</div>
</div>
{% if i.host %}
<div
class=
"col-md-7"
>
<div
class=
"col-md-7"
>
<ul
class=
"nav nav-pills pull-right"
>
<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>
<li
class=
"active"
><a
href=
"#ipv4_{{ i.host.vlan.pk }}"
data-toggle=
"pill"
class=
"text-center"
>
{% trans "IPv4" %}
</a></li>
...
@@ -136,7 +136,7 @@
...
@@ -136,7 +136,7 @@
{% include "dashboard/vm-detail/_network-port-add.html" %}
{% include "dashboard/vm-detail/_network-port-add.html" %}
</div>
</div>
</div>
</div>
</div>
{% endif %}
{% endif %}
</div>
</div>
</div>
{% endfor %}
{% endfor %}
circle/dashboard/views/vm.py
View file @
7a0b9b2b
...
@@ -148,21 +148,30 @@ class VmDetailView(LoginRequiredMixin, GraphMixin, DetailView):
...
@@ -148,21 +148,30 @@ class VmDetailView(LoginRequiredMixin, GraphMixin, DetailView):
activities
=
openstack_api
.
nova
.
instance_action_list
(
self
.
request
,
instance
.
id
)
activities
=
openstack_api
.
nova
.
instance_action_list
(
self
.
request
,
instance
.
id
)
ports
=
openstack_api
.
neutron
.
port_list
(
self
.
request
)
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
)
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'
]
router_ports
=
[
p
for
p
in
ports
if
p
.
device_owner
==
'network:router_interface'
]
routers
=
openstack_api
.
neutron
.
router_list
(
self
.
request
)
routers
=
openstack_api
.
neutron
.
router_list
(
self
.
request
)
router_by_id
=
{
r
.
id
:
r
for
r
in
routers
}
router_by_id
=
{
r
.
id
:
r
for
r
in
routers
}
for
n
in
instance_networks
:
# mark networks with internet access
n
.
subnet
=
n
.
subnets
[
0
]
for
rtr_port
in
router_ports
:
#TODO: mark network public if it is based on router ports and router
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(
# context['vlans'] = Vlan.get_objects_with_level(
# 'user', self.request.user
# '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