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
5bba4803
authored
Sep 26, 2013
by
Guba Sándor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactoring storage function names delegate create and snapshot
parent
f32bb4ec
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
11 deletions
+24
-11
circle/storage/models.py
+11
-3
circle/storage/tasks/remote_tasks.py
+13
-8
No files found.
circle/storage/models.py
View file @
5bba4803
...
...
@@ -132,11 +132,19 @@ class Disk(TimeStampedModel):
'dir'
:
self
.
datastore
.
path
,
'format'
:
self
.
format
,
'size'
:
self
.
size
,
'base_name'
:
self
.
base
.
name
if
self
.
base
else
None
,
'base_name'
:
self
.
base
.
file
name
if
self
.
base
else
None
,
'type'
:
'snapshot'
if
self
.
type
==
'qcow2-snap'
else
'normal'
}
remote_tasks
.
create_disk
.
apply_async
(
args
=
[
disk_desc
],
queue
=
self
.
datastore
.
hostname
+
".storage"
)
.
get
()
# Delegate create / snapshot jobs
if
self
.
type
==
'qcow2-snap'
:
remote_tasks
.
snapshot
.
apply_async
(
args
=
[
disk_desc
],
queue
=
self
.
datastore
.
hostname
+
".storage"
)
.
get
()
else
:
remote_tasks
.
create
.
apply_async
(
args
=
[
disk_desc
],
queue
=
self
.
datastore
.
hostname
+
".storage"
)
.
get
()
self
.
ready
=
True
self
.
save
()
return
True
...
...
circle/storage/tasks/remote_tasks.py
View file @
5bba4803
from
manager.mancelery
import
celery
@celery.task
(
name
=
'storagedriver.list
_disks
'
)
def
list
_disks
(
dir
):
@celery.task
(
name
=
'storagedriver.list'
)
def
list
(
dir
):
pass
@celery.task
(
name
=
'storagedriver.create
_disk
'
)
def
create
_disk
(
disk_desc
):
@celery.task
(
name
=
'storagedriver.create'
)
def
create
(
disk_desc
):
pass
@celery.task
(
name
=
'storagedriver.delete
_disk
'
)
def
delete
_disk
(
json_data
):
@celery.task
(
name
=
'storagedriver.delete'
)
def
delete
(
json_data
):
pass
@celery.task
(
name
=
'storagedriver.get_disk'
)
def
get_disk
(
json_data
):
@celery.task
(
name
=
'storagedriver.snapshot'
)
def
snapshot
(
json_data
):
pass
@celery.task
(
name
=
'storagedriver.get'
)
def
get
(
json_data
):
pass
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