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
017603f5
authored
9 years ago
by
Czémán Arnold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
storage: remove redundant code and add doc
parent
17a4af7f
Pipeline
#133
passed with stage
in 0 seconds
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
13 deletions
+11
-13
circle/storage/models.py
+7
-0
circle/storage/tasks/periodic_tasks.py
+4
-13
No files found.
circle/storage/models.py
View file @
017603f5
...
@@ -90,6 +90,10 @@ class DataStore(Model):
...
@@ -90,6 +90,10 @@ class DataStore(Model):
@method_cache
(
30
)
@method_cache
(
30
)
def
get_orphan_disks
(
self
,
timeout
=
15
):
def
get_orphan_disks
(
self
,
timeout
=
15
):
"""Disk image files without Disk object in the database.
"""Disk image files without Disk object in the database.
Exclude cloud-xxxxxxxx.dump format images.
:param timeout: Seconds before TimeOut exception
:type timeout: int
"""
"""
queue_name
=
self
.
get_remote_queue_name
(
'storage'
,
"slow"
)
queue_name
=
self
.
get_remote_queue_name
(
'storage'
,
"slow"
)
files
=
set
(
storage_tasks
.
list_files
.
apply_async
(
files
=
set
(
storage_tasks
.
list_files
.
apply_async
(
...
@@ -105,6 +109,9 @@ class DataStore(Model):
...
@@ -105,6 +109,9 @@ class DataStore(Model):
@method_cache
(
30
)
@method_cache
(
30
)
def
get_missing_disks
(
self
,
timeout
=
15
):
def
get_missing_disks
(
self
,
timeout
=
15
):
"""Disk objects without disk image files.
"""Disk objects without disk image files.
:param timeout: Seconds before TimeOut exception
:type timeout: int
"""
"""
queue_name
=
self
.
get_remote_queue_name
(
'storage'
,
"slow"
)
queue_name
=
self
.
get_remote_queue_name
(
'storage'
,
"slow"
)
files
=
set
(
storage_tasks
.
list_files
.
apply_async
(
files
=
set
(
storage_tasks
.
list_files
.
apply_async
(
...
...
This diff is collapsed.
Click to expand it.
circle/storage/tasks/periodic_tasks.py
View file @
017603f5
...
@@ -61,15 +61,11 @@ def list_orphan_disks(timeout=15):
...
@@ -61,15 +61,11 @@ def list_orphan_disks(timeout=15):
Exclude cloud-xxxxxxxx.dump format images.
Exclude cloud-xxxxxxxx.dump format images.
:param timeout: Seconds before TimeOut exception
:param timeout: Seconds before TimeOut exception
:type timeo
i
t: int
:type timeo
u
t: int
"""
"""
import
re
import
re
for
ds
in
DataStore
.
objects
.
all
():
for
ds
in
DataStore
.
objects
.
all
():
queue_name
=
ds
.
get_remote_queue_name
(
'storage'
,
"slow"
)
for
i
in
ds
.
get_orphan_disks
(
timeout
=
timeout
):
files
=
set
(
storage_tasks
.
list_files
.
apply_async
(
args
=
[
ds
.
path
],
queue
=
queue_name
)
.
get
(
timeout
=
timeout
))
disks
=
set
([
disk
.
filename
for
disk
in
ds
.
disk_set
.
all
()])
for
i
in
files
-
disks
:
if
not
re
.
match
(
'cloud-[0-9]*
\
.dump'
,
i
):
if
not
re
.
match
(
'cloud-[0-9]*
\
.dump'
,
i
):
logging
.
warning
(
"Orphan disk:
%
s"
%
i
)
logging
.
warning
(
"Orphan disk:
%
s"
%
i
)
...
@@ -79,14 +75,9 @@ def list_missing_disks(timeout=15):
...
@@ -79,14 +75,9 @@ def list_missing_disks(timeout=15):
"""List Disk objects without disk image files.
"""List Disk objects without disk image files.
:param timeout: Seconds before TimeOut exception
:param timeout: Seconds before TimeOut exception
:type timeo
i
t: int
:type timeo
u
t: int
"""
"""
for
ds
in
DataStore
.
objects
.
all
():
for
ds
in
DataStore
.
objects
.
all
():
queue_name
=
ds
.
get_remote_queue_name
(
'storage'
,
"slow"
)
for
i
in
ds
.
get_missing_disks
(
timeout
=
timeout
):
files
=
set
(
storage_tasks
.
list_files
.
apply_async
(
args
=
[
ds
.
path
],
queue
=
queue_name
)
.
get
(
timeout
=
timeout
))
disks
=
set
([
disk
.
filename
for
disk
in
ds
.
disk_set
.
filter
(
destroyed__isnull
=
True
)])
for
i
in
disks
-
files
:
logging
.
critical
(
"Image:
%
s is missing from
%
s datastore."
logging
.
critical
(
"Image:
%
s is missing from
%
s datastore."
%
(
i
,
ds
.
path
))
%
(
i
,
ds
.
path
))
This diff is collapsed.
Click to expand it.
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