Commit a4d5963c by Őry Máté

vm: add clone=False arg to SaveAsTemplateOperation

parent 95f16415
...@@ -637,7 +637,7 @@ class SaveAsTemplateOperation(InstanceOperation): ...@@ -637,7 +637,7 @@ class SaveAsTemplateOperation(InstanceOperation):
disk.destroy() disk.destroy()
def _operation(self, activity, user, system, name=None, def _operation(self, activity, user, system, name=None,
with_shutdown=True, task=None, **kwargs): with_shutdown=True, clone=False, task=None, **kwargs):
if with_shutdown: if with_shutdown:
try: try:
ShutdownOperation(self.instance).call(parent_activity=activity, ShutdownOperation(self.instance).call(parent_activity=activity,
...@@ -687,6 +687,8 @@ class SaveAsTemplateOperation(InstanceOperation): ...@@ -687,6 +687,8 @@ class SaveAsTemplateOperation(InstanceOperation):
tmpl = InstanceTemplate(**params) tmpl = InstanceTemplate(**params)
tmpl.full_clean() # Avoiding database errors. tmpl.full_clean() # Avoiding database errors.
tmpl.save() tmpl.save()
if clone:
tmpl.clone_acl(self.instance.template)
try: try:
tmpl.disks.add(*self.disks) tmpl.disks.add(*self.disks)
# 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