Commit 613c590c by Őry Máté

vm: refactor InstanceActiveManager

parent 75c6484a
......@@ -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',
......@@ -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,
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 "
objects = Manager()
active = InstanceActiveManager()
active = QueryManager(destroyed_at=None)
class Meta:
app_label = 'vm'
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment