Commit 8ccc0cde by Őry Máté

one: do not recontext if not needed

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