1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2025-07-31 12:41:08 +00:00

Added is_template attribute to instances. If true, instance cannot be started.

This commit is contained in:
Jan Krcmar 2016-01-20 15:40:09 +01:00
parent 4ab8561360
commit 646bdbbe0e
4 changed files with 39 additions and 3 deletions

View file

@ -66,6 +66,7 @@ def instances(request):
check_uuid = Instance.objects.get(compute_id=comp.id, name=vm)
if check_uuid.uuid != info['uuid']:
check_uuid.save()
all_host_vms[comp.id, comp.name][vm]['is_template'] = check_uuid.is_template
except Instance.DoesNotExist:
check_uuid = Instance(compute_id=comp.id, name=vm, uuid=info['uuid'])
check_uuid.save()
@ -515,6 +516,13 @@ def instance(request, compute_id, vname):
addlogmsg(request.user.username, instance.name, msg)
return HttpResponseRedirect(request.get_full_path() + '#network')
if 'change_template' in request.POST:
instance.is_template = request.POST.get('is_template', False)
instance.save()
msg = _("Edit template %s" % instance.is_template)
addlogmsg(request.user.username, instance.name, msg)
return HttpResponseRedirect(request.get_full_path() + '#template')
conn.close()
except libvirtError as lib_err: