Commit b2b4580c by Bach Dániel Committed by cloud

vm: add Instance.cached_state property

parent 3d9dba6d
...@@ -25,6 +25,7 @@ from ..tasks import local_tasks, vm_tasks, agent_tasks ...@@ -25,6 +25,7 @@ from ..tasks import local_tasks, vm_tasks, agent_tasks
from .activity import (ActivityInProgressError, instance_activity, from .activity import (ActivityInProgressError, instance_activity,
InstanceActivity) InstanceActivity)
from .common import BaseResourceConfigModel, Lease from .common import BaseResourceConfigModel, Lease
from common.models import method_cache
from .network import Interface from .network import Interface
from .node import Node, Trait from .node import Node, Trait
...@@ -257,6 +258,11 @@ class Instance(AclBase, VirtualMachineDescModel, TimeStampedModel): ...@@ -257,6 +258,11 @@ class Instance(AclBase, VirtualMachineDescModel, TimeStampedModel):
return self.state == 'RUNNING' return self.state == 'RUNNING'
@property @property
@method_cache(10, 5)
def cached_state(self):
return self.state
@property
def state(self): def state(self):
"""State of the virtual machine instance. """State of the virtual machine instance.
""" """
......
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