Commit 34b69cf4 by Kálmán Viktor

dashboard: create instance and deploy it

parent 40056847
......@@ -122,9 +122,20 @@ class VmCreate(TemplateView):
return context
def post(self, request, *args, **kwargs):
if self.request.user.is_authenticated():
user = self.request.user
else:
user = None
resp = request.POST.copy()
resp['managed-vlans'] = request.POST.getlist('managed-vlans')
resp['unmanaged-vlans'] = request.POST.getlist('unmanaged-vlans')
resp['disks'] = request.POST.getlist('disks')
template = InstanceTemplate.objects.get(
pk=request.POST.get('template-pk'))
inst = Instance.create_from_template(template=template, owner=user)
inst.deploy_async()
# TODO handle response
return HttpResponse(json.dumps(resp), content_type="application/json")
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