Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gyuricska Milán
/
cloud
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
7c7909b2
authored
Mar 13, 2014
by
Guba Sándor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
storage: fixed snapshot and format
parent
4b1d3f50
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
3 deletions
+14
-3
circle/storage/models.py
+14
-3
No files found.
circle/storage/models.py
View file @
7c7909b2
...
@@ -114,7 +114,7 @@ class Disk(AclBase, TimeStampedModel):
...
@@ -114,7 +114,7 @@ class Disk(AclBase, TimeStampedModel):
return
join
(
self
.
datastore
.
path
,
self
.
filename
)
return
join
(
self
.
datastore
.
path
,
self
.
filename
)
@property
@property
def
format
(
self
):
def
vm_
format
(
self
):
"""Returns the proper file format for different type of images."""
"""Returns the proper file format for different type of images."""
return
{
return
{
'qcow2-norm'
:
'qcow2'
,
'qcow2-norm'
:
'qcow2'
,
...
@@ -125,6 +125,17 @@ class Disk(AclBase, TimeStampedModel):
...
@@ -125,6 +125,17 @@ class Disk(AclBase, TimeStampedModel):
}[
self
.
type
]
}[
self
.
type
]
@property
@property
def
format
(
self
):
"""Returns the proper file format for different type of images."""
return
{
'qcow2-norm'
:
'qcow2'
,
'qcow2-snap'
:
'qcow2'
,
'iso'
:
'iso'
,
'raw-ro'
:
'raw'
,
'raw-rw'
:
'raw'
,
}[
self
.
type
]
@property
def
device_type
(
self
):
def
device_type
(
self
):
"""Returns the proper device prefix for different file format."""
"""Returns the proper device prefix for different file format."""
return
{
return
{
...
@@ -196,7 +207,7 @@ class Disk(AclBase, TimeStampedModel):
...
@@ -196,7 +207,7 @@ class Disk(AclBase, TimeStampedModel):
"""Serialize disk object to the vmdriver."""
"""Serialize disk object to the vmdriver."""
return
{
return
{
'source'
:
self
.
path
,
'source'
:
self
.
path
,
'driver_type'
:
self
.
format
,
'driver_type'
:
self
.
vm_
format
,
'driver_cache'
:
'none'
,
'driver_cache'
:
'none'
,
'target_device'
:
self
.
device_type
+
self
.
dev_num
,
'target_device'
:
self
.
device_type
+
self
.
dev_num
,
'disk_device'
:
'cdrom'
if
self
.
type
==
'iso'
else
'disk'
'disk_device'
:
'cdrom'
if
self
.
type
==
'iso'
else
'disk'
...
@@ -210,7 +221,7 @@ class Disk(AclBase, TimeStampedModel):
...
@@ -210,7 +221,7 @@ class Disk(AclBase, TimeStampedModel):
'format'
:
self
.
format
,
'format'
:
self
.
format
,
'size'
:
self
.
size
,
'size'
:
self
.
size
,
'base_name'
:
self
.
base
.
filename
if
self
.
base
else
None
,
'base_name'
:
self
.
base
.
filename
if
self
.
base
else
None
,
'type'
:
'snapshot'
if
self
.
type
==
'qcow2-snap'
else
'normal'
'type'
:
'snapshot'
if
self
.
base
else
'normal'
}
}
def
get_remote_queue_name
(
self
,
queue_id
=
'storage'
,
check_worker
=
True
):
def
get_remote_queue_name
(
self
,
queue_id
=
'storage'
,
check_worker
=
True
):
...
...
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