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
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
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
11 deletions
+14
-11
circle/storage/models.py
+14
-11
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,25 +410,24 @@ class Disk(AclBase, TimeStampedModel):
...
@@ -406,25 +410,24 @@ 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
,
new_type
,
new_base
=
mapping
[
self
.
type
]
task_uuid
=
task_uuid
,
user
=
user
,
timeout
=
300
):
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
()
return
disk
return
disk
class
DiskActivity
(
ActivityModel
):
class
DiskActivity
(
ActivityModel
):
...
...
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