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
9b04178a
authored
Jul 22, 2016
by
Czémán Arnold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vm, storage, dashboard: rework vm recover and disk restoration
parent
17a4af7f
Pipeline
#146
passed with stage
in 0 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
10 deletions
+19
-10
circle/dashboard/templates/dashboard/_disk-list-element.html
+3
-1
circle/storage/models.py
+3
-5
circle/storage/tasks/local_tasks.py
+1
-1
circle/vm/operations.py
+12
-3
No files found.
circle/dashboard/templates/dashboard/_disk-list-element.html
View file @
9b04178a
...
...
@@ -3,7 +3,9 @@
<i
class=
"fa fa-file"
></i>
{{ d.name }} (#{{ d.id }}) - {{ d.size|filesize }}
{% if d.destroyed %}
<i
class=
"fa fa-exclamation-triangle text-danger"
alt=
"missing"
title=
"missing"
></i>
{% endif %}
<span
class=
"operation-wrapper pull-right"
>
{% if d.is_resizable %}
...
...
circle/storage/models.py
View file @
9b04178a
...
...
@@ -76,9 +76,8 @@ class DataStore(Model):
def
get_deletable_disks
(
self
):
deletables
=
[
disk
for
disk
in
self
.
disk_set
.
filter
(
destroyed__isnull
=
False
)
if
disk
.
is_deletable
]
deletables
=
sorted
(
deletables
,
key
=
lambda
disk
:
disk
.
destroyed
)
destroyed__isnull
=
False
)
.
order_by
(
"destroyed"
)
if
disk
.
is_deletable
]
return
[
disk
.
filename
for
disk
in
deletables
]
@method_cache
(
30
)
...
...
@@ -475,8 +474,6 @@ class Disk(TimeStampedModel):
"""
queue_name
=
self
.
datastore
.
get_remote_queue_name
(
'storage'
,
priority
=
'slow'
)
logger
.
info
(
"Image:
%
s at Datastore:
%
s recovered from trash."
%
(
self
.
filename
,
self
.
datastore
.
path
))
res
=
storage_tasks
.
exists
.
apply_async
(
args
=
[
self
.
datastore
.
path
,
self
.
filename
],
...
...
@@ -487,6 +484,7 @@ class Disk(TimeStampedModel):
else
:
logger
.
info
(
"Image:
%
s at Datastore:
%
s not recovered."
%
(
self
.
filename
,
self
.
datastore
.
path
))
return
res
def
save_as
(
self
,
task
=
None
,
user
=
None
,
task_uuid
=
None
,
timeout
=
300
):
"""Save VM as template.
...
...
circle/storage/tasks/local_tasks.py
View file @
9b04178a
...
...
@@ -62,7 +62,7 @@ def destroy(disk, user):
@celery.task
def
restore
(
disk
,
user
):
disk
.
restore
(
task_uuid
=
restore
.
request
.
id
,
user
=
user
)
return
disk
.
restore
(
task_uuid
=
restore
.
request
.
id
,
user
=
user
)
@celery.task
(
base
=
AbortableTask
,
bind
=
True
)
...
...
circle/vm/operations.py
View file @
9b04178a
...
...
@@ -1347,10 +1347,13 @@ class RecoverOperation(InstanceOperation):
'recover_instance'
,
readable_name
=
ugettext_noop
(
"recover instance"
)):
self
.
instance
.
destroyed_at
=
None
not_restored
=
[]
for
disk
in
self
.
instance
.
disks
.
all
():
disk
.
destroyed
=
None
disk
.
restore
()
disk
.
save
()
if
disk
.
restore
():
disk
.
destroyed
=
None
disk
.
save
()
else
:
not_restored
.
append
(
unicode
(
disk
))
self
.
instance
.
status
=
'PENDING'
self
.
instance
.
save
()
...
...
@@ -1359,6 +1362,12 @@ class RecoverOperation(InstanceOperation):
except
:
pass
if
not_restored
:
raise
HumanReadableException
.
create
(
ugettext_noop
(
"The following disk(s) couldn't be recovered:
%(disks)
s"
),
disks
=
", "
.
join
(
not_restored
)
)
if
self
.
instance
.
template
:
for
net
in
self
.
instance
.
template
.
interface_set
.
all
():
self
.
instance
.
add_interface
(
...
...
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