[Kimchi-devel] [PATCH] Update host number of cpus and total physical memory information

Jose Ricardo Ziviani joserz at linux.vnet.ibm.com
Mon Mar 23 13:31:09 UTC 2015


 >> +    def _update_host_info(self, host_info):
 >> +        if not isinstance(host_info, dict):
 >> +            return
 >> +
 >> +        host_info['cpus'] = psutil._psplatform.get_num_cpus()
 >> +        host_info['memory'] = psutil.phymem_usage().total
 >> +
 >
 >_get_host_info() runs once on __init__() and then set the 
self.host_info value
 >
 >So I don't think we need the above function as we can update the
 >self.host_info directly on lookup()

You prefer these codes:
host_info['cpus'] = psutil._psplatform.get_num_cpus()
host_info['memory'] = psutil.phymem_usage().total

placed in lookup() only?
So, in_get_host_info() I'd have those fields (cpus, memory) initialized 
like:
res['cpus'] = 0
res['memory'] = 0L

What do you think?

Thank you




More information about the Kimchi-devel mailing list