mirror of
https://github.com/retspen/webvirtcloud
synced 2025-01-12 08:25:18 +00:00
correct instance summary display after unsuccessfull resize
This commit is contained in:
parent
1e84dcbbc9
commit
16ef164ed9
1 changed files with 15 additions and 11 deletions
|
@ -381,27 +381,31 @@ def instance(request, compute_id, vname):
|
||||||
error_messages.append(msg)
|
error_messages.append(msg)
|
||||||
|
|
||||||
if 'resize' in request.POST:
|
if 'resize' in request.POST:
|
||||||
vcpu = request.POST.get('vcpu', '')
|
new_vcpu = request.POST.get('vcpu', '')
|
||||||
cur_vcpu = request.POST.get('cur_vcpu', '')
|
new_cur_vcpu = request.POST.get('cur_vcpu', '')
|
||||||
memory = request.POST.get('memory', '')
|
new_memory = request.POST.get('memory', '')
|
||||||
memory_custom = request.POST.get('memory_custom', '')
|
new_memory_custom = request.POST.get('memory_custom', '')
|
||||||
if memory_custom:
|
if new_memory_custom:
|
||||||
memory = memory_custom
|
new_memory = new_memory_custom
|
||||||
cur_memory = request.POST.get('cur_memory', '')
|
new_cur_memory = request.POST.get('cur_memory', '')
|
||||||
cur_memory_custom = request.POST.get('cur_memory_custom', '')
|
new_cur_memory_custom = request.POST.get('cur_memory_custom', '')
|
||||||
if cur_memory_custom:
|
if new_cur_memory_custom:
|
||||||
cur_memory = cur_memory_custom
|
new_cur_memory = new_cur_memory_custom
|
||||||
disks_new = []
|
disks_new = []
|
||||||
for disk in disks:
|
for disk in disks:
|
||||||
input_disk_size = filesizefstr(request.POST.get('disk_size_' + disk['dev'], ''))
|
input_disk_size = filesizefstr(request.POST.get('disk_size_' + disk['dev'], ''))
|
||||||
if input_disk_size > disk['size']+(64<<20):
|
if input_disk_size > disk['size']+(64<<20):
|
||||||
disk['size_new'] = input_disk_size
|
disk['size_new'] = input_disk_size
|
||||||
disks_new.append(disk)
|
disks_new.append(disk)
|
||||||
quota_msg = check_user_quota(0, int(vcpu)-conn.get_vcpu(), int(memory)-conn.get_memory())
|
quota_msg = check_user_quota(0, int(new_vcpu)-vcpu, int(new_memory)-memory)
|
||||||
if not request.user.is_superuser and quota_msg:
|
if not request.user.is_superuser and quota_msg:
|
||||||
msg = _("User %s quota reached, cannot resize '%s'!" % (quota_msg, instance.name))
|
msg = _("User %s quota reached, cannot resize '%s'!" % (quota_msg, instance.name))
|
||||||
error_messages.append(msg)
|
error_messages.append(msg)
|
||||||
else:
|
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)
|
conn.resize(cur_memory, memory, cur_vcpu, vcpu, disks_new)
|
||||||
msg = _("Resize")
|
msg = _("Resize")
|
||||||
addlogmsg(request.user.username, instance.name, msg)
|
addlogmsg(request.user.username, instance.name, msg)
|
||||||
|
|
Loading…
Reference in a new issue