Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gutyán Gábor
/
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
0e472d2f
authored
Mar 06, 2014
by
Guba Sándor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
storage: update Disk save_as and save_as_async methods
parent
5dd8ad59
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
7 deletions
+10
-7
circle/storage/models.py
+10
-7
No files found.
circle/storage/models.py
View file @
0e472d2f
...
@@ -393,7 +393,11 @@ class Disk(AclBase, TimeStampedModel):
...
@@ -393,7 +393,11 @@ class Disk(AclBase, TimeStampedModel):
local_tasks
.
restore
.
apply_async
(
args
=
[
self
,
user
],
local_tasks
.
restore
.
apply_async
(
args
=
[
self
,
user
],
queue
=
'localhost.man'
)
queue
=
'localhost.man'
)
def
save_as
(
self
,
user
=
None
,
task_uuid
=
None
,
timeout
=
120
):
def
save_as_async
(
self
,
disk
,
task_uuid
=
None
,
timeout
=
300
,
user
=
None
):
return
local_tasks
.
save_as
.
apply_async
(
args
=
[
disk
,
timeout
,
user
],
queue
=
"localhost.man"
)
def
save_as
(
self
,
user
=
None
,
task_uuid
=
None
,
timeout
=
300
):
mapping
=
{
mapping
=
{
'qcow2-snap'
:
(
'qcow2-norm'
,
self
.
base
),
'qcow2-snap'
:
(
'qcow2-norm'
,
self
.
base
),
}
}
...
@@ -406,21 +410,20 @@ class Disk(AclBase, TimeStampedModel):
...
@@ -406,21 +410,20 @@ class Disk(AclBase, TimeStampedModel):
# from this point on, the caller has to guarantee that the disk is not
# from this point on, the caller has to guarantee that the disk is not
# going to be used until the operation is complete
# going to be used until the operation is complete
with
disk_activity
(
code_suffix
=
'save_as'
,
disk
=
self
,
task_uuid
=
task_uuid
,
user
=
user
,
timeout
=
300
):
new_type
,
new_base
=
mapping
[
self
.
type
]
new_type
,
new_base
=
mapping
[
self
.
type
]
disk
=
Disk
.
objects
.
create
(
base
=
new_base
,
datastore
=
self
.
datastore
,
disk
=
Disk
.
create
(
base
=
new_base
,
datastore
=
self
.
datastore
,
name
=
self
.
name
,
size
=
self
.
size
,
name
=
self
.
name
,
size
=
self
.
size
,
type
=
new_type
)
type
=
new_type
)
disk
.
save
()
with
disk_activity
(
code_suffix
=
"save_as"
,
disk
=
self
,
user
=
user
,
task_uuid
=
None
):
queue_name
=
self
.
get_remote_queue_name
(
'storage'
)
queue_name
=
self
.
get_remote_queue_name
(
'storage'
)
remote_tasks
.
merge
.
apply_async
(
args
=
[
self
.
get_disk_desc
(),
remote_tasks
.
merge
.
apply_async
(
args
=
[
self
.
get_disk_desc
(),
disk
.
get_disk_desc
()],
disk
.
get_disk_desc
()],
queue
=
queue_name
queue
=
queue_name
)
.
get
(
timeout
=
timeout
)
)
.
get
()
disk
.
ready
=
True
disk
.
ready
=
True
disk
.
save
()
disk
.
save
()
...
...
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