Commit bd5649a8 by Őry Máté

vm: move Instance.delete_mem_dump to DeleteMemDumpOperation

parent bc931f31
...@@ -767,13 +767,6 @@ class Instance(AclBase, VirtualMachineDescModel, StatusModel, OperatedMixin, ...@@ -767,13 +767,6 @@ class Instance(AclBase, VirtualMachineDescModel, StatusModel, OperatedMixin,
queue=queue_name queue=queue_name
).get(timeout=timeout) ).get(timeout=timeout)
def delete_mem_dump(self, timeout=15):
queue_name = self.mem_dump['datastore'].get_remote_queue_name(
'storage', 'fast')
from storage.tasks.storage_tasks import delete_dump
delete_dump.apply_async(args=[self.mem_dump['path']],
queue=queue_name).get(timeout=timeout)
def allocate_node(self): def allocate_node(self):
if self.node is None: if self.node is None:
self.node = self.select_node() self.node = self.select_node()
......
...@@ -428,7 +428,7 @@ class DestroyOperation(InstanceOperation): ...@@ -428,7 +428,7 @@ class DestroyOperation(InstanceOperation):
# Delete mem. dump if exists # Delete mem. dump if exists
try: try:
self.instance.delete_mem_dump() self.instance._delete_mem_dump(parent_activity=activity)
except: except:
pass pass
...@@ -446,6 +446,20 @@ class DestroyOperation(InstanceOperation): ...@@ -446,6 +446,20 @@ class DestroyOperation(InstanceOperation):
task = vm_tasks.destroy task = vm_tasks.destroy
# if e.libvirtError and "Domain not found" in str(e): # if e.libvirtError and "Domain not found" in str(e):
@register_operation
class DeleteMemDumpOperation(RemoteOperationMixin, SubOperationMixin,
InstanceOperation):
id = "_delete_mem_dump"
name = _("removing memory dump")
task = storage_tasks.delete_dump
def _get_remote_queue(self):
return self.instance.mem_dump['datastore'].get_remote_queue_name(
"storage", "fast")
def _get_remote_args(self, **kwargs):
return [self.instance.mem_dump['path']]
@register_operation @register_operation
class MigrateOperation(InstanceOperation): class MigrateOperation(InstanceOperation):
......
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