Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Fukász Rómeó Ervin
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
f727eb9e
authored
Jan 08, 2014
by
Dudás Ádám
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
storage: extract remote worker queue name generation
parent
3619582b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
2 deletions
+11
-2
circle/storage/models.py
+11
-2
No files found.
circle/storage/models.py
View file @
f727eb9e
...
@@ -34,6 +34,9 @@ class DataStore(Model):
...
@@ -34,6 +34,9 @@ class DataStore(Model):
def
__unicode__
(
self
):
def
__unicode__
(
self
):
return
u'
%
s (
%
s)'
%
(
self
.
name
,
self
.
path
)
return
u'
%
s (
%
s)'
%
(
self
.
name
,
self
.
path
)
def
get_remote_queue_name
(
self
,
queue_id
):
return
self
.
hostname
+
'.'
+
queue_id
class
Disk
(
TimeStampedModel
):
class
Disk
(
TimeStampedModel
):
...
@@ -150,6 +153,12 @@ class Disk(TimeStampedModel):
...
@@ -150,6 +153,12 @@ class Disk(TimeStampedModel):
'type'
:
'snapshot'
if
self
.
type
==
'qcow2-snap'
else
'normal'
'type'
:
'snapshot'
if
self
.
type
==
'qcow2-snap'
else
'normal'
}
}
def
get_remote_queue_name
(
self
,
queue_id
):
if
self
.
datastore
:
return
self
.
datastore
.
get_remote_queue_name
(
queue_id
)
else
:
return
None
def
__unicode__
(
self
):
def
__unicode__
(
self
):
return
u"
%
s (#
%
d)"
%
(
self
.
name
,
self
.
id
)
return
u"
%
s (#
%
d)"
%
(
self
.
name
,
self
.
id
)
...
@@ -186,7 +195,7 @@ class Disk(TimeStampedModel):
...
@@ -186,7 +195,7 @@ class Disk(TimeStampedModel):
task_uuid
=
task_uuid
,
user
=
user
)
as
act
:
task_uuid
=
task_uuid
,
user
=
user
)
as
act
:
# Delegate create / snapshot jobs
# Delegate create / snapshot jobs
queue_name
=
self
.
datastore
.
hostname
+
".storage"
queue_name
=
self
.
get_remote_queue_name
(
'storage'
)
disk_desc
=
self
.
get_disk_desc
()
disk_desc
=
self
.
get_disk_desc
()
if
self
.
type
==
'qcow2-snap'
:
if
self
.
type
==
'qcow2-snap'
:
with
act
.
sub_activity
(
'creating_snapshot'
):
with
act
.
sub_activity
(
'creating_snapshot'
):
...
@@ -258,7 +267,7 @@ class Disk(TimeStampedModel):
...
@@ -258,7 +267,7 @@ class Disk(TimeStampedModel):
filename
=
filename
,
name
=
self
.
name
,
filename
=
filename
,
name
=
self
.
name
,
size
=
self
.
size
,
type
=
new_type
)
size
=
self
.
size
,
type
=
new_type
)
queue_name
=
self
.
datastore
.
hostname
+
".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
)
.
get
()
queue
=
queue_name
)
.
get
()
...
...
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