Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gelencsér Szabolcs
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
cceea9b2
authored
Jun 17, 2014
by
Bach Dániel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vm: destroy disks on template delete
parent
3886665c
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
0 deletions
+9
-0
circle/dashboard/views.py
+3
-0
circle/vm/models/instance.py
+6
-0
No files found.
circle/dashboard/views.py
View file @
cceea9b2
...
@@ -1142,6 +1142,7 @@ class TemplateDelete(LoginRequiredMixin, DeleteView):
...
@@ -1142,6 +1142,7 @@ class TemplateDelete(LoginRequiredMixin, DeleteView):
if
not
object
.
has_level
(
request
.
user
,
'owner'
):
if
not
object
.
has_level
(
request
.
user
,
'owner'
):
raise
PermissionDenied
()
raise
PermissionDenied
()
object
.
destroy_disks
()
object
.
delete
()
object
.
delete
()
success_url
=
self
.
get_success_url
()
success_url
=
self
.
get_success_url
()
success_message
=
_
(
"Template successfully deleted."
)
success_message
=
_
(
"Template successfully deleted."
)
...
@@ -1262,6 +1263,8 @@ class NodeList(LoginRequiredMixin, SuperuserRequiredMixin, SingleTableView):
...
@@ -1262,6 +1263,8 @@ class NodeList(LoginRequiredMixin, SuperuserRequiredMixin, SingleTableView):
content_type
=
"application/json"
,
content_type
=
"application/json"
,
)
)
else
:
else
:
for
node
in
Node
.
objects
.
all
():
print
node
.
byte_ram_usage
return
super
(
NodeList
,
self
)
.
get
(
*
args
,
**
kwargs
)
return
super
(
NodeList
,
self
)
.
get
(
*
args
,
**
kwargs
)
def
get_queryset
(
self
):
def
get_queryset
(
self
):
...
...
circle/vm/models/instance.py
View file @
cceea9b2
...
@@ -190,6 +190,12 @@ class InstanceTemplate(AclBase, VirtualMachineDescModel, TimeStampedModel):
...
@@ -190,6 +190,12 @@ class InstanceTemplate(AclBase, VirtualMachineDescModel, TimeStampedModel):
def
remove_disk
(
self
,
disk
,
**
kwargs
):
def
remove_disk
(
self
,
disk
,
**
kwargs
):
self
.
disks
.
remove
(
disk
)
self
.
disks
.
remove
(
disk
)
def
destroy_disks
(
self
):
"""Destroy all associated disks.
"""
for
disk
in
self
.
disks
.
all
():
disk
.
destroy
()
class
Instance
(
AclBase
,
VirtualMachineDescModel
,
StatusModel
,
OperatedMixin
,
class
Instance
(
AclBase
,
VirtualMachineDescModel
,
StatusModel
,
OperatedMixin
,
TimeStampedModel
):
TimeStampedModel
):
...
...
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