Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 1482117 Details for
Bug 1624372
The Virtualization type could not show for VMware guests
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
test_dmi.py
test_dmi.py (text/x-python), 2.44 KB, created by
Tomáš Kašpárek
on 2018-09-10 12:47:02 UTC
(
hide
)
Description:
test_dmi.py
Filename:
MIME Type:
Creator:
Tomáš Kašpárek
Created:
2018-09-10 12:47:02 UTC
Size:
2.44 KB
patch
obsolete
>#!/usr/bin/python > >import dmidecode > >_dmi_data = None >_dmi_not_available = 0 > >def dmi_warnings(): > if not hasattr(dmidecode, 'get_warnings'): > return None > > return dmidecode.get_warnings() > >def _initialize_dmi_data(): > """ Initialize _dmi_data unless it already exist and returns it """ > global _dmi_data, _dmi_not_available > if _dmi_data is None: > if _dmi_not_available: > # do not try to initialize it again and again if not available > return None > else : > dmixml = dmidecode.dmidecodeXML() > dmixml.SetResultType(dmidecode.DMIXML_DOC) > # Get all the DMI data and prepare a XPath context > try: > data = dmixml.QuerySection('all') > dmi_warn = dmi_warnings() > if dmi_warn: > dmidecode.clear_warnings() > 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 > >def get_dmi_data(path): > """ Fetch DMI data from given section using given path. > If data could not be retrieved, returns empty string. > General method and should not be used outside of this module. > """ > dmi_data = _initialize_dmi_data() > if dmi_data is None: > return '' > data = dmi_data.xpathEval(path) > if data != []: > return data[0].content > else: > # The path do not exist > return '' > >def dmi_system_uuid(): > """ Return UUID from dmidecode system information. > If this value could not be fetch, returns empty string. > """ > # if guest was created manualy it can have empty UUID, in this > # case dmidecode set attribute unavailable to 1 > uuid = get_dmi_data("/dmidecode/SystemInfo/SystemUUID[not(@unavailable='1')]") > if not uuid: > uuid = '' > return uuid > >def dmi_vendor(): > """ Return Vendor from dmidecode bios information. > If this value could not be fetch, returns empty string. > """ > return get_dmi_data('/dmidecode/BIOSinfo/Vendor') > >print('UUID: %s' % dmi_system_uuid()) >print('Vendor: %s' % dmi_vendor()) >print('Serial: %s' % get_dmi_data('/dmidecode/SystemInfo/SerialNumber')) >print('Manufactorer: %s' % get_dmi_data('/dmidecode/SystemInfo/Manufacturer'))
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 1624372
: 1482117