Commit 2a1ce8f5 by Guba Sándor

node: added legacy property for scheduler

parent 3b66d6d6
...@@ -7,6 +7,8 @@ from django.db.models import ( ...@@ -7,6 +7,8 @@ from django.db.models import (
) )
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from warnings import warn
from celery.exceptions import TimeoutError from celery.exceptions import TimeoutError
from model_utils.models import TimeStampedModel from model_utils.models import TimeStampedModel
from taggit.managers import TaggableManager from taggit.managers import TaggableManager
...@@ -87,12 +89,22 @@ class Node(TimeStampedModel): ...@@ -87,12 +89,22 @@ class Node(TimeStampedModel):
@method_cache(300) @method_cache(300)
def get_info(self): def get_info(self):
return self.remote_query(vm_tasks.get_info, return self.remote_query(vm_tasks.get_info,
default={'cpu': '', default={'core_num': '',
'ram': '0', 'ram_size': '0',
'arch': ''}) 'architecture': ''})
info = property(get_info) info = property(get_info)
@property
def ram_size(self):
warn('Use Node.info["ram_size"]', DeprecationWarning)
return self.info['ram_size']
@property
def num_cores(self):
warn('Use Node.info["core_num"]', DeprecationWarning)
return self.info['core_num']
STATES = {False: {False: ('OFFLINE', _('offline')), STATES = {False: {False: ('OFFLINE', _('offline')),
True: ('DISABLED', _('disabled'))}, True: ('DISABLED', _('disabled'))},
True: {False: ('MISSING', _('missing')), True: {False: ('MISSING', _('missing')),
......
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