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
A prog2-höz tartozó friss repo anyagok itt elérhetőek:
https://git.iit.bme.hu/
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):
...
@@ -101,10 +101,12 @@ class Disk(AclBase, TimeStampedModel):
@property
@property
def
path
(
self
):
def
path
(
self
):
"""Get the path where the files are stored."""
return
self
.
datastore
.
path
+
'/'
+
self
.
filename
return
self
.
datastore
.
path
+
'/'
+
self
.
filename
@property
@property
def
format
(
self
):
def
format
(
self
):
"""Returns the proper file format for different type of images."""
return
{
return
{
'qcow2-norm'
:
'qcow2'
,
'qcow2-norm'
:
'qcow2'
,
'qcow2-snap'
:
'qcow2'
,
'qcow2-snap'
:
'qcow2'
,
...
@@ -115,6 +117,7 @@ class Disk(AclBase, TimeStampedModel):
...
@@ -115,6 +117,7 @@ class Disk(AclBase, TimeStampedModel):
@property
@property
def
device_type
(
self
):
def
device_type
(
self
):
"""Returns the proper device prefix for different file format."""
return
{
return
{
'qcow2-norm'
:
'vd'
,
'qcow2-norm'
:
'vd'
,
'qcow2-snap'
:
'vd'
,
'qcow2-snap'
:
'vd'
,
...
@@ -124,6 +127,7 @@ class Disk(AclBase, TimeStampedModel):
...
@@ -124,6 +127,7 @@ class Disk(AclBase, TimeStampedModel):
}[
self
.
type
]
}[
self
.
type
]
def
is_in_use
(
self
):
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
()])
return
any
([
i
.
state
!=
'STOPPED'
for
i
in
self
.
instance_set
.
all
()])
def
get_exclusive
(
self
):
def
get_exclusive
(
self
):
...
@@ -148,6 +152,7 @@ class Disk(AclBase, TimeStampedModel):
...
@@ -148,6 +152,7 @@ class Disk(AclBase, TimeStampedModel):
size
=
self
.
size
,
type
=
new_type
)
size
=
self
.
size
,
type
=
new_type
)
def
get_vmdisk_desc
(
self
):
def
get_vmdisk_desc
(
self
):
"""Serialize disk object to the vmdriver."""
return
{
return
{
'source'
:
self
.
path
,
'source'
:
self
.
path
,
'driver_type'
:
self
.
format
,
'driver_type'
:
self
.
format
,
...
@@ -157,6 +162,7 @@ class Disk(AclBase, TimeStampedModel):
...
@@ -157,6 +162,7 @@ class Disk(AclBase, TimeStampedModel):
}
}
def
get_disk_desc
(
self
):
def
get_disk_desc
(
self
):
"""Serialize disk object to the storage driver."""
return
{
return
{
'name'
:
self
.
filename
,
'name'
:
self
.
filename
,
'dir'
:
self
.
datastore
.
path
,
'dir'
:
self
.
datastore
.
path
,
...
@@ -167,6 +173,7 @@ class Disk(AclBase, TimeStampedModel):
...
@@ -167,6 +173,7 @@ class Disk(AclBase, TimeStampedModel):
}
}
def
get_remote_queue_name
(
self
,
queue_id
):
def
get_remote_queue_name
(
self
,
queue_id
):
"""Returns the proper queue name based on the datastore."""
if
self
.
datastore
:
if
self
.
datastore
:
return
self
.
datastore
.
get_remote_queue_name
(
queue_id
)
return
self
.
datastore
.
get_remote_queue_name
(
queue_id
)
else
:
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