Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
94
Merge Requests
10
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
fff0b304
authored
Feb 26, 2014
by
Guba Sándor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
storage: added docstring to models
parent
32b26cea
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
0 deletions
+7
-0
circle/storage/models.py
+7
-0
No files found.
circle/storage/models.py
View file @
fff0b304
...
...
@@ -101,10 +101,12 @@ class Disk(AclBase, TimeStampedModel):
@property
def
path
(
self
):
"""Get the path where the files are stored."""
return
self
.
datastore
.
path
+
'/'
+
self
.
filename
@property
def
format
(
self
):
"""Returns the proper file format for different type of images."""
return
{
'qcow2-norm'
:
'qcow2'
,
'qcow2-snap'
:
'qcow2'
,
...
...
@@ -115,6 +117,7 @@ class Disk(AclBase, TimeStampedModel):
@property
def
device_type
(
self
):
"""Returns the proper device prefix for different file format."""
return
{
'qcow2-norm'
:
'vd'
,
'qcow2-snap'
:
'vd'
,
...
...
@@ -124,6 +127,7 @@ class Disk(AclBase, TimeStampedModel):
}[
self
.
type
]
def
is_in_use
(
self
):
"""Returns True if disc is attached to an active VM else False"""
return
any
([
i
.
state
!=
'STOPPED'
for
i
in
self
.
instance_set
.
all
()])
def
get_exclusive
(
self
):
...
...
@@ -148,6 +152,7 @@ class Disk(AclBase, TimeStampedModel):
size
=
self
.
size
,
type
=
new_type
)
def
get_vmdisk_desc
(
self
):
"""Serialize disk object to the vmdriver."""
return
{
'source'
:
self
.
path
,
'driver_type'
:
self
.
format
,
...
...
@@ -157,6 +162,7 @@ class Disk(AclBase, TimeStampedModel):
}
def
get_disk_desc
(
self
):
"""Serialize disk object to the storage driver."""
return
{
'name'
:
self
.
filename
,
'dir'
:
self
.
datastore
.
path
,
...
...
@@ -167,6 +173,7 @@ class Disk(AclBase, TimeStampedModel):
}
def
get_remote_queue_name
(
self
,
queue_id
):
"""Returns the proper queue name based on the datastore."""
if
self
.
datastore
:
return
self
.
datastore
.
get_remote_queue_name
(
queue_id
)
else
:
...
...
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