Commit e77cbe27 by Belákovics Ádám

Add network fix and vnc console

parent b7d22c8a
Pipeline #1381 failed with stages
in 42 seconds
...@@ -282,6 +282,9 @@ class Instance(BaseMachineDescriptor): ...@@ -282,6 +282,9 @@ class Instance(BaseMachineDescriptor):
self.description = new_description self.description = new_description
self.save() self.save()
def get_vnc_console(self):
return interface.get_vnc_console(self.remote_id)
def destroy(self): def destroy(self):
self.deleted = True self.deleted = True
self.save() self.save()
...@@ -122,7 +122,7 @@ class InstanceViewSet(AuthorizationMixin, ViewSet): ...@@ -122,7 +122,7 @@ class InstanceViewSet(AuthorizationMixin, ViewSet):
instance.destroy() instance.destroy()
return Response(status=status.HTTP_204_NO_CONTENT) return Response(status=status.HTTP_204_NO_CONTENT)
@action(detail=True, methods=["post"]) @action(detail=True, methods=["POST"])
def template(self, request, pk): def template(self, request, pk):
instance = self.get_object(pk) instance = self.get_object(pk)
if not self.has_perms_for_model(request.user, 'template'): if not self.has_perms_for_model(request.user, 'template'):
...@@ -166,6 +166,11 @@ class InstanceViewSet(AuthorizationMixin, ViewSet): ...@@ -166,6 +166,11 @@ class InstanceViewSet(AuthorizationMixin, ViewSet):
else: else:
return Response(data="No new lease provided", status=status.HTTP_400_BAD_REQUEST) return Response(data="No new lease provided", status=status.HTTP_400_BAD_REQUEST)
@action(detail=True, methods=["GET"])
def get_vnc_console(self, request, pk):
instance = self.get_object(pk)
return Response(data=instance.get_vnc_console())
@action(detail=True, methods=["POST"]) @action(detail=True, methods=["POST"])
def resize(self, request, pk): def resize(self, request, pk):
pass pass
......
Subproject commit cc7bd247b4457b1020c6442a6c944e1c3ba0caff Subproject commit 0b5dc350a10e6f6805815acb5c91f98d307bad32
...@@ -29,5 +29,6 @@ class ImageTemplate(BaseMachineDescriptor): ...@@ -29,5 +29,6 @@ class ImageTemplate(BaseMachineDescriptor):
access_protocol=instance.access_protocol, access_protocol=instance.access_protocol,
lease=instance.lease, lease=instance.lease,
flavor=instance.flavor, flavor=instance.flavor,
network_id=instance.network_id,
type="INSTANCE") type="INSTANCE")
return new_template return new_template
...@@ -27,6 +27,7 @@ class ImageTemplateViewSet(ModelViewSet): ...@@ -27,6 +27,7 @@ class ImageTemplateViewSet(ModelViewSet):
image=data["image"], image=data["image"],
lease=data["lease"], lease=data["lease"],
flavor=data["flavor"], flavor=data["flavor"],
network_id="7245c546-2f22-4ab2-abc9-9eb59c2e6627", # TODO: replace
type="IMAGE" type="IMAGE"
) )
new_template.save() new_template.save()
......
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