touch-packages team mailing list archive
-
touch-packages team
-
Mailing list archive
-
Message #00631
[Bug 1336462] Re: Make apport collect some Power information
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/")
--
You received this bug notification because you are a member of Ubuntu
Touch seeded packages, which is subscribed to apport in Ubuntu.
https://bugs.launchpad.net/bugs/1336462
Title:
Make apport collect some Power information
Status in “apport” package in Ubuntu:
In Progress
Bug description:
On power/ppc64el system, we would need to enhance current apport reporting tool which some information like file content or commands output including
"/proc/device-tree/"
"/proc/loadavg"
"/proc/locks"
"/proc/misc"
"/proc/swaps"
"/proc/version"
"/dev/nvram"
"/var/log/platform"
"ppc64_cpu --smt"
"ppc64_cpu --cores-present"
"ppc64_cpu --cores-on"
"ppc64_cpu --run-mode"
"ppc64_cpu --frequency"
"ppc64_cpu --dscr"
Readme says : For complete instructions, see /usr/share/doc/apport/package-hooks.txt but
cat: /usr/share/doc/apport/package-hooks.txt: No such file or directory
Do I understand correctly I would need to create a file (for example)
named : /usr/share/apport/general-hooks/power.py ?
Other questions:
Do you have common functions to put output of commands in logfile ?
do you have common functions to copy config file tree content to log file or should I create the list of file and copy content of each file to the logfile ?
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/apport/+bug/1336462/+subscriptions