Commit 4937c30e by Szeberényi Imre

Merge branch 'smallville_fix' into 'master'

Smallville fix

See merge request !417
parents 76a2a4a6 1ab77c1f
...@@ -22,8 +22,18 @@ $(function() { ...@@ -22,8 +22,18 @@ $(function() {
$("#vm-info-pane").fadeIn(); $("#vm-info-pane").fadeIn();
$("#vm-detail-pane").removeClass("col-md-12").addClass("col-md-8"); $("#vm-detail-pane").removeClass("col-md-12").addClass("col-md-8");
}); });
$('#sendCtrlAltDelButton').click(function() { $('#sendCtrlAltButton').click(function() {
rfb.sendCtrlAltDel(); return false;}); 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() { $('#sendPasswordButton').click(function() {
var pw = $("#vm-details-pw-input").val(); var pw = $("#vm-details-pw-input").val();
for (var i=0; i < pw.length; i++) { for (var i=0; i < pw.length; i++) {
......
...@@ -10,9 +10,24 @@ ...@@ -10,9 +10,24 @@
<div class="col-xs-7"> <div class="col-xs-7">
<div class="btn-toolbar"> <div class="btn-toolbar">
{% if perms.vm.access_console %} {% if perms.vm.access_console %}
<button id="sendCtrlAltDelButton" class="btn btn-danger btn-sm"> <button id="sendCtrlAltButton" class="btn btn-danger btn-sm">
{% trans "Send Ctrl+Alt+Del" %} {% trans "Send" %}
</button> </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"> <button id="sendPasswordButton" class="btn btn-default btn-sm">
{% trans "Type password" %} {% trans "Type password" %}
</button> </button>
......
...@@ -212,7 +212,7 @@ class Cpu(object): ...@@ -212,7 +212,7 @@ class Cpu(object):
if isinstance(self.obj, Node): if isinstance(self.obj, Node):
return (0, 105) return (0, 105)
else: else:
return (0, self.obj.num_cores * 100 + 5) return (0, self.obj.num_cores * 105)
register_graph(Cpu, 'cpu', VmGraphView) register_graph(Cpu, 'cpu', VmGraphView)
......
...@@ -947,6 +947,7 @@ class VmList(LoginRequiredMixin, FilterMixin, ListView): ...@@ -947,6 +947,7 @@ class VmList(LoginRequiredMixin, FilterMixin, ListView):
'tags': "tags__name__in", # for search string 'tags': "tags__name__in", # for search string
'owner': "owner__username", 'owner': "owner__username",
'template': "template__pk", 'template': "template__pk",
'template_name': "template__name__istartswith",
} }
def get_context_data(self, *args, **kwargs): def get_context_data(self, *args, **kwargs):
...@@ -1028,10 +1029,14 @@ class VmList(LoginRequiredMixin, FilterMixin, ListView): ...@@ -1028,10 +1029,14 @@ class VmList(LoginRequiredMixin, FilterMixin, ListView):
in [i.name for i in Instance._meta.fields] + ["pk"]): in [i.name for i in Instance._meta.fields] + ["pk"]):
queryset = queryset.order_by(sort) queryset = queryset.order_by(sort)
try:
filters, excludes = self.get_queryset_filters() filters, excludes = self.get_queryset_filters()
return queryset.filter(**filters).exclude(**excludes).prefetch_related( queryset = queryset.filter(**filters).exclude(**excludes).distinct()
"owner", "node", "owner__profile", "interface_set", "lease", except ValueError:
"interface_set__host").distinct() 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): class VmCreate(LoginRequiredMixin, TemplateView):
......
...@@ -44,10 +44,11 @@ def garbage_collector(offset=timezone.timedelta(seconds=20)): ...@@ -44,10 +44,11 @@ def garbage_collector(offset=timezone.timedelta(seconds=20)):
:type timeout: int :type timeout: int
""" """
now = timezone.now() now = timezone.now()
bw = 0 grace_period = timezone.timedelta(hours=1)
work_package = 20
for i in Instance.objects.filter(destroyed_at=None).all(): for i in Instance.objects.filter(destroyed_at=None).all():
if i.time_of_delete and now > i.time_of_delete + offset and bw < 20: if i.time_of_delete and now > i.time_of_delete + grace_period and work_package > 0:
bw = bw + 1 work_package -= 1
i.destroy.async(system=True) i.destroy.async(system=True)
logger.info("Expired instance %d destroyed.", i.pk) logger.info("Expired instance %d destroyed.", i.pk)
try: try:
...@@ -61,8 +62,8 @@ def garbage_collector(offset=timezone.timedelta(seconds=20)): ...@@ -61,8 +62,8 @@ def garbage_collector(offset=timezone.timedelta(seconds=20)):
logger.debug('Could not notify owner of instance %d .%s', logger.debug('Could not notify owner of instance %d .%s',
i.pk, unicode(e)) i.pk, unicode(e))
elif (i.time_of_suspend and now > i.time_of_suspend and elif (i.time_of_suspend and now > i.time_of_suspend and
i.state == 'RUNNING' and bw < 20): i.state == 'RUNNING') and work_package > 0:
bw = bw + 1 work_package -= 1
logger.info("Expired instance %d suspended." % i.pk) logger.info("Expired instance %d suspended." % i.pk)
try: try:
i.sleep.async(system=True) i.sleep.async(system=True)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment