Commit bf9231ac by Guba Sándor

instance: added sub_activity to save_as

parent 5970aee7
...@@ -975,7 +975,7 @@ class Instance(AclBase, VirtualMachineDescModel, TimeStampedModel): ...@@ -975,7 +975,7 @@ class Instance(AclBase, VirtualMachineDescModel, TimeStampedModel):
def save_as_template(self, name, task_uuid=None, user=None, def save_as_template(self, name, task_uuid=None, user=None,
timeout=300, **kwargs): timeout=300, **kwargs):
with instance_activity(code_suffix="save_as_template", instance=self, with instance_activity(code_suffix="save_as_template", instance=self,
task_uuid=task_uuid, user=user): task_uuid=task_uuid, user=user) as act:
# prepare parameters # prepare parameters
kwargs.setdefault('name', name) kwargs.setdefault('name', name)
kwargs.setdefault('description', self.description) kwargs.setdefault('description', self.description)
...@@ -1000,12 +1000,12 @@ class Instance(AclBase, VirtualMachineDescModel, TimeStampedModel): ...@@ -1000,12 +1000,12 @@ class Instance(AclBase, VirtualMachineDescModel, TimeStampedModel):
# create template and do additional setup # create template and do additional setup
tmpl = InstanceTemplate(**kwargs) tmpl = InstanceTemplate(**kwargs)
tmpl.full_clean() tmpl.full_clean() # Avoiding database errors.
logger.info("Clean utani save")
tmpl.save() tmpl.save()
tmpl.disks.add(*[__try_save_disk(disk) with act.sub_activity('saving_disks'):
for disk in self.disks.all()]) tmpl.disks.add(*[__try_save_disk(disk)
# save template for disk in self.disks.all()])
# save template
tmpl.save() tmpl.save()
try: try:
# create interface templates # create interface templates
......
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