Commit b0e7d502 by Őry Máté

vm: move Instance.get_screenshot to ScreenshotOperation

parent cd1b2bc0
......@@ -44,7 +44,7 @@ from common.models import (
create_readable, HumanReadableException,
)
from common.operations import OperatedMixin
from ..tasks import vm_tasks, agent_tasks
from ..tasks import agent_tasks
from .activity import (ActivityInProgressError, instance_activity,
InstanceActivity)
from .common import BaseResourceConfigModel, Lease
......@@ -835,12 +835,6 @@ class Instance(AclBase, VirtualMachineDescModel, StatusModel, OperatedMixin,
return merged_acts
def get_screenshot(self, timeout=5):
queue_name = self.get_remote_queue_name("vm", "fast")
return vm_tasks.screenshot.apply_async(args=[self.vm_name],
queue=queue_name
).get(timeout=timeout)
def get_latest_activity_in_progress(self):
try:
return InstanceActivity.objects.filter(
......
......@@ -1037,7 +1037,7 @@ class DisableOperation(NodeOperation):
@register_operation
class ScreenshotOperation(InstanceOperation):
class ScreenshotOperation(RemoteInstanceOperation):
id = 'screenshot'
name = _("screenshot")
description = _("Get a screenshot about the virtual machine's console. A "
......@@ -1046,9 +1046,7 @@ class ScreenshotOperation(InstanceOperation):
acl_level = "owner"
required_perms = ()
accept_states = ('RUNNING', )
def _operation(self):
return self.instance.get_screenshot(timeout=20)
task = vm_tasks.screenshot
@register_operation
......
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