Yaniv Bronhaim has uploaded a new change for review. Change subject: Adding system information to getCapabilities ......................................................................
Adding system information to getCapabilities Using dmidecode to get system info and return it by getCaps api Change-Id: Ic429ef101fcf9047c4b552405314dc7ba9ba07a0 Bug-Id: https://bugzilla.redhat.com/show_bug.cgi?id=867543 Signed-off-by: Yaniv Bronhaim <[email protected]> --- M Makefile.am M vdsm.spec.in M vdsm/Makefile.am M vdsm/caps.py A vdsm/dmidecode_util.py M vdsm/supervdsmServer.py 6 files changed, 61 insertions(+), 0 deletions(-) git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/58/9258/1 diff --git a/Makefile.am b/Makefile.am index e15d709..da86c25 100644 --- a/Makefile.am +++ b/Makefile.am @@ -61,6 +61,7 @@ vdsm/constants.py.in \ vdsm/debugPluginClient.py \ vdsm/define.py \ + vdsm/dmidecode_util.py \ vdsm/exception.py \ vdsm/gluster \ vdsm/guestIF.py \ diff --git a/vdsm.spec.in b/vdsm.spec.in index 20ad1dc..57a61cd 100644 --- a/vdsm.spec.in +++ b/vdsm.spec.in @@ -623,6 +623,7 @@ %{_datadir}/%{vdsm_name}/blkid.py* %{_datadir}/%{vdsm_name}/caps.py* %{_datadir}/%{vdsm_name}/clientIF.py* +%{_datadir}/%{vdsm_name}/dmidecode_util.py* %{_datadir}/%{vdsm_name}/API.py* %{_datadir}/%{vdsm_name}/hooking.py* %{_datadir}/%{vdsm_name}/hooks.py* diff --git a/vdsm/Makefile.am b/vdsm/Makefile.am index 76a81c6..a7601f1 100644 --- a/vdsm/Makefile.am +++ b/vdsm/Makefile.am @@ -31,6 +31,7 @@ clientIF.py \ configNetwork.py \ debugPluginClient.py \ + dmidecode_util.py \ guestIF.py \ hooking.py \ hooks.py \ diff --git a/vdsm/caps.py b/vdsm/caps.py index cfe4caf..8e5b558 100644 --- a/vdsm/caps.py +++ b/vdsm/caps.py @@ -29,6 +29,7 @@ import itertools import linecache import glob +import supervdsm import libvirt import rpm @@ -254,6 +255,9 @@ cpuInfo = CpuInfo() cpuTopology = CpuTopology() + + caps['SystemInfo'] = supervdsm.getProxy().getSystemInfo() + if config.getboolean('vars', 'report_host_threads_as_cores'): caps['cpuCores'] = str(cpuTopology.threads()) else: diff --git a/vdsm/dmidecode_util.py b/vdsm/dmidecode_util.py new file mode 100644 index 0000000..f009116 --- /dev/null +++ b/vdsm/dmidecode_util.py @@ -0,0 +1,49 @@ +# +# Copyright 2012 Red Hat, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +# +# Refer to the README and COPYING files for full details of the license +# + +import dmidecode + + +def getSystemInfo(): + systemInfo = dmidecode.system() + data = None + for info in systemInfo: + try: + if systemInfo[info]['data']['Version'] is not None: + data = systemInfo[info]['data'] + break + except: + continue + + if data is None: + raise OSError("could not get system information") + + try: + retData = {} + retData['Manufacturer'] = data['Manufacturer'] + retData['Product Name'] = data['Product Name'] + retData['Version'] = data['Version'] + retData['Serial Number'] = data['Serial Number'] + retData['UUID'] = data['UUID'] + retData['Family'] = data['Family'] + except: + raise OSError("full system information is missing") + + return retData diff --git a/vdsm/supervdsmServer.py b/vdsm/supervdsmServer.py index 34fefdb..47d9eb0 100755 --- a/vdsm/supervdsmServer.py +++ b/vdsm/supervdsmServer.py @@ -38,6 +38,7 @@ _glusterEnabled = False from parted_utils import getDevicePartedInfo as _getDevicePartedInfo from md_utils import getMdDeviceUuidMap as _getMdDeviceUuidMap +from dmidecode_util import getSystemInfo as _getSystemInfo from lsblk import getLsBlk as _getLsBlk from storage.multipath import getScsiSerial as _getScsiSerial from storage.iscsi import forceIScsiScan as _forceIScsiScan @@ -106,6 +107,10 @@ return _getLsBlk(*args, **kwargs) @logDecorator + def getSystemInfo(self): + return _getSystemInfo() + + @logDecorator def readMultipathConf(self): with open(MPATH_CONF) as f: return [x.strip("\n") for x in f.readlines()] -- To view, visit http://gerrit.ovirt.org/9258 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ic429ef101fcf9047c4b552405314dc7ba9ba07a0 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Yaniv Bronhaim <[email protected]> _______________________________________________ vdsm-patches mailing list [email protected] https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
