Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gyuricska Milán
/
cloud
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
a8f09724
authored
Aug 08, 2019
by
Bálint Máhonfai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add export disk operation to disk model
parent
70a151ef
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
14 deletions
+26
-14
circle/storage/models.py
+6
-0
circle/storage/tasks/storage_tasks.py
+5
-0
circle/vm/operations.py
+15
-14
No files found.
circle/storage/models.py
View file @
a8f09724
...
...
@@ -469,6 +469,12 @@ class Disk(TimeStampedModel):
disk
.
save
()
return
disk
def
export
(
self
,
format
):
queue_name
=
self
.
get_remote_queue_name
(
'storage'
,
priority
=
'slow'
)
storage_tasks
.
export
.
apply_async
(
args
=
[
self
.
get_disk_desc
(),
format
],
queue
=
queue_name
)
def
destroy
(
self
,
user
=
None
,
task_uuid
=
None
):
if
self
.
destroyed
:
return
False
...
...
circle/storage/tasks/storage_tasks.py
View file @
a8f09724
...
...
@@ -38,6 +38,11 @@ def download(disk_desc, url):
pass
@celery.task
(
name
=
'storagedriver.export'
)
def
export
(
disk_desc
,
format
):
pass
@celery.task
(
name
=
'storagedriver.delete'
)
def
delete
(
path
):
pass
...
...
circle/vm/operations.py
View file @
a8f09724
...
...
@@ -352,6 +352,19 @@ class DownloadDiskOperation(InstanceOperation):
@register_operation
class
ExportDiskOperation
(
InstanceOperation
):
id
=
'export_disk'
name
=
_
(
'export disk'
)
description
=
_
(
'Export disk to VMDK format.'
)
abortable
=
True
required_perms
=
(
'storage.export_disk'
,)
accept_states
=
(
'STOPPED'
,)
def
_operation
(
self
,
disk
,
format
=
'vmdk'
):
disk
.
export
(
format
)
@register_operation
class
ImportDiskOperation
(
InstanceOperation
):
id
=
'import_disk'
...
...
@@ -363,20 +376,8 @@ class ImportDiskOperation(InstanceOperation):
accept_states
=
(
'STOPPED'
,
'PENDING'
,
'RUNNING'
)
async_queue
=
'localhost.man.slow'
def
_operation
(
self
,
**
kwargs
):
from
storage.models
import
Disk
@register_operation
class
ExportDiskOperation
(
InstanceOperation
):
id
=
'export_disk'
name
=
_
(
'export disk'
)
description
=
_
(
'Export disk to VMDK format.'
)
required_perms
=
(
'storage.export_disk'
,)
accept_states
=
(
'STOPPED'
,
'PENDING'
,
'RUNNING'
)
def
_operation
(
self
,
**
kwargs
):
from
storage.models
import
Disk
def
_operation
(
self
,
activity
):
pass
@register_operation
...
...
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