Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gelencsér Szabolcs
/
circlestack
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
114dba11
authored
Apr 01, 2014
by
Guba Sándor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
storage: removed base images after save_as except iso
parent
498eb828
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
3 deletions
+9
-3
circle/storage/models.py
+9
-3
No files found.
circle/storage/models.py
View file @
114dba11
...
@@ -530,12 +530,17 @@ class Disk(AclBase, TimeStampedModel):
...
@@ -530,12 +530,17 @@ class Disk(AclBase, TimeStampedModel):
def
save_as
(
self
,
user
=
None
,
task_uuid
=
None
,
timeout
=
300
):
def
save_as
(
self
,
user
=
None
,
task_uuid
=
None
,
timeout
=
300
):
"""Save VM as template.
"""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.
VM must be in STOPPED state to perform this action.
The timeout parameter is not used now.
The timeout parameter is not used now.
"""
"""
mapping
=
{
mapping
=
{
'qcow2-snap'
:
(
'qcow2-norm'
,
self
.
base
),
'qcow2-snap'
:
(
'qcow2-norm'
,
None
),
'qcow2-norm'
:
(
'qcow2-norm'
,
self
),
'qcow2-norm'
:
(
'qcow2-norm'
,
None
),
'iso'
:
(
"iso"
,
self
),
}
}
if
self
.
type
not
in
mapping
.
keys
():
if
self
.
type
not
in
mapping
.
keys
():
raise
self
.
WrongDiskTypeError
(
self
.
type
)
raise
self
.
WrongDiskTypeError
(
self
.
type
)
...
@@ -551,7 +556,8 @@ class Disk(AclBase, TimeStampedModel):
...
@@ -551,7 +556,8 @@ class Disk(AclBase, TimeStampedModel):
new_type
,
new_base
=
mapping
[
self
.
type
]
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
,
name
=
self
.
name
,
size
=
self
.
size
,
type
=
new_type
)
type
=
new_type
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment