client/rhel/rhn-client-tools/src/up2date_client/hardware.py | 23 +++++++----- 1 file changed, 15 insertions(+), 8 deletions(-)
New commits: commit 721cb43a480c8ad344aabc8504344b8168fb8a9d Author: Milan Zazrivec mzazrivec@redhat.com Date: Thu Jan 28 19:27:47 2010 +0100
557370 - clear dmi warnings for xen pv guests
Handling & clearing dmi warnings for module imports only is not sufficient. dmidecode module may produce warning messages during arbitrary module calls (e.g. when run on a Xen paravirtualized guest).
diff --git a/client/rhel/rhn-client-tools/src/up2date_client/hardware.py b/client/rhel/rhn-client-tools/src/up2date_client/hardware.py index 3f444c3..e5f045d 100644 --- a/client/rhel/rhn-client-tools/src/up2date_client/hardware.py +++ b/client/rhel/rhn-client-tools/src/up2date_client/hardware.py @@ -93,14 +93,6 @@ PCI_CLASS_SERIAL_USB = 3 PCI_CLASS_SERIAL_FIBER = 4 PCI_CLASS_SERIAL_SMBUS = 5
-dmi_warnings = None -if hasattr(dmidecode, 'get_warnings'): - dmi_warnings = dmidecode.get_warnings() - -if dmi_warnings: - log = up2dateLog.initLog() - log.log_debug("Warnings collected during dmidecode import: %s" % dmi_warnings) - # Some systems don't have the _locale module installed try: import locale @@ -111,6 +103,18 @@ except ImportError: _dmi_data = None _dmi_not_available = 0
+def dmi_warnings(): + if not hasattr(dmidecode, 'get_warnings'): + return None + + return dmidecode.get_warnings() + +dmi_warn = dmi_warnings() +if dmi_warn: + dmidecode.clear_warnings() + log = up2dateLog.initLog() + log.log_debug("Warnings collected during dmidecode import: %s" % dmi_warn) + def _initialize_dmi_data(): """ Initialize _dmi_data unless it already exist and returns it """ global _dmi_data, _dmi_not_available @@ -127,6 +131,9 @@ def _initialize_dmi_data(): except: # DMI decode FAIL, this can happend e.g in PV guest _dmi_not_available = 1 + dmi_warn = dmi_warnings() + if dmi_warn: + dmidecode.clear_warnings() return None _dmi_data = data.xpathNewContext(); return _dmi_data