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
7b191b30
authored
Jun 10, 2014
by
Guba Sándor
Committed by
Őry Máté
Jun 13, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vm/operations: fixed new DIsc operations
parent
364d0103
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
6 deletions
+9
-6
circle/vm/operations.py
+9
-6
No files found.
circle/vm/operations.py
View file @
7b191b30
...
...
@@ -107,14 +107,16 @@ class CreateDiskOperation(InstanceOperation):
description
=
_
(
"Create empty disk for the VM."
)
def
check_precond
(
self
):
super
(
Add
DiskOperation
,
self
)
.
check_precond
()
super
(
Create
DiskOperation
,
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
):
def
_operation
(
self
,
user
,
size
,
name
=
None
):
# TODO implement with hot-attach when it'll be available
disk
=
Disk
.
create
(
owner
=
user
,
size
=
size
)
if
not
name
:
name
=
"new disk"
disk
=
Disk
.
create
(
size
=
size
,
name
=
name
,
type
=
"qcow2-norm"
)
self
.
instance
.
disks
.
add
(
disk
)
register_operation
(
CreateDiskOperation
)
...
...
@@ -126,16 +128,17 @@ class DownloadDiskOperation(InstanceOperation):
name
=
_
(
"download disk"
)
description
=
_
(
"Download disk for the VM."
)
abortable
=
True
has_percentage
=
True
def
check_precond
(
self
):
super
(
Ad
dDiskOperation
,
self
)
.
check_precond
()
super
(
Downloa
dDiskOperation
,
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
):
def
_operation
(
self
,
user
,
url
,
task
,
name
=
None
):
# TODO implement with hot-attach when it'll be available
disk
=
Disk
.
download
(
owner
=
user
,
url
=
url
)
disk
=
Disk
.
download
(
url
=
url
,
name
=
name
,
task
=
task
)
self
.
instance
.
disks
.
add
(
disk
)
register_operation
(
DownloadDiskOperation
)
...
...
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