Commit fb838841 by Bach Dániel

vm: recreate interfaces from template in recovery operation

Closes #314
parent d3b23cb1
......@@ -1179,13 +1179,27 @@ class RecoverOperation(InstanceOperation):
except Instance.InstanceDestroyedError:
pass
def _operation(self):
for disk in self.instance.disks.all():
disk.destroyed = None
disk.restore()
disk.save()
self.instance.destroyed_at = None
self.instance.save()
def _operation(self, user, activity):
with activity.sub_activity(
'recover_instance',
readable_name=ugettext_noop("recover instance")):
self.instance.destroyed_at = None
for disk in self.instance.disks.all():
disk.destroyed = None
disk.restore()
disk.save()
self.instance.status = 'PENDING'
self.instance.save()
try:
self.instance.renew(parent_activity=activity)
except:
pass
if self.instance.template:
for net in self.instance.template.interface_set.all():
self.instance.add_interface(
parent_activity=activity, user=user, vlan=net.vlan)
@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