Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gyuricska Milán
/
cloud
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
e7a5046f
authored
Apr 16, 2015
by
Bach Dániel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vm: make VNC port range configurable from settings
closes #97
parent
b4764068
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
2 deletions
+5
-2
circle/circle/settings/base.py
+4
-0
circle/vm/models/instance.py
+1
-2
No files found.
circle/circle/settings/base.py
View file @
e7a5046f
...
@@ -528,6 +528,10 @@ except:
...
@@ -528,6 +528,10 @@ except:
LOCALE_PATHS
=
(
join
(
SITE_ROOT
,
'locale'
),
)
LOCALE_PATHS
=
(
join
(
SITE_ROOT
,
'locale'
),
)
COMPANY_NAME
=
get_env_variable
(
"COMPANY_NAME"
,
"BME IK 2015"
)
COMPANY_NAME
=
get_env_variable
(
"COMPANY_NAME"
,
"BME IK 2015"
)
first
,
last
=
get_env_variable
(
'VNC_PORT_RANGE'
,
'20000, 65536'
)
.
replace
(
' '
,
''
)
.
split
(
','
)
VNC_PORT_RANGE
=
(
int
(
first
),
int
(
last
))
# inclusive start, exclusive end
graphite_host
=
environ
.
get
(
"GRAPHITE_HOST"
,
None
)
graphite_host
=
environ
.
get
(
"GRAPHITE_HOST"
,
None
)
graphite_port
=
environ
.
get
(
"GRAPHITE_PORT"
,
None
)
graphite_port
=
environ
.
get
(
"GRAPHITE_PORT"
,
None
)
if
graphite_host
and
graphite_port
:
if
graphite_host
and
graphite_port
:
...
...
circle/vm/models/instance.py
View file @
e7a5046f
...
@@ -62,7 +62,6 @@ scheduler = import_module(name=django.conf.settings.VM_SCHEDULER)
...
@@ -62,7 +62,6 @@ scheduler = import_module(name=django.conf.settings.VM_SCHEDULER)
ACCESS_PROTOCOLS
=
django
.
conf
.
settings
.
VM_ACCESS_PROTOCOLS
ACCESS_PROTOCOLS
=
django
.
conf
.
settings
.
VM_ACCESS_PROTOCOLS
ACCESS_METHODS
=
[(
key
,
name
)
for
key
,
(
name
,
port
,
transport
)
ACCESS_METHODS
=
[(
key
,
name
)
for
key
,
(
name
,
port
,
transport
)
in
ACCESS_PROTOCOLS
.
iteritems
()]
in
ACCESS_PROTOCOLS
.
iteritems
()]
VNC_PORT_RANGE
=
(
20000
,
65536
)
# inclusive start, exclusive end
def
find_unused_port
(
port_range
,
used_ports
=
[]):
def
find_unused_port
(
port_range
,
used_ports
=
[]):
...
@@ -81,7 +80,7 @@ def find_unused_port(port_range, used_ports=[]):
...
@@ -81,7 +80,7 @@ def find_unused_port(port_range, used_ports=[]):
def
find_unused_vnc_port
():
def
find_unused_vnc_port
():
port
=
find_unused_port
(
port
=
find_unused_port
(
port_range
=
VNC_PORT_RANGE
,
port_range
=
django
.
conf
.
settings
.
VNC_PORT_RANGE
,
used_ports
=
Instance
.
objects
.
values_list
(
'vnc_port'
,
flat
=
True
))
used_ports
=
Instance
.
objects
.
values_list
(
'vnc_port'
,
flat
=
True
))
if
port
is
None
:
if
port
is
None
:
...
...
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