Commit 1ea1f78b by Guba Sándor

vm: adding mem_dump property

parent 5cd533d2
...@@ -386,6 +386,15 @@ class Instance(BaseResourceConfigModel, TimeStampedModel): ...@@ -386,6 +386,15 @@ class Instance(BaseResourceConfigModel, TimeStampedModel):
return 'cloud-' + str(self.id) return 'cloud-' + str(self.id)
@property @property
def mem_dump(self):
"""Return the path for the memory dump.
It is always on the first hard drive storage named cloud-<id>.dump
"""
path = self.disks.all()[0].datastore.path
return path + '/' + 'cloud-' + str(self.id) + '.dump'
@property
def primary_host(self): def primary_host(self):
interfaces = self.interface_set.select_related('host') interfaces = self.interface_set.select_related('host')
hosts = [i.host for i in interfaces if i.host] hosts = [i.host for i in interfaces if i.host]
...@@ -622,7 +631,7 @@ class Instance(BaseResourceConfigModel, TimeStampedModel): ...@@ -622,7 +631,7 @@ class Instance(BaseResourceConfigModel, TimeStampedModel):
act.save() act.save()
queue_name = self.get_remote_queue_name('vm') queue_name = self.get_remote_queue_name('vm')
vm_tasks.sleep.apply_async(args=[self.vm_name], vm_tasks.sleep.apply_async(args=[self.vm_name, self.mem_dump],
queue=queue_name).get() queue=queue_name).get()
act.finish(result='SUCCESS') act.finish(result='SUCCESS')
...@@ -641,7 +650,7 @@ class Instance(BaseResourceConfigModel, TimeStampedModel): ...@@ -641,7 +650,7 @@ class Instance(BaseResourceConfigModel, TimeStampedModel):
act.save() act.save()
queue_name = self.get_remote_queue_name('vm') queue_name = self.get_remote_queue_name('vm')
vm_tasks.resume.apply_async(args=[self.vm_name], vm_tasks.resume.apply_async(args=[self.vm_name, self.dump_mem],
queue=queue_name).get() queue=queue_name).get()
act.finish(result='SUCCESS') act.finish(result='SUCCESS')
...@@ -719,7 +728,6 @@ class Instance(BaseResourceConfigModel, TimeStampedModel): ...@@ -719,7 +728,6 @@ class Instance(BaseResourceConfigModel, TimeStampedModel):
queue="localhost.man") queue="localhost.man")
class InstanceActivity(TimeStampedModel): class InstanceActivity(TimeStampedModel):
activity_code = CharField(verbose_name=_('activity_code'), max_length=100) activity_code = CharField(verbose_name=_('activity_code'), max_length=100)
task_uuid = CharField(verbose_name=_('task_uuid'), blank=True, task_uuid = CharField(verbose_name=_('task_uuid'), blank=True,
......
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