def node_info():
 with _get_xapi_session() as xapi:
  host_rec = _get_record(xapi, 'host', _get_all(xapi, 'host')[0])
  host_cpu_rec = _get_record(xapi, 'host_cpu', host_rec['host_CPUs'][0])
  host_metrics_rec = _get_metrics_record(xapi, 'host', host_rec)
  def getCpuMhz():
   cpu_speeds = [int(host_cpu_rec['speed']) for host_cpu_it in host_cpu_rec if ('speed' in host_cpu_it)]
   if cpu_speeds:
    return (sum(cpu_speeds) / len(cpu_speeds))
   else:
    return 0
  def getCpuFeatures():
   if host_cpu_rec:
    return host_cpu_rec['features']
  def getFreeCpuCount():
   cnt = 0
   for host_cpu_it in host_cpu_rec:
    if (len(host_cpu_rec['cpu_pool']) == 0):
     cnt += 1
   return cnt
  info = {'cpucores': _get_val(host_rec, ['cpu_configuration', 'nr_cpus']), 'cpufeatures': getCpuFeatures(), 'cpumhz': getCpuMhz(), 'cpuarch': _get_val(host_rec, ['software_version', 'machine']), 'cputhreads': _get_val(host_rec, ['cpu_configuration', 'threads_per_core']), 'phymemory': ((int(host_metrics_rec['memory_total']) / 1024) / 1024), 'cores_per_sockets': _get_val(host_rec, ['cpu_configuration', 'cores_per_socket']), 'free_cpus': getFreeCpuCount(), 'free_memory': ((int(host_metrics_rec['memory_free']) / 1024) / 1024), 'xen_major': _get_val(host_rec, ['software_version', 'xen_major']), 'xen_minor': _get_val(host_rec, ['software_version', 'xen_minor']), 'xen_extra': _get_val(host_rec, ['software_version', 'xen_extra']), 'xen_caps': ' '.join(_get_val(host_rec, ['capabilities'])), 'xen_scheduler': _get_val(host_rec, ['sched_policy']), 'xen_pagesize': _get_val(host_rec, ['other_config', 'xen_pagesize']), 'platform_params': _get_val(host_rec, ['other_config', 'platform_params']), 'xen_commandline': _get_val(host_rec, ['other_config', 'xen_commandline']), 'xen_changeset': _get_val(host_rec, ['software_version', 'xen_changeset']), 'cc_compiler': _get_val(host_rec, ['software_version', 'cc_compiler']), 'cc_compile_by': _get_val(host_rec, ['software_version', 'cc_compile_by']), 'cc_compile_domain': _get_val(host_rec, ['software_version', 'cc_compile_domain']), 'cc_compile_date': _get_val(host_rec, ['software_version', 'cc_compile_date']), 'xend_config_format': _get_val(host_rec, ['software_version', 'xend_config_format'])}
  return info

def node_info ( ) : with _get_xapi_session ( ) as xapi : host_rec = _get_record ( xapi , 'host' , _get_all ( xapi , 'host' ) [ 0 ] ) host_cpu_rec = _get_record ( xapi , 'host_cpu' , host_rec [ 'host_CPUs' ] [ 0 ] ) host_metrics_rec = _get_metrics_record ( xapi , 'host' , host_rec ) def getCpuMhz ( ) : cpu_speeds = [ int ( host_cpu_rec [ 'speed' ] ) for host_cpu_it in host_cpu_rec if ( 'speed' in host_cpu_it ) ] if cpu_speeds : return ( sum ( cpu_speeds ) / len ( cpu_speeds ) ) else : return 0 def getCpuFeatures ( ) : if host_cpu_rec : return host_cpu_rec [ 'features' ] def getFreeCpuCount ( ) : cnt = 0 for host_cpu_it in host_cpu_rec : if ( len ( host_cpu_rec [ 'cpu_pool' ] ) == 0 ) : cnt += 1 return cnt info = { 'cpucores' : _get_val ( host_rec , [ 'cpu_configuration' , 'nr_cpus' ] ) , 'cpufeatures' : getCpuFeatures ( ) , 'cpumhz' : getCpuMhz ( ) , 'cpuarch' : _get_val ( host_rec , [ 'software_version' , 'machine' ] ) , 'cputhreads' : _get_val ( host_rec , [ 'cpu_configuration' , 'threads_per_core' ] ) , 'phymemory' : ( ( int ( host_metrics_rec [ 'memory_total' ] ) / 1024 ) / 1024 ) , 'cores_per_sockets' : _get_val ( host_rec , [ 'cpu_configuration' , 'cores_per_socket' ] ) , 'free_cpus' : getFreeCpuCount ( ) , 'free_memory' : ( ( int ( host_metrics_rec [ 'memory_free' ] ) / 1024 ) / 1024 ) , 'xen_major' : _get_val ( host_rec , [ 'software_version' , 'xen_major' ] ) , 'xen_minor' : _get_val ( host_rec , [ 'software_version' , 'xen_minor' ] ) , 'xen_extra' : _get_val ( host_rec , [ 'software_version' , 'xen_extra' ] ) , 'xen_caps' : ' ' . join ( _get_val ( host_rec , [ 'capabilities' ] ) ) , 'xen_scheduler' : _get_val ( host_rec , [ 'sched_policy' ] ) , 'xen_pagesize' : _get_val ( host_rec , [ 'other_config' , 'xen_pagesize' ] ) , 'platform_params' : _get_val ( host_rec , [ 'other_config' , 'platform_params' ] ) , 'xen_commandline' : _get_val ( host_rec , [ 'other_config' , 'xen_commandline' ] ) , 'xen_changeset' : _get_val ( host_rec , [ 'software_version' , 'xen_changeset' ] ) , 'cc_compiler' : _get_val ( host_rec , [ 'software_version' , 'cc_compiler' ] ) , 'cc_compile_by' : _get_val ( host_rec , [ 'software_version' , 'cc_compile_by' ] ) , 'cc_compile_domain' : _get_val ( host_rec , [ 'software_version' , 'cc_compile_domain' ] ) , 'cc_compile_date' : _get_val ( host_rec , [ 'software_version' , 'cc_compile_date' ] ) , 'xend_config_format' : _get_val ( host_rec , [ 'software_version' , 'xend_config_format' ] ) } return info
return a dict with information about this node cli example: .