Commit faa40f86 by Őry Máté

vm: move Instance.suspend_vm to SuspendVmOperation

parent 71c7bedb
...@@ -785,13 +785,6 @@ class Instance(AclBase, VirtualMachineDescModel, StatusModel, OperatedMixin, ...@@ -785,13 +785,6 @@ class Instance(AclBase, VirtualMachineDescModel, StatusModel, OperatedMixin,
raise humanize_exception(ugettext_noop( raise humanize_exception(ugettext_noop(
"Operation aborted by user."), e) "Operation aborted by user."), e)
def suspend_vm(self, timeout=230):
queue_name = self.get_remote_queue_name('vm', 'slow')
return vm_tasks.sleep.apply_async(args=[self.vm_name,
self.mem_dump['path']],
queue=queue_name
).get(timeout=timeout)
def delete_mem_dump(self, timeout=15): def delete_mem_dump(self, timeout=15):
queue_name = self.mem_dump['datastore'].get_remote_queue_name( queue_name = self.mem_dump['datastore'].get_remote_queue_name(
'storage', 'fast') 'storage', 'fast')
......
...@@ -735,20 +735,26 @@ class SleepOperation(InstanceOperation): ...@@ -735,20 +735,26 @@ class SleepOperation(InstanceOperation):
else: else:
activity.resultant_state = 'ERROR' activity.resultant_state = 'ERROR'
def _operation(self, activity, timeout=240): def _operation(self, activity):
# Destroy networks with activity.sub_activity('shutdown_net',
with activity.sub_activity('shutdown_net', readable_name=ugettext_noop( readable_name=ugettext_noop(
"shutdown network")): "shutdown network")):
self.instance.shutdown_net() self.instance.shutdown_net()
self.instance._suspend_vm(parent_activity=activity)
self.instance.yield_node()
# Suspend vm @register_operation
with activity.sub_activity('suspending', class SuspendVmOperation(SubOperationMixin, RemoteInstanceOperation):
readable_name=ugettext_noop( id = "_suspend_vm"
"suspend virtual machine")): name = _("suspend virtual machine")
self.instance.suspend_vm(timeout=timeout) task = vm_tasks.suspend
remote_queue = ("vm", "slow")
timeout = 600
self.instance.yield_node() def _get_remote_args(self, **kwargs):
# VNC port needs to be kept return (super(SleepOperation.SuspendVmOperation, self)
._get_remote_args(**kwargs)
+ [self.instance.mem_dump['path']])
@register_operation @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