Commit 8ccc0cde by Őry Máté

one: do not recontext if not needed

parent 6c99d3eb
......@@ -193,7 +193,8 @@ def vm_saveas(request, vmid):
@require_POST
@login_required
def vm_new(request, template=None, share=None):
base = None
base = None
extra = None
if template:
base = get_object_or_404(Template, pk=template)
else:
......@@ -209,10 +210,11 @@ def vm_new(request, template=None, share=None):
t.system = base.system
t.save()
base = t
extra = "<RECONTEXT>YES</RECONTEXT>"
try:
#Gány quota
if share == None or (share != None and share.get_running() < share.instance_limit):
i = Instance.submit(base, request.user, extra="<RECONTEXT>YES</RECONTEXT>", share=share)
if share == None or (share != None and share.get_running() < share.instance_limit) or extra:
i = Instance.submit(base, request.user, extra=extra, share=share)
return redirect(i)
except Exception as e:
logger.error('Failed to create virtual machine.' + unicode(e))
......
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