Commit 6014f0de by Guba Sándor

instance: hotfix for missing disks

parent 7c7909b2
...@@ -409,9 +409,13 @@ class Instance(AclBase, VirtualMachineDescModel, TimeStampedModel): ...@@ -409,9 +409,13 @@ class Instance(AclBase, VirtualMachineDescModel, TimeStampedModel):
It is always on the first hard drive storage named cloud-<id>.dump It is always on the first hard drive storage named cloud-<id>.dump
""" """
datastore = self.disks.all()[0].datastore try:
path = datastore.path + '/' + self.vm_name + '.dump' datastore = self.disks.all()[0].datastore
return {'datastore': datastore, 'path': path} except:
return None
else:
path = datastore.path + '/' + self.vm_name + '.dump'
return {'datastore': datastore, 'path': path}
@property @property
def primary_host(self): def primary_host(self):
...@@ -717,9 +721,9 @@ class Instance(AclBase, VirtualMachineDescModel, TimeStampedModel): ...@@ -717,9 +721,9 @@ class Instance(AclBase, VirtualMachineDescModel, TimeStampedModel):
:param act: Parent activity. :param act: Parent activity.
""" """
# Delete mem. dump if exists # Delete mem. dump if exists
queue_name = self.mem_dump['datastore'].get_remote_queue_name(
'storage')
try: try:
queue_name = self.mem_dump['datastore'].get_remote_queue_name(
'storage')
from storage.tasks.remote_tasks import delete_dump from storage.tasks.remote_tasks import delete_dump
delete_dump.apply_async(args=[self.mem_dump['path']], delete_dump.apply_async(args=[self.mem_dump['path']],
queue=queue_name).get(timeout=timeout) queue=queue_name).get(timeout=timeout)
......
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