From 60684cc7b13c01ccfee30c5ec4376aac342631d5 Mon Sep 17 00:00:00 2001 From: catborise Date: Wed, 20 Nov 2019 11:41:50 +0300 Subject: [PATCH] Live resize VM Memory activate. Redirection fix for resizing operations. Some typo & indent fix --- instances/templates/instance.html | 13 ++++--------- instances/views.py | 8 ++++---- 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/instances/templates/instance.html b/instances/templates/instance.html index a05d76d..471901a 100644 --- a/instances/templates/instance.html +++ b/instances/templates/instance.html @@ -432,11 +432,7 @@ {% trans "Custom value" %} - {% ifequal status 5 %} - - {% else %} - - {% endifequal %} + {% else %} {% trans "You don't have permission for resizing instance" %} @@ -951,8 +947,8 @@ {% for q, attrs in qos.items %} - {% for att in attrs %} -
{% csrf_token %} + {% for att in attrs %} + {% csrf_token %} -
+ {% endfor %} - {% endfor %} diff --git a/instances/views.py b/instances/views.py index 9049dff..ae1e189 100644 --- a/instances/views.py +++ b/instances/views.py @@ -481,7 +481,7 @@ def instance(request, compute_id, vname): conn.resize_cpu(cur_vcpu, vcpu) msg = _("Resize CPU") addlogmsg(request.user.username, instance.name, msg) - return HttpResponseRedirect(request.get_full_path() + '#resize') + return HttpResponseRedirect(request.get_full_path() + '#resize') if 'resizevm_mem' in request.POST and (request.user.is_superuser or request.user.is_staff or @@ -504,7 +504,7 @@ def instance(request, compute_id, vname): conn.resize_mem(cur_memory, memory) msg = _("Resize Memory") addlogmsg(request.user.username, instance.name, msg) - return HttpResponseRedirect(request.get_full_path() + '#resize') + return HttpResponseRedirect(request.get_full_path() + '#resize') if 'resizevm_disk' in request.POST and ( request.user.is_superuser or request.user.is_staff or userinstance.is_change): @@ -524,7 +524,7 @@ def instance(request, compute_id, vname): conn.resize_disk(disks_new) msg = _("Resize") addlogmsg(request.user.username, instance.name, msg) - return HttpResponseRedirect(request.get_full_path() + '#resize') + return HttpResponseRedirect(request.get_full_path() + '#resize') if 'add_new_vol' in request.POST and allow_admin_or_not_template: conn_create = wvmCreate(compute.hostname, @@ -1052,7 +1052,7 @@ def get_host_instances(request, comp): conn.close() else: - raise libvirtError("Problem occured with {} - {}".format(comp.name, status)) + raise libvirtError("Problem occurred with {} - {}".format(comp.name, status)) return all_host_vms