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
613c590c
authored
Sep 25, 2014
by
Őry Máté
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vm: refactor InstanceActiveManager
parent
75c6484a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
10 deletions
+3
-10
circle/vm/models/__init__.py
+1
-2
circle/vm/models/instance.py
+2
-8
No files found.
circle/vm/models/__init__.py
View file @
613c590c
...
...
@@ -7,7 +7,6 @@ from .common import BaseResourceConfigModel
from
.common
import
Lease
from
.common
import
NamedBaseResourceConfig
from
.common
import
Trait
from
.instance
import
InstanceActiveManager
from
.instance
import
VirtualMachineDescModel
from
.instance
import
InstanceTemplate
from
.instance
import
Instance
...
...
@@ -19,7 +18,7 @@ from .network import Interface
from
.node
import
Node
__all__
=
[
'InstanceActivity'
,
'
InstanceActiveManager'
,
'
BaseResourceConfigModel'
,
'InstanceActivity'
,
'BaseResourceConfigModel'
,
'NamedBaseResourceConfig'
,
'VirtualMachineDescModel'
,
'InstanceTemplate'
,
'Instance'
,
'instance_activity'
,
'post_state_changed'
,
'pre_state_changed'
,
'InterfaceTemplate'
,
'Interface'
,
'Trait'
,
'Node'
,
'NodeActivity'
,
'Lease'
,
...
...
circle/vm/models/instance.py
View file @
613c590c
...
...
@@ -38,6 +38,7 @@ from django.utils import timezone
from
django.utils.translation
import
ugettext_lazy
as
_
,
ugettext_noop
from
model_utils
import
Choices
from
model_utils.managers
import
QueryManager
from
model_utils.models
import
TimeStampedModel
,
StatusModel
from
taggit.managers
import
TaggableManager
...
...
@@ -92,13 +93,6 @@ def find_unused_vnc_port():
return
port
class
InstanceActiveManager
(
Manager
):
def
get_query_set
(
self
):
return
super
(
InstanceActiveManager
,
self
)
.
get_query_set
()
.
filter
(
destroyed_at
=
None
)
class
VirtualMachineDescModel
(
BaseResourceConfigModel
):
"""Abstract base for virtual machine describing models.
...
...
@@ -264,7 +258,7 @@ class Instance(AclBase, VirtualMachineDescModel, StatusModel, OperatedMixin,
help_text
=
_
(
"The virtual machine's time of "
"destruction."
))
objects
=
Manager
()
active
=
InstanceActiveManager
(
)
active
=
QueryManager
(
destroyed_at
=
None
)
class
Meta
:
app_label
=
'vm'
...
...
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