From 114dba11894f4314797e76b6451881a8fb7ee53a Mon Sep 17 00:00:00 2001 From: Guba Sándor Date: Tue, 1 Apr 2014 14:18:46 +0200 Subject: [PATCH] storage: removed base images after save_as except iso --- circle/storage/models.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/circle/storage/models.py b/circle/storage/models.py index b8a80d6..b674339 100644 --- a/circle/storage/models.py +++ b/circle/storage/models.py @@ -530,12 +530,17 @@ class Disk(AclBase, TimeStampedModel): def save_as(self, user=None, task_uuid=None, timeout=300): """Save VM as template. + Based on disk type: + qcow2-norm, qcow2-snap --> qcow2-norm + iso --> iso (with base) + VM must be in STOPPED state to perform this action. The timeout parameter is not used now. """ mapping = { - 'qcow2-snap': ('qcow2-norm', self.base), - 'qcow2-norm': ('qcow2-norm', self), + 'qcow2-snap': ('qcow2-norm', None), + 'qcow2-norm': ('qcow2-norm', None), + 'iso': ("iso", self), } if self.type not in mapping.keys(): raise self.WrongDiskTypeError(self.type) @@ -551,7 +556,8 @@ class Disk(AclBase, TimeStampedModel): new_type, new_base = mapping[self.type] - disk = Disk.create(base=new_base, datastore=self.datastore, + disk = Disk.create(datastore=self.datastore, + base=new_base, name=self.name, size=self.size, type=new_type) -- libgit2 0.26.0