Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gelencsér Szabolcs
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
9a58a90e
authored
Apr 03, 2013
by
Bence Dányi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
webui: show ipv4/6 addresses
parent
23e46445
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
59 additions
and
22 deletions
+59
-22
one/templates/show.html
+36
-10
one/templates/vm-credentials.html
+16
-6
one/views.py
+7
-6
No files found.
one/templates/show.html
View file @
9a58a90e
...
...
@@ -146,20 +146,51 @@
<table>
<tr>
<th>
{% trans "Protocol" %}
</th>
<th>
{% trans "Public port" %}
</th>
{% if i.template.network.nat %}
<th
colspan=
"2"
>
{% trans "Private port" %}
</th>
{%endif%}
<th
colspan=
"2"
>
{% trans "Access" %}
</th>
</tr>
{% for port in ports %}
<tr>
<td>
{{port.proto}}
</td>
<td>
{{port.public}}
</td>
{% if i.template.network.nat %}
<td>
{{port.private}}
</td>
{%endif%}
<td>
{{port.private}}/{{port.proto}}
</td>
<td
style=
"white-space: nowrap;"
>
{% if port.private == 80 or port.private == 8080 or port.private == 8000 %}
<a
href=
"http://{{port.ipv4.host}}:{{port.ipv4.port}}"
>
{{port.ipv4.host}}:{{port.ipv4.port}}
</a>
{% elif port.private == 443 %}
<a
href=
"https://{{port.ipv4.host}}:{{port.ipv4.port}}"
>
{{port.ipv4.host}}:{{port.ipv4.port}}
</a>
{% else %}
{{port.ipv4.host}}:{{port.ipv4.port}}
{% endif %}
</td>
<td>
<a
href=
"{% url one.views.vm_port_del i.id port.proto port.public %}"
>
{% trans "Delete" %}
</a>
</td>
</tr>
<tr>
<td>
{{port.private}}/{{port.proto}}6
</td>
<td
style=
"white-space: nowrap;"
>
{% if port.private == 80 or port.private == 8080 or port.private == 8000 %}
<a
href=
"http://{{port.ipv6.host}}:{{port.ipv6.port}}"
>
{{port.ipv6.host}}:{{port.ipv6.port}}
</a>
{% elif port.private == 443 %}
<a
href=
"https://{{port.ipv6.host}}:{{port.ipv6.port}}"
>
{{port.ipv6.host}}:{{port.ipv6.port}}
</a>
{% else %}
{{port.ipv6.host}}:{{port.ipv6.port}}
{% endif %}
</td>
<td>
<a
href=
"{% url one.views.vm_port_del i.id port.proto port.public %}"
>
{% trans "Delete" %}
</a>
</td>
</tr>
{% endfor %}
<tr>
<th>
Protokoll
</th>
<th
colspan=
"2"
>
Port
</th>
</tr>
<tr>
<td>
<select
style=
"min-width:50px;"
name=
proto
>
<option
value=
"tcp"
>
tcp
</option>
...
...
@@ -169,11 +200,6 @@
<td>
<input
style=
"min-width:70px;width:70px;"
type=
"text"
name=
"public"
/>
</td>
{% if i.template.network.nat %}
<td>
<input
style=
"min-width:70px;width:70px;"
type=
"text"
name=
"private"
/>
</td>
{% endif %}
<td>
<input
type=
"submit"
style=
"min-width:3em"
value=
"{% trans "
Add
"
%}"
/>
</td>
...
...
one/templates/vm-credentials.html
View file @
9a58a90e
...
...
@@ -37,13 +37,23 @@
</td>
</tr>
<tr>
<th>
{% trans "
Host" %}{% if i.is_ipv6 %} (
<a
href=
"#"
class=
"host-toggle"
><span
class=
"v4"
>
IPv4
</span><span
class=
"v6"
>
IPv6
</span></a>
){% endif %}:
</th>
<td>
<span
class=
"host"
>
{{ i.hostname }}
</span><span
class=
"ipv4host"
>
{{i.hostname_v4}}
</span>
</td>
<th>
{% trans "
IPv4 Host" %}{% if i.is_ipv6 %} ({% trans "You are using IPv6" %}
){% endif %}:
</th>
<td>
{{ i.hostname_v4 }}
</td>
</tr>
{% if i.nat %}
<tr>
<th>
{% trans "Port" %}:
</th>
<td>
{{ i.port}}
</td>
</tr>
{% endif %}
<tr>
<th>
{% trans "IPv6 Host" %}{% if not i.is_ipv6 %} ({% trans "You are using IPv4" %}){% endif %}:
</th>
<td>
{{ i.hostname_v6 }}
</td>
</tr>
{% if i.nat %}
<tr>
<th>
{% trans "IPv4 Port" %}:
</th>
<td>
{{ i.port_v4 }}
</td>
</tr>
<tr>
<th>
{% trans "IPv6 Port" %}:
</th>
<td>
{{ i.port_v6 }}
</td>
</tr>
{% endif %}
<tr>
<th>
{% trans "Username" %}:
</th>
<td>
cloud
</td>
...
...
one/views.py
View file @
9a58a90e
...
...
@@ -105,11 +105,12 @@ def vm_credentials(request, iid):
try
:
vm
=
get_object_or_404
(
Instance
,
pk
=
iid
,
owner
=
request
.
user
)
is_ipv6
=
len
(
request
.
META
[
"REMOTE_ADDR"
]
.
split
(
'.'
))
==
1
vm
.
hostname
=
vm
.
get_connect_host
(
use_ipv6
=
is_ipv6
)
vm
.
is_ipv6
=
is_ipv6
vm
.
hostname_v4
=
vm
.
get_connect_host
(
use_ipv6
=
False
)
vm
.
hostname_v6
=
vm
.
get_connect_host
(
use_ipv6
=
True
)
vm
.
is_ipv6
=
is_ipv6
vm
.
nat
=
vm
.
template
.
network
.
nat
vm
.
port
=
vm
.
get_port
(
use_ipv6
=
is_ipv6
)
vm
.
port_v4
=
vm
.
get_port
(
use_ipv6
=
False
)
vm
.
port_v6
=
vm
.
get_port
(
use_ipv6
=
True
)
return
render_to_response
(
'vm-credentials.html'
,
RequestContext
(
request
,
{
'i'
:
vm
}))
except
:
return
HttpResponse
(
_
(
"Could not get Virtual Machine credentials."
),
status
=
404
)
...
...
@@ -370,10 +371,10 @@ def vm_show(request, iid):
is_ipv6
=
len
(
request
.
META
[
"REMOTE_ADDR"
]
.
split
(
'.'
))
==
1
inst
.
is_ipv6
=
is_ipv6
inst
.
hostname_v4
=
inst
.
get_connect_host
(
use_ipv6
=
False
)
inst
.
hostname_v6
=
inst
.
get_connect_host
(
use_ipv6
=
True
)
inst
.
nat
=
inst
.
template
.
network
.
nat
inst
.
port
=
inst
.
get_port
(
use_ipv6
=
is_ipv6
)
inst
.
hostname
=
inst
.
get_connect_host
(
use_ipv6
=
is_ipv6
)
inst
.
port
=
inst
.
get_port
(
use_ipv6
=
is_ipv6
)
inst
.
port_v4
=
inst
.
get_port
(
use_ipv6
=
False
)
inst
.
port_v6
=
inst
.
get_port
(
use_ipv6
=
True
)
return
render_to_response
(
"show.html"
,
RequestContext
(
request
,{
'uri'
:
inst
.
get_connect_uri
(),
'state'
:
inst
.
state
,
...
...
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