[Kimchi-devel] [PATCH 7/9] Remove Host Resource from Kimchi

Aline Manera alinefm at linux.vnet.ibm.com
Fri Oct 23 23:20:32 UTC 2015


Signed-off-by: Aline Manera <alinefm at linux.vnet.ibm.com>
---
 src/wok/plugins/kimchi/control/host.py |  2 +-
 src/wok/plugins/kimchi/model/host.py   | 38 ----------------------------------
 2 files changed, 1 insertion(+), 39 deletions(-)

diff --git a/src/wok/plugins/kimchi/control/host.py b/src/wok/plugins/kimchi/control/host.py
index baf17bc..9bc703a 100644
--- a/src/wok/plugins/kimchi/control/host.py
+++ b/src/wok/plugins/kimchi/control/host.py
@@ -38,7 +38,7 @@ class Host(Resource):
 
     @property
     def data(self):
-        return self.info
+        return {}
 
 
 class VMHolders(SimpleCollection):
diff --git a/src/wok/plugins/kimchi/model/host.py b/src/wok/plugins/kimchi/model/host.py
index a128ead..96f4bea 100644
--- a/src/wok/plugins/kimchi/model/host.py
+++ b/src/wok/plugins/kimchi/model/host.py
@@ -18,55 +18,17 @@
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
 
 import libvirt
-import psutil
 from lxml import objectify
 
 from wok.exception import InvalidParameter
 from wok.exception import NotFoundError
 from wok.xmlutils.utils import xpath_get_text
-from wok.model.tasks import TaskModel
 
 from wok.plugins.kimchi import disks
 from wok.plugins.kimchi.model import hostdev
 from wok.plugins.kimchi.model.config import CapabilitiesModel
 from wok.plugins.kimchi.model.vms import VMModel, VMsModel
 
-HOST_STATS_INTERVAL = 1
-
-
-class HostModel(object):
-    def __init__(self, **kargs):
-        self.conn = kargs['conn']
-        self.objstore = kargs['objstore']
-        self.task = TaskModel(**kargs)
-        self.host_info = {}
-
-    def lookup(self, *name):
-        cpus = 0
-
-        # psutil is unstable on how to get the number of
-        # cpus, different versions call it differently
-        if hasattr(psutil, 'cpu_count'):
-            cpus = psutil.cpu_count()
-
-        elif hasattr(psutil, 'NUM_CPUS'):
-            cpus = psutil.NUM_CPUS
-
-        elif hasattr(psutil, '_psplatform'):
-            for method_name in ['_get_num_cpus', 'get_num_cpus']:
-
-                method = getattr(psutil._psplatform, method_name, None)
-                if method is not None:
-                    cpus = method()
-                    break
-
-        self.host_info['cpus'] = cpus
-        if hasattr(psutil, 'phymem_usage'):
-            self.host_info['memory'] = psutil.phymem_usage().total
-        elif hasattr(psutil, 'virtual_memory'):
-            self.host_info['memory'] = psutil.virtual_memory().total
-        return self.host_info
-
 
 class DevicesModel(object):
     def __init__(self, **kargs):
-- 
2.1.0




More information about the Kimchi-devel mailing list