Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gutyán Gábor
/
circlestack
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
73c6938b
authored
Apr 28, 2014
by
Guba Sándor
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'issue-153'
parents
4fcd632b
1e35578f
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
44 additions
and
1 deletions
+44
-1
circle/dashboard/views.py
+1
-1
circle/vm/models/instance.py
+3
-0
circle/vm/operations.py
+40
-0
No files found.
circle/dashboard/views.py
View file @
73c6938b
...
@@ -2240,7 +2240,7 @@ class DiskRemoveView(DeleteView):
...
@@ -2240,7 +2240,7 @@ class DiskRemoveView(DeleteView):
disk
=
self
.
get_object
()
disk
=
self
.
get_object
()
app
=
disk
.
get_appliance
()
app
=
disk
.
get_appliance
()
app
.
disks
.
remove
(
disk
)
app
.
remove_disk
(
disk
=
disk
,
user
=
request
.
user
)
disk
.
destroy
()
disk
.
destroy
()
next_url
=
request
.
POST
.
get
(
"next"
)
next_url
=
request
.
POST
.
get
(
"next"
)
...
...
circle/vm/models/instance.py
View file @
73c6938b
...
@@ -165,6 +165,9 @@ class InstanceTemplate(AclBase, VirtualMachineDescModel, TimeStampedModel):
...
@@ -165,6 +165,9 @@ class InstanceTemplate(AclBase, VirtualMachineDescModel, TimeStampedModel):
def
get_absolute_url
(
self
):
def
get_absolute_url
(
self
):
return
(
'dashboard.views.template-detail'
,
None
,
{
'pk'
:
self
.
pk
})
return
(
'dashboard.views.template-detail'
,
None
,
{
'pk'
:
self
.
pk
})
def
remove_disk
(
self
,
disk
,
**
kwargs
):
self
.
disks
.
remove
(
disk
)
class
Instance
(
AclBase
,
VirtualMachineDescModel
,
StatusModel
,
OperatedMixin
,
class
Instance
(
AclBase
,
VirtualMachineDescModel
,
StatusModel
,
OperatedMixin
,
TimeStampedModel
):
TimeStampedModel
):
...
...
circle/vm/operations.py
View file @
73c6938b
...
@@ -80,6 +80,26 @@ class AddInterfaceOperation(InstanceOperation):
...
@@ -80,6 +80,26 @@ class AddInterfaceOperation(InstanceOperation):
register_operation
(
AddInterfaceOperation
)
register_operation
(
AddInterfaceOperation
)
class
AddDiskOperation
(
InstanceOperation
):
activity_code_suffix
=
'add_disk'
id
=
'add_disk'
name
=
_
(
"add disk"
)
description
=
_
(
"Add the specified disk to 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
,
activity
,
user
,
system
,
disk
):
# TODO implement with hot-attach when it'll be available
return
self
.
instance
.
disks
.
add
(
disk
)
register_operation
(
AddDiskOperation
)
class
DeployOperation
(
InstanceOperation
):
class
DeployOperation
(
InstanceOperation
):
activity_code_suffix
=
'deploy'
activity_code_suffix
=
'deploy'
id
=
'deploy'
id
=
'deploy'
...
@@ -217,6 +237,26 @@ class RemoveInterfaceOperation(InstanceOperation):
...
@@ -217,6 +237,26 @@ class RemoveInterfaceOperation(InstanceOperation):
register_operation
(
RemoveInterfaceOperation
)
register_operation
(
RemoveInterfaceOperation
)
class
RemoveDiskOperation
(
InstanceOperation
):
activity_code_suffix
=
'remove_disk'
id
=
'remove_disk'
name
=
_
(
"remove disk"
)
description
=
_
(
"Remove the specified disk from the VM."
)
def
check_precond
(
self
):
super
(
RemoveDiskOperation
,
self
)
.
check_precond
()
# TODO remove check when hot-detach is implemented
if
self
.
instance
.
status
not
in
[
'STOPPED'
]:
raise
self
.
instance
.
WrongStateError
(
self
.
instance
)
def
_operation
(
self
,
activity
,
user
,
system
,
disk
):
# TODO implement with hot-detach when it'll be available
return
self
.
instance
.
disks
.
remove
(
disk
)
register_operation
(
RemoveDiskOperation
)
class
ResetOperation
(
InstanceOperation
):
class
ResetOperation
(
InstanceOperation
):
activity_code_suffix
=
'reset'
activity_code_suffix
=
'reset'
id
=
'reset'
id
=
'reset'
...
...
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