Commit 93d05776 by Guba Sándor

added get_architecture and get_info

parent fb1c7658
...@@ -6,6 +6,7 @@ import sys ...@@ -6,6 +6,7 @@ import sys
import socket import socket
import json import json
from decorator import decorator from decorator import decorator
import lxml.etree as ET
from psutil import NUM_CPUS, virtual_memory, cpu_percent from psutil import NUM_CPUS, virtual_memory, cpu_percent
...@@ -551,6 +552,15 @@ def ping(): ...@@ -551,6 +552,15 @@ def ping():
@celery.task @celery.task
@req_connection
@wrap_libvirtError
def get_architecture():
xml = Connection.get().getCapabilities()
return ET.fromstring(xml).getchildren()[0].getchildren(
)[1].getchildren()[0].text
@celery.task
def get_core_num(): def get_core_num():
return NUM_CPUS return NUM_CPUS
...@@ -561,6 +571,13 @@ def get_ram_size(): ...@@ -561,6 +571,13 @@ def get_ram_size():
@celery.task @celery.task
def get_info():
return {'core_num': get_core_num(),
'ram_size': get_ram_size(),
'architecture': get_architecture()}
@celery.task
def get_node_metrics(): def get_node_metrics():
result = {} result = {}
result['cpu.usage'] = cpu_percent(0) result['cpu.usage'] = cpu_percent(0)
......
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