Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
94
Merge Requests
10
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
4937c30e
authored
Jan 27, 2021
by
Szeberényi Imre
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'smallville_fix' into 'master'
Smallville fix See merge request
!417
parents
76a2a4a6
1ab77c1f
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
44 additions
and
13 deletions
+44
-13
circle/dashboard/static/dashboard/vm-console.js
+12
-2
circle/dashboard/templates/dashboard/vm-detail/console.html
+17
-2
circle/dashboard/views/graph.py
+1
-1
circle/dashboard/views/vm.py
+8
-3
circle/vm/tasks/local_periodic_tasks.py
+6
-5
No files found.
circle/dashboard/static/dashboard/vm-console.js
View file @
4937c30e
...
...
@@ -22,8 +22,18 @@ $(function() {
$
(
"#vm-info-pane"
).
fadeIn
();
$
(
"#vm-detail-pane"
).
removeClass
(
"col-md-12"
).
addClass
(
"col-md-8"
);
});
$
(
'#sendCtrlAltDelButton'
).
click
(
function
()
{
rfb
.
sendCtrlAltDel
();
return
false
;});
$
(
'#sendCtrlAltButton'
).
click
(
function
()
{
var
fn
=
Number
(
$
(
'#chooseCtrlAlt'
).
val
());
if
(
fn
==
0
)
{
rfb
.
sendCtrlAltDel
();
i
}
else
{
rfb
.
sendCtrlAltCombine
(
fn
-
1
);
}
return
false
;});
// rfb.sendCtrlAltDel(); return false;});
// $('#sendCtrlAltCombine').change(function() {
// var fn = Number($('#sendCtrlAltCombine').val())-1;
// rfb.sendCtrlAltCombine(fn); return false;});
$
(
'#sendPasswordButton'
).
click
(
function
()
{
var
pw
=
$
(
"#vm-details-pw-input"
).
val
();
for
(
var
i
=
0
;
i
<
pw
.
length
;
i
++
)
{
...
...
circle/dashboard/templates/dashboard/vm-detail/console.html
View file @
4937c30e
...
...
@@ -10,9 +10,24 @@
<div
class=
"col-xs-7"
>
<div
class=
"btn-toolbar"
>
{% if perms.vm.access_console %}
<button
id=
"sendCtrlAlt
Del
Button"
class=
"btn btn-danger btn-sm"
>
{% trans "Send
Ctrl+Alt+Del
" %}
<button
id=
"sendCtrlAltButton"
class=
"btn btn-danger btn-sm"
>
{% trans "Send" %}
</button>
<select
id=
"chooseCtrlAlt"
class=
"btn btn-danger btn-sm"
>
<option
value=
"0"
>
Ctrl+Alt+Delete
</option>
<option
value=
"1"
>
Ctrl+Alt+F1
</option>
<option
value=
"2"
>
Ctrl+Alt+F2
</option>
<option
value=
"3"
>
Ctrl+Alt+F3
</option>
<option
value=
"4"
>
Ctrl+Alt+F4
</option>
<option
value=
"5"
>
Ctrl+Alt+F5
</option>
<option
value=
"6"
>
Ctrl+Alt+F6
</option>
<option
value=
"7"
>
Ctrl+Alt+F7
</option>
<option
value=
"8"
>
Ctrl+Alt+F8
</option>
<option
value=
"9"
>
Ctrl+Alt+F9
</option>
<option
value=
"10"
>
Ctrl+Alt+F10
</option>
<option
value=
"11"
>
Ctrl+Alt+F11
</option>
<option
value=
"12"
>
Ctrl+Alt+F12
</option>
</select>
<button
id=
"sendPasswordButton"
class=
"btn btn-default btn-sm"
>
{% trans "Type password" %}
</button>
...
...
circle/dashboard/views/graph.py
View file @
4937c30e
...
...
@@ -212,7 +212,7 @@ class Cpu(object):
if
isinstance
(
self
.
obj
,
Node
):
return
(
0
,
105
)
else
:
return
(
0
,
self
.
obj
.
num_cores
*
10
0
+
5
)
return
(
0
,
self
.
obj
.
num_cores
*
105
)
register_graph
(
Cpu
,
'cpu'
,
VmGraphView
)
...
...
circle/dashboard/views/vm.py
View file @
4937c30e
...
...
@@ -947,6 +947,7 @@ class VmList(LoginRequiredMixin, FilterMixin, ListView):
'tags'
:
"tags__name__in"
,
# for search string
'owner'
:
"owner__username"
,
'template'
:
"template__pk"
,
'template_name'
:
"template__name__istartswith"
,
}
def
get_context_data
(
self
,
*
args
,
**
kwargs
):
...
...
@@ -1028,10 +1029,14 @@ class VmList(LoginRequiredMixin, FilterMixin, ListView):
in
[
i
.
name
for
i
in
Instance
.
_meta
.
fields
]
+
[
"pk"
]):
queryset
=
queryset
.
order_by
(
sort
)
try
:
filters
,
excludes
=
self
.
get_queryset_filters
()
return
queryset
.
filter
(
**
filters
)
.
exclude
(
**
excludes
)
.
prefetch_related
(
"owner"
,
"node"
,
"owner__profile"
,
"interface_set"
,
"lease"
,
"interface_set__host"
)
.
distinct
()
queryset
=
queryset
.
filter
(
**
filters
)
.
exclude
(
**
excludes
)
.
distinct
()
except
ValueError
:
messages
.
error
(
self
.
request
,
_
(
"Error during filtering."
))
return
queryset
.
prefetch_related
(
"owner"
,
"node"
,
"owner__profile"
,
"lease"
,
"interface_set"
,
"interface_set__host"
,
"template"
)
.
distinct
()
class
VmCreate
(
LoginRequiredMixin
,
TemplateView
):
...
...
circle/vm/tasks/local_periodic_tasks.py
View file @
4937c30e
...
...
@@ -44,10 +44,11 @@ def garbage_collector(offset=timezone.timedelta(seconds=20)):
:type timeout: int
"""
now
=
timezone
.
now
()
bw
=
0
grace_period
=
timezone
.
timedelta
(
hours
=
1
)
work_package
=
20
for
i
in
Instance
.
objects
.
filter
(
destroyed_at
=
None
)
.
all
():
if
i
.
time_of_delete
and
now
>
i
.
time_of_delete
+
offset
and
bw
<
2
0
:
bw
=
bw
+
1
if
i
.
time_of_delete
and
now
>
i
.
time_of_delete
+
grace_period
and
work_package
>
0
:
work_package
-=
1
i
.
destroy
.
async
(
system
=
True
)
logger
.
info
(
"Expired instance
%
d destroyed."
,
i
.
pk
)
try
:
...
...
@@ -61,8 +62,8 @@ def garbage_collector(offset=timezone.timedelta(seconds=20)):
logger
.
debug
(
'Could not notify owner of instance
%
d .
%
s'
,
i
.
pk
,
unicode
(
e
))
elif
(
i
.
time_of_suspend
and
now
>
i
.
time_of_suspend
and
i
.
state
==
'RUNNING'
and
bw
<
20
)
:
bw
=
bw
+
1
i
.
state
==
'RUNNING'
)
and
work_package
>
0
:
work_package
-=
1
logger
.
info
(
"Expired instance
%
d suspended."
%
i
.
pk
)
try
:
i
.
sleep
.
async
(
system
=
True
)
...
...
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