Commit 25e424c8 by Őry Máté

vm: convert Node.num_cores,ram_size to properties

parent 88ba8e10
...@@ -103,11 +103,6 @@ class Node(TimeStampedModel): ...@@ -103,11 +103,6 @@ class Node(TimeStampedModel):
name = CharField(max_length=50, unique=True, name = CharField(max_length=50, unique=True,
verbose_name=_('name'), verbose_name=_('name'),
help_text=_('Human readable name of node.')) help_text=_('Human readable name of node.'))
num_cores = IntegerField(verbose_name=_('number of cores'),
help_text=_('Number of CPU threads '
'available to the virtual machines.'))
ram_size = IntegerField(verbose_name=_('RAM size'),
help_text=_('Mebibytes of memory.'))
priority = IntegerField(verbose_name=_('priority'), priority = IntegerField(verbose_name=_('priority'),
help_text=_('Node usage priority.')) help_text=_('Node usage priority.'))
host = ForeignKey(Host, verbose_name=_('host'), host = ForeignKey(Host, verbose_name=_('host'),
...@@ -130,6 +125,20 @@ class Node(TimeStampedModel): ...@@ -130,6 +125,20 @@ class Node(TimeStampedModel):
return self.remote_query(vm_tasks.get_num_cores, timeout=1, return self.remote_query(vm_tasks.get_num_cores, timeout=1,
default=False) default=False)
@property
@method_cache(300)
def num_cores(self):
"""Number of CPU threads available to the virtual machines."""
return self.remote_query(vm_tasks.get_num_cores)
@property
@method_cache(300)
def ram_size(self):
"""Bytes of total memory in the node."""
return self.remote_query(vm_tasks.get_ram_size)
def get_remote_queue_name(self, queue_id): def get_remote_queue_name(self, queue_id):
return self.host.hostname + "." + queue_id return self.host.hostname + "." + queue_id
......
...@@ -60,6 +60,17 @@ def domain_info(params): ...@@ -60,6 +60,17 @@ def domain_info(params):
def list_domains(params): def list_domains(params):
pass pass
@celery.task(name='vmdriver.ping') @celery.task(name='vmdriver.ping')
def ping(params): def ping(params):
pass pass
@celery.task(name='vmdriver.get_core_num')
def get_core_num(params):
pass
@celery.task(name='vmdriver.get_ram_size')
def get_ram_size(params):
pass
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