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
ab7f53b9
authored
Mar 14, 2014
by
Őry Máté
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vm: rename Instance.destoryed to destroyed_at
parent
b2b4580c
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
16 additions
and
16 deletions
+16
-16
circle/dashboard/fixtures/test-vm-fixture.json
+2
-2
circle/dashboard/views.py
+3
-3
circle/network/views.py
+2
-2
circle/vm/migrations/0019_rename_instance_destroyed.py
+0
-0
circle/vm/models/instance.py
+7
-7
circle/vm/models/network.py
+1
-1
circle/vm/tasks/local_periodic_tasks.py
+1
-1
No files found.
circle/dashboard/fixtures/test-vm-fixture.json
View file @
ab7f53b9
...
...
@@ -1344,7 +1344,7 @@
"pk"
:
1
,
"model"
:
"vm.instance"
,
"fields"
:
{
"destroyed"
:
null
,
"destroyed
_at
"
:
null
,
"disks"
:
[
1
],
...
...
@@ -1375,7 +1375,7 @@
"pk"
:
12
,
"model"
:
"vm.instance"
,
"fields"
:
{
"destroyed"
:
null
,
"destroyed
_at
"
:
null
,
"disks"
:
[],
"boot_menu"
:
false
,
"owner"
:
1
,
...
...
circle/dashboard/views.py
View file @
ab7f53b9
...
...
@@ -88,7 +88,7 @@ class IndexView(LoginRequiredMixin, TemplateView):
favs
=
Instance
.
objects
.
filter
(
favourite__user
=
self
.
request
.
user
)
instances
=
Instance
.
get_objects_with_level
(
'user'
,
user
)
.
filter
(
destroyed
=
None
)
'user'
,
user
)
.
filter
(
destroyed
_at
=
None
)
display
=
list
(
favs
)
+
list
(
set
(
instances
)
-
set
(
favs
))
for
d
in
display
:
d
.
fav
=
True
if
d
in
favs
else
False
...
...
@@ -882,7 +882,7 @@ class VmList(LoginRequiredMixin, ListView):
favourite__user
=
self
.
request
.
user
)
.
values_list
(
'pk'
,
flat
=
True
)
instances
=
Instance
.
get_objects_with_level
(
'user'
,
self
.
request
.
user
)
.
filter
(
destroyed
=
None
)
.
all
()
destroyed
_at
=
None
)
.
all
()
instances
=
[{
'pk'
:
i
.
pk
,
'name'
:
i
.
name
,
...
...
@@ -899,7 +899,7 @@ class VmList(LoginRequiredMixin, ListView):
logger
.
debug
(
'VmList.get_queryset() called. User:
%
s'
,
unicode
(
self
.
request
.
user
))
queryset
=
Instance
.
get_objects_with_level
(
'user'
,
self
.
request
.
user
)
.
filter
(
destroyed
=
None
)
'user'
,
self
.
request
.
user
)
.
filter
(
destroyed
_at
=
None
)
s
=
self
.
request
.
GET
.
get
(
"s"
)
if
s
:
queryset
=
queryset
.
filter
(
name__icontains
=
s
)
...
...
circle/network/views.py
View file @
ab7f53b9
...
...
@@ -162,7 +162,7 @@ class DomainDetail(LoginRequiredMixin, SuperuserRequiredMixin,
domain
=
self
.
object
,
host__in
=
Host
.
objects
.
filter
(
interface__in
=
Interface
.
objects
.
filter
(
instance__destroyed
=
None
)
instance__destroyed
_at
=
None
)
)
)
context
[
'record_list'
]
=
SmallRecordTable
(
q
)
...
...
@@ -618,7 +618,7 @@ class VlanDetail(LoginRequiredMixin, SuperuserRequiredMixin,
context
=
super
(
VlanDetail
,
self
)
.
get_context_data
(
**
kwargs
)
q
=
Host
.
objects
.
filter
(
interface__in
=
Interface
.
objects
.
filter
(
vlan
=
self
.
object
,
instance__destroyed
=
None
vlan
=
self
.
object
,
instance__destroyed
_at
=
None
))
context
[
'host_list'
]
=
SmallHostTable
(
q
)
...
...
circle/vm/migrations/0019_rename_instance_destroyed.py
0 → 100644
View file @
ab7f53b9
This diff is collapsed.
Click to expand it.
circle/vm/models/instance.py
View file @
ab7f53b9
...
...
@@ -70,7 +70,7 @@ class InstanceActiveManager(Manager):
def
get_query_set
(
self
):
return
super
(
InstanceActiveManager
,
self
)
.
get_query_set
()
.
filter
(
destroyed
=
None
)
self
)
.
get_query_set
()
.
filter
(
destroyed
_at
=
None
)
class
VirtualMachineDescModel
(
BaseResourceConfigModel
):
...
...
@@ -203,9 +203,9 @@ class Instance(AclBase, VirtualMachineDescModel, TimeStampedModel):
help_text
=
_
(
"TCP port where VNC console listens."
),
unique
=
True
,
verbose_name
=
_
(
'vnc_port'
))
owner
=
ForeignKey
(
User
)
destroyed
=
DateTimeField
(
blank
=
True
,
null
=
True
,
help_text
=
_
(
"The virtual machine's time of "
"destruction."
))
destroyed
_at
=
DateTimeField
(
blank
=
True
,
null
=
True
,
help_text
=
_
(
"The virtual machine's time of "
"destruction."
))
objects
=
Manager
()
active
=
InstanceActiveManager
()
...
...
@@ -752,7 +752,7 @@ class Instance(AclBase, VirtualMachineDescModel, TimeStampedModel):
asynchronously.
:type task_uuid: str
"""
if
self
.
destroyed
:
if
self
.
destroyed
_at
:
raise
self
.
InstanceDestroyedError
(
self
)
def
__on_commit
(
activity
):
...
...
@@ -901,7 +901,7 @@ class Instance(AclBase, VirtualMachineDescModel, TimeStampedModel):
asynchronously.
:type task_uuid: str
"""
if
self
.
destroyed
:
if
self
.
destroyed
_at
:
return
# already destroyed, nothing to do here
def
__on_commit
(
activity
):
...
...
@@ -921,7 +921,7 @@ class Instance(AclBase, VirtualMachineDescModel, TimeStampedModel):
self
.
__cleanup_after_destroy_vm
(
act
)
self
.
destroyed
=
timezone
.
now
()
self
.
destroyed
_at
=
timezone
.
now
()
self
.
save
()
def
destroy_async
(
self
,
user
=
None
):
...
...
circle/vm/models/network.py
View file @
ab7f53b9
...
...
@@ -59,7 +59,7 @@ class Interface(Model):
@property
def
destroyed
(
self
):
return
self
.
instance
.
destroyed
return
self
.
instance
.
destroyed
_at
@property
def
mac
(
self
):
...
...
circle/vm/tasks/local_periodic_tasks.py
View file @
ab7f53b9
...
...
@@ -25,7 +25,7 @@ def garbage_collector(timeout=15):
:type timeout: int
"""
now
=
timezone
.
now
()
for
i
in
Instance
.
objects
.
filter
(
destroyed
=
None
)
.
all
():
for
i
in
Instance
.
objects
.
filter
(
destroyed
_at
=
None
)
.
all
():
if
i
.
time_of_delete
and
now
>
i
.
time_of_delete
:
i
.
destroy_async
()
logger
.
info
(
"Expired instance
%
d destroyed."
,
i
.
pk
)
...
...
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