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
b221dfd0
authored
Jun 06, 2014
by
Guba Sándor
Committed by
Őry Máté
Jun 13, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vm: added create disk and download disk operations
parent
50c045e9
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
0 deletions
+42
-0
circle/vm/operations.py
+42
-0
No files found.
circle/vm/operations.py
View file @
b221dfd0
...
@@ -26,6 +26,7 @@ from django.utils.translation import ugettext_lazy as _
...
@@ -26,6 +26,7 @@ from django.utils.translation import ugettext_lazy as _
from
celery.exceptions
import
TimeLimitExceeded
from
celery.exceptions
import
TimeLimitExceeded
from
common.operations
import
Operation
,
register_operation
from
common.operations
import
Operation
,
register_operation
from
storage.models
import
Disk
from
.tasks.local_tasks
import
(
from
.tasks.local_tasks
import
(
abortable_async_instance_operation
,
abortable_async_node_operation
,
abortable_async_instance_operation
,
abortable_async_node_operation
,
)
)
...
@@ -119,6 +120,47 @@ class AddDiskOperation(InstanceOperation):
...
@@ -119,6 +120,47 @@ class AddDiskOperation(InstanceOperation):
register_operation
(
AddDiskOperation
)
register_operation
(
AddDiskOperation
)
class
CreateDiskOperation
(
InstanceOperation
):
activity_code_suffix
=
'create_disk'
id
=
'create_disk'
name
=
_
(
"create disk"
)
description
=
_
(
"Create empty disk for the VM."
)
def
check_precond
(
self
):
super
(
AddDiskOperation
,
self
)
.
check_precond
()
# TODO remove check when hot-attach is implemented
if
self
.
instance
.
status
not
in
[
'STOPPED'
]:
raise
self
.
instance
.
WrongStateError
(
self
.
instance
)
def
_operation
(
self
,
user
,
size
):
# TODO implement with hot-attach when it'll be available
disk
=
Disk
.
create
(
owner
=
user
,
size
=
size
)
self
.
instance
.
disks
.
add
(
disk
)
register_operation
(
CreateDiskOperation
)
class
DownloadDiskOperation
(
InstanceOperation
):
activity_code_suffix
=
'download_disk'
id
=
'download_disk'
name
=
_
(
"download disk"
)
description
=
_
(
"Download disk for the VM."
)
abortable
=
True
def
check_precond
(
self
):
super
(
AddDiskOperation
,
self
)
.
check_precond
()
# TODO remove check when hot-attach is implemented
if
self
.
instance
.
status
not
in
[
'STOPPED'
]:
raise
self
.
instance
.
WrongStateError
(
self
.
instance
)
def
_operation
(
self
,
user
,
url
):
# TODO implement with hot-attach when it'll be available
disk
=
Disk
.
download
(
owner
=
user
,
url
=
url
)
self
.
instance
.
disks
.
add
(
disk
)
register_operation
(
DownloadDiskOperation
)
class
DeployOperation
(
InstanceOperation
):
class
DeployOperation
(
InstanceOperation
):
activity_code_suffix
=
'deploy'
activity_code_suffix
=
'deploy'
id
=
'deploy'
id
=
'deploy'
...
...
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