diff options
author | John Kacur <jkacur@redhat.com> | 2017-10-20 12:17:47 +0100 |
---|---|---|
committer | Clark Williams <williams@redhat.com> | 2017-10-24 14:04:03 -0500 |
commit | 5a54d982b05caa48a51fb7db1c5c1d10a76dcc68 (patch) | |
tree | 1ef8b7f70ff9d34f2cbef5c4aef1bce037a61ae8 | |
parent | d20362ba7158aaddbd5af9dac76ed5d951fa1231 (diff) | |
download | rteval-5a54d982b05caa48a51fb7db1c5c1d10a76dcc68.tar.gz |
rteval: add the /proc/cmdline to rteval report
Bugzilla: bz1452788
Creates a new class cmdlineInfo which is added to the report
example of the output:
Cmdline: BOOT_IMAGE=/vmlinuz-3.10.0-663.el7.x86_64
root=/dev/mapper/rhel_dell--pem710--02-root ro crashkernel=auto
rd.lvm.lv=rhel_dell-pem710-02/root rd.lvm.lv=rhel_dell-pem710-02/swap
console=ttyS0,115200n81 isolcpus=3
Signed-off-by: John Kacur <jkacur@redhat.com>
cmdline
Signed-off-by: John Kacur <jkacur@redhat.com>
(cherry picked from commit 3e883c598c5588ebec3e9a6e1f8bd396e5d3ab94)
Signed-off-by: John Kacur <jkacur@redhat.com>
-rw-r--r-- | rteval/rteval_text.xsl | 5 | ||||
-rw-r--r-- | rteval/sysinfo/__init__.py | 5 | ||||
-rw-r--r-- | rteval/sysinfo/cmdline.py | 28 |
3 files changed, 37 insertions, 1 deletions
diff --git a/rteval/rteval_text.xsl b/rteval/rteval_text.xsl index e99c016..c40063e 100644 --- a/rteval/rteval_text.xsl +++ b/rteval/rteval_text.xsl @@ -136,6 +136,11 @@ <xsl:apply-templates select="loads/command_line"/> </xsl:if> <xsl:text> </xsl:text> + + <xsl:text> Cmdline: </xsl:text> + <xsl:value-of select="SystemInfo/cmdlineInfo/cmdline"/> + <xsl:text> </xsl:text> + <!-- Generate a summary report for all measurement profiles --> <xsl:apply-templates select="Measurements/Profile"/> <xsl:text> =================================================================== </xsl:text> diff --git a/rteval/sysinfo/__init__.py b/rteval/sysinfo/__init__.py index 0de985b..f7bf823 100644 --- a/rteval/sysinfo/__init__.py +++ b/rteval/sysinfo/__init__.py @@ -32,9 +32,10 @@ from cputopology import CPUtopology from memory import MemoryInfo from osinfo import OSInfo from network import NetworkInfo +from cmdline import cmdlineInfo import dmi -class SystemInfo(KernelInfo, SystemServices, dmi.DMIinfo, CPUtopology, MemoryInfo, OSInfo, NetworkInfo): +class SystemInfo(KernelInfo, SystemServices, dmi.DMIinfo, CPUtopology, MemoryInfo, OSInfo, NetworkInfo, cmdlineInfo): def __init__(self, config, logger=None): self.__logger = logger KernelInfo.__init__(self, logger=logger) @@ -42,6 +43,7 @@ class SystemInfo(KernelInfo, SystemServices, dmi.DMIinfo, CPUtopology, MemoryInf dmi.DMIinfo.__init__(self, config, logger=logger) CPUtopology.__init__(self) OSInfo.__init__(self, logger=logger) + cmdlineInfo.__init__(self, logger=logger) # Parse initial DMI decoding errors dmi.ProcessWarnings() @@ -62,6 +64,7 @@ class SystemInfo(KernelInfo, SystemServices, dmi.DMIinfo, CPUtopology, MemoryInf report_n.addChild(CPUtopology.MakeReport(self)) report_n.addChild(MemoryInfo.MakeReport(self)) report_n.addChild(dmi.DMIinfo.MakeReport(self)) + report_n.addChild(cmdlineInfo.MakeReport(self)) return report_n diff --git a/rteval/sysinfo/cmdline.py b/rteval/sysinfo/cmdline.py new file mode 100644 index 0000000..12b3a5d --- /dev/null +++ b/rteval/sysinfo/cmdline.py @@ -0,0 +1,28 @@ +import sys, os, readline, libxml2 +from rteval.Log import Log + +class cmdlineInfo: + def __init__(self, logger = None): + self.__logger = logger + + def __log(self, logtype, msg): + if self.__logger: + self.__logger.log(logtype, msg) + + def read_cmdline(self): + cmdlineList = [] + fp = open('/proc/cmdline', 'r') + line = fp.readline() + self.__log(Log.DEBUG, "/proc/mcdline\n") + fp.close() + return line + + def MakeReport(self): + rep_n = libxml2.newNode("cmdlineInfo") + cmdline_n = libxml2.newNode("cmdline") + cmdlineStr = self.read_cmdline() + cmdline_n.addContent(cmdlineStr) + self.__log(Log.DEBUG, cmdlineStr) + rep_n.addChild(cmdline_n) + + return rep_n |