From d283e0e1b3ec8dde9b869eb27a2593a672609998 Mon Sep 17 00:00:00 2001 From: catborise Date: Fri, 24 Apr 2020 16:30:39 +0300 Subject: [PATCH] remove unused resize request from instance --- Dockerfile | 1 - instances/views.py | 34 ---------------------------------- 2 files changed, 35 deletions(-) diff --git a/Dockerfile b/Dockerfile index c3b122f..b04b9d5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,4 @@ FROM phusion/baseimage:0.11 -MAINTAINER Jethro Yu RUN echo 'APT::Get::Clean=always;' >> /etc/apt/apt.conf.d/99AutomaticClean diff --git a/instances/views.py b/instances/views.py index 28e78e4..aa84f7d 100644 --- a/instances/views.py +++ b/instances/views.py @@ -460,40 +460,6 @@ def instance(request, compute_id, vname): msg = _("Please shutdown down your instance and then try again") error_messages.append(msg) - if 'resize' in request.POST and ( - request.user.is_superuser or request.user.is_staff or userinstance.is_change): - new_vcpu = request.POST.get('vcpu', '') - new_cur_vcpu = request.POST.get('cur_vcpu', '') - new_memory = request.POST.get('memory', '') - new_memory_custom = request.POST.get('memory_custom', '') - if new_memory_custom: - new_memory = new_memory_custom - new_cur_memory = request.POST.get('cur_memory', '') - new_cur_memory_custom = request.POST.get('cur_memory_custom', '') - if new_cur_memory_custom: - new_cur_memory = new_cur_memory_custom - disks_new = [] - for disk in disks: - input_disk_size = filesizefstr(request.POST.get('disk_size_' + disk['dev'], '')) - if input_disk_size > disk['size'] + (64 << 20): - disk['size_new'] = input_disk_size - disks_new.append(disk) - disk_sum = sum([disk['size'] >> 30 for disk in disks_new]) - disk_new_sum = sum([disk['size_new'] >> 30 for disk in disks_new]) - quota_msg = check_user_quota(0, int(new_vcpu) - vcpu, int(new_memory) - memory, disk_new_sum - disk_sum) - if not request.user.is_superuser and quota_msg: - msg = _("User %s quota reached, cannot resize '%s'!" % (quota_msg, instance.name)) - error_messages.append(msg) - else: - cur_memory = new_cur_memory - memory = new_memory - cur_vcpu = new_cur_vcpu - vcpu = new_vcpu - conn.resize(cur_memory, memory, cur_vcpu, vcpu, disks_new) - msg = _("Resize") - addlogmsg(request.user.username, instance.name, msg) - return HttpResponseRedirect(request.get_full_path() + '#resize') - if 'resizevm_cpu' in request.POST and ( request.user.is_superuser or request.user.is_staff or userinstance.is_change): new_vcpu = request.POST.get('vcpu', '')