Here is a new version of the python file: (It runs now).
import os, re, os.path, sys, platform
import apport.packaging
import apport.hookutils
from glob import glob
from apport.hookutils import command_output, attach_root_command_outputs, attach_file, attach_file_if_exists, command_available
""" IBM Power System related information
"""
def add_copy_spec(report,path):
for file in os.listdir(path): attach_file(report,file,key="test")
def add_info(report,ui):
arch = platform.machine()
if arch in [ "ppc64", "ppc64le"]: print("Processing query for power architecture %s" %arch)
else:
return
try: print("try")
with open('/proc/cpuinfo', 'r') as fp: contents = fp.read() ispSeries = "pSeries" in contents isPowerNV = "PowerNV" in contents isPowerKVM = "emulated by qemu" in contents
print("got flags ispSeries/isPowerNV/isPowerKVM: ", ispSeries, isPowerNV, isPowerKVM, end="\n" )
except IOError: print("Error")
ispSeries = False
isPowerNV = False
isPowerKVM = False
if ispSeries or isPowerNV: print("Processing pSeries or PowerNV") add_copy_spec(report,"/proc/device-tree/") attach_file(report, '/proc/misc', 'ProcMisc') attach_file(report, '/proc/locks', 'ProcLocks') attach_file(report, '/proc/loadavg', 'ProcLoadAvg') attach_file(report, '/proc/swaps', 'ProcSwaps') attach_file(report, '/proc/version', 'ProcVersion') report['cpu_smt'] = command_output(['ppc64_cpu', '--smt']) report['cpu_cores'] = command_output(['ppc64_cpu', '--cores-present']) report['cpu_coreson'] = command_output(['ppc64_cpu', '--cores-on'])
# To be executed as root attach_root_command_outputs(report, { 'cpu_runmode': 'ppc64_cpu --run-mode', 'cpu_freq': 'ppc64_cpu --frequency', 'cpu_dscr': 'ppc64_cpu --dscr'
}) attach_file_if_exists(report,"/var/log/platform") #add_copy_spec(report,"/dev/nvram")
if ispSeries and not isPowerKVM: print("Processing pSeries addons") attach_file(report, '/proc/ppc64/lparcfg', 'ProcLparCfg') attach_file(report, '/proc/ppc64/eeh', 'ProcEeh') attach_file(report, '/proc/ppc64/systemcfg', 'ProcSystemCfg') report['lscfg_vp'] = command_output(['lscfg', '-vp']) report['lsmcode'] = command_output(['lsmcode', '-A']) report['bootlist'] = command_output(['bootlist', '-m', 'both', '-r']) report['lparstat'] = command_output(['lparstat', '-i'])
if command_available('lsvpd'): report['lsvpd'] = command_output(['lsvpd', '--debug'])
if command_available('lsvio'): report['lsvio'] = command_output(['lsvio', '-des'])
if command_available('servicelog'): report['servicelog_dump'] = command_output(['servicelog', '--dump'])
if command_available('servicelog_notify'): report['servicelo_list'] = command_output(['servicelog_notify', '--list'])
if command_available('usysattn'): report['usysattn'] = command_output(['usysattn'])
if command_available('usysident'): report['usysident'] = command_output(['usysident'])
if command_available('serv_config'): report['serv_config'] = command_output(['serv_config', '-l'])
if isPowerNV: add_copy_spec(report,"/proc/ppc64/")
Here is a new version of the python file: (It runs now).
import os, re, os.path, sys, platform
import apport.packaging
import apport.hookutils
from glob import glob root_command_ outputs, attach_file, attach_ file_if_ exists, command_available
from apport.hookutils import command_output, attach_
""" IBM Power System related information
"""
def add_copy_ spec(report, path):
attach_ file(report, file,key= "test")
for file in os.listdir(path):
def add_info( report, ui):
print( "Processing query for power architecture %s" %arch)
arch = platform.machine()
if arch in [ "ppc64", "ppc64le"]:
else:
return
try:
print( "try") proc/cpuinfo' , 'r') as fp:
contents = fp.read()
ispSeries = "pSeries" in contents
isPowerNV = "PowerNV" in contents
isPowerKVM = "emulated by qemu" in contents isPowerNV/ isPowerKVM: ", ispSeries, isPowerNV, isPowerKVM, end="\n" )
print( "Error" )
with open('/
print("got flags ispSeries/
except IOError:
ispSeries = False
isPowerNV = False
isPowerKVM = False
if ispSeries or isPowerNV:
print( "Processing pSeries or PowerNV")
add_copy_ spec(report, "/proc/ device- tree/")
attach_ file(report, '/proc/misc', 'ProcMisc')
attach_ file(report, '/proc/locks', 'ProcLocks')
attach_ file(report, '/proc/loadavg', 'ProcLoadAvg')
attach_ file(report, '/proc/swaps', 'ProcSwaps')
attach_ file(report, '/proc/version', 'ProcVersion')
report[ 'cpu_smt' ] = command_ output( ['ppc64_ cpu', '--smt'])
report[ 'cpu_cores' ] = command_ output( ['ppc64_ cpu', '--cores-present'])
report[ 'cpu_coreson' ] = command_ output( ['ppc64_ cpu', '--cores-on'])
attach_ root_command_ outputs( report, {
'cpu_ runmode' : 'ppc64_cpu --run-mode',
'cpu_ freq': 'ppc64_cpu --frequency',
'cpu_ dscr': 'ppc64_cpu --dscr'
attach_ file_if_ exists( report, "/var/log/ platform" )
#add_copy_ spec(report, "/dev/nvram" )
# To be executed as root
})
if ispSeries and not isPowerKVM:
print( "Processing pSeries addons")
attach_ file(report, '/proc/ ppc64/lparcfg' , 'ProcLparCfg')
attach_ file(report, '/proc/ppc64/eeh', 'ProcEeh')
attach_ file(report, '/proc/ ppc64/systemcfg ', 'ProcSystemCfg')
report[ 'lscfg_ vp'] = command_ output( ['lscfg' , '-vp'])
report[ 'lsmcode' ] = command_ output( ['lsmcode' , '-A'])
report[ 'bootlist' ] = command_ output( ['bootlist' , '-m', 'both', '-r'])
report[ 'lparstat' ] = command_ output( ['lparstat' , '-i']) available( 'lsvpd' ):
report[ 'lsvpd' ] = command_ output( ['lsvpd' , '--debug']) available( 'lsvio' ):
report[ 'lsvio' ] = command_ output( ['lsvio' , '-des']) available( 'servicelog' ):
report[ 'servicelog_ dump'] = command_ output( ['servicelog' , '--dump']) available( 'servicelog_ notify' ):
report[ 'servicelo_ list'] = command_ output( ['servicelog_ notify' , '--list']) available( 'usysattn' ):
report[ 'usysattn' ] = command_ output( ['usysattn' ]) available( 'usysident' ):
report[ 'usysident' ] = command_ output( ['usysident' ]) available( 'serv_config' ):
report[ 'serv_config' ] = command_ output( ['serv_ config' , '-l'])
if command_
if command_
if command_
if command_
if command_
if command_
if command_
if isPowerNV:
add_copy_ spec(report, "/proc/ ppc64/" )