Hello Yaniv Bronhaim, I'd like you to do a code review. Please visit
http://gerrit.ovirt.org/28541 to review the following change. Change subject: dmidecode: Handle missing values. ...................................................................... dmidecode: Handle missing values. Make all hwInfo fields in API optional, and change property retrieval so it cannot fail, also, get rid of all keys that contain no actual information. The engine will assume that all the missing keys are not available and report/display an according message (rather than sending 'Not Specified') Change-Id: I979518e1d0c0c882fe98fd5aee43c0d50ab17e14 Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1089393 Signed-off-by: Yaniv Bronhaim <ybron...@redhat.com> Signed-off-by: Dima Kuznetsov <dkuzn...@redhat.com> --- M vdsm/dmidecodeUtil.py M vdsm_api/vdsmapi-schema.json 2 files changed, 13 insertions(+), 11 deletions(-) git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/41/28541/1 diff --git a/vdsm/dmidecodeUtil.py b/vdsm/dmidecodeUtil.py index eb8d834..7b74fa0 100644 --- a/vdsm/dmidecodeUtil.py +++ b/vdsm/dmidecodeUtil.py @@ -54,7 +54,9 @@ ('system', 'Serial Number'), ('system', 'UUID'), ('system', 'Family')): - sysStruct[(k1 + k2).replace(' ', '')] = dmiInfo[k1][k2] + val = dmiInfo.get(k1, {}).get(k2, None) + if val not in [None, 'Not Specified']: + sysStruct[(k1 + k2).replace(' ', '')] = val return sysStruct diff --git a/vdsm_api/vdsmapi-schema.json b/vdsm_api/vdsmapi-schema.json index 3140378..fea8206 100644 --- a/vdsm_api/vdsmapi-schema.json +++ b/vdsm_api/vdsmapi-schema.json @@ -766,25 +766,25 @@ # # Host hardware fields. # -# @systemManufacturer: Host manufacturer's name +# @systemManufacturer: #optional Host manufacturer's name # -# @systemProductName: Host's hardware module +# @systemProductName: #optional Host's hardware module # -# @systemSerialNumber: Hardware serial number +# @systemSerialNumber: #optional Hardware serial number # -# @systemFamily: Processor type +# @systemFamily: #optional Processor type # -# @systemUUID: Host's hardware UUID +# @systemUUID: #optional Host's hardware UUID # -# @systemVersion: Host's hardware version +# @systemVersion: #optional Host's hardware version # # Since: 4.10.3 ## {'type': 'HardwareInformation', - 'data': {'systemManufacturer': 'str', - 'systemProductName': 'str', 'systemVersion': 'str', - 'systemSerialNumber': 'str', 'systemUUID': 'str', - 'systemFamily': 'str'}} + 'data': {'*systemManufacturer': 'str', + '*systemProductName': 'str', '*systemVersion': 'str', + '*systemSerialNumber': 'str', '*systemUUID': 'str', + '*systemFamily': 'str'}} ## # @SoftwarePackage: -- To view, visit http://gerrit.ovirt.org/28541 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I979518e1d0c0c882fe98fd5aee43c0d50ab17e14 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: ovirt-3.4 Gerrit-Owner: Dima Kuznetsov <dkuzn...@redhat.com> Gerrit-Reviewer: Yaniv Bronhaim <ybron...@redhat.com> _______________________________________________ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches