Bug 890494

Summary: Some issues about verifying SMBIOS values in domain xml and doc
Product: Red Hat Enterprise Linux 6 Reporter: hongming <honzhang>
Component: libvirtAssignee: John Ferlan <jferlan>
Status: CLOSED WONTFIX QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.4CC: acathrow, cwei, dyuan, gsun, lsu, mzhan
Target Milestone: rcKeywords: Upstream
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-04-04 20:59:15 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description hongming 2012-12-27 09:59:00 UTC
Description of problem:
There are some issues in verifying  SMBIOS values in domain xml .

a) libvirt should verify if the value of "date" and "release" entry is date format.for example "04/03/2009"
 
b) libvirt should verify if the "uuid" entry is absolutely identical with a top-level "uuid" element

c) libvirt should verify if the entry name in xml is correct and not only delete the wrong entry . and there is one doc typo in  formatdomain.html .


Version-Release number of selected component (if applicable):
libvirt-0.10.2-13.el6.x86_64
qemu-kvm-rhev-0.12.1.2-2.344.el6.x86_64 

How reproducible:
100% 

Steps to Reproduce:

a) libvirt should verify if the value of "date" and "release" entry is date format.for example Release Date: 04/03/2009.

# virsh dumpxml rhel6
<domain type='kvm' id='29'>
 ......
  <sysinfo type='smbios'>
    <bios>
      <entry name='date'>LENOVO</entry>
      <entry name='release'>LENOVO</entry>
    </bios>
 ......
</domain>


Login in guest

# dmidecode
 
SMBIOS 2.5 present.
64 structures occupying 3149 bytes.
Table at 0x000EF3C0.

Handle 0x0000, DMI type 0, 24 bytes
BIOS Information
    Vendor: LENOVO
    Version: 5CKT67EUS
    Release Date: LENOVO
    Address: 0xE0830
    Runtime Size: 128976 bytes
    ROM Size: 4096 kB
    Characteristics:


Expect result :
libvirt should verfiy if  the format of  "date" and "release" entry value is date format.for example  04/03/2009

================================================================================

b) libvirt should verify if the "uuid" entry is absolutely identical with a top-level "uuid" element

Edit the uuid value as below and save xml.

<domain type='kvm'>
  <name>rhel6</name>
  <uuid>1db7cfab-267e-e959-becf-ba85453c72e3</uuid>
  ......
    <system>
      <entry name='uuid'>1db7cfab-267e-e959-becf-ba8545-3c72e3</entry>
    </system>
  </sysinfo>
  ......
</domain>

# virsh edit rhel6
Domain rhel6 XML configuration edited.

Expect result
error: internal error UUID mismatch between <uuid> and <sysinfo>
Failed. Try again? [y,n,f,?]:
================================================================================
c)  libvirt should verify if the entry name in xml is correct.When the entry name is wrong , there isn't any error occurs. it will be deleted from domain'xml

 Edit vendor entry in <system> as below.

<domain type='kvm'>
  ......
  <sysinfo type='smbios'>
    <bios>
      <entry name='vendor'>LENOVO</entry>
      <entry name='version'>3.3.45xd.df.1</entry>
    </bios>
    <system>
      <entry name='manufacturer'>Fedora</entry>
      <entry name='vendor'>IBM</entry>   <=== If the right entry name "product" is set as  "vendor" by mistake , it will be deleted.

      <entry name='version'>Fedora 17.0.z.1</entry>

    </system>
  </sysinfo>
  ......
</domain>

# virsh edit rhel6
Domain rhel6 XML configuration edited.


# virsh start rhel6
Domain rhel6 started

# virsh dumpxml rhel6
<domain type='kvm'>
......
  <sysinfo type='smbios'>
    <bios>
      <entry name='vendor'>LENOVO</entry>
      <entry name='version'>3.3.45xd.df.1</entry>
    </bios>
    <system>
      <entry name='manufacturer'>Fedora</entry>
      <entry name='version'>Fedora 17.0.z.1</entry>
    </system>
  </sysinfo>
......
</domain>

Expect result
libvirt should verify if the entry name in SMBIOS block in xml is right when save xml. libvirt should throws error and not only delete it from xml.


There is one doc typo in formatdomain.html .

 544   &lt;sysinfo type='smbios'&gt;
 545     &lt;bios&gt;
 546       &lt;entry name='vendor'&gt;LENOVO&lt;/entry&gt;
 547     &lt;/bios&gt;
 548     &lt;system&gt;
 549       &lt;entry name='manufacturer'&gt;Fedora&lt;/entry&gt;
 550       &lt;entry name='vendor'&gt;Virt-Manager&lt;/entry&gt; <== the entry name should be "product"
 551     &lt;/system&gt;
 552   &lt;/sysinfo&gt;



Actual result
as above

Expect result
as above

Additional info

Comment 2 RHEL Program Management 2012-12-31 06:47:31 UTC
This request was not resolved in time for the current release.
Red Hat invites you to ask your support representative to
propose this request, if still desired, for consideration in
the next release of Red Hat Enterprise Linux.

Comment 3 Luwen Su 2013-01-18 06:49:14 UTC
I test in libvirt -16 version.
For
a) same xml in guest , in guest it shows
        Handle 0x0000, DMI type 0, 24 bytes
        BIOS Information
	Vendor: Seabios
	Version: 0.5.1
	Release Date: 01/01/2007
	Address: 0xE8000
	Runtime Size: 96 kB
	ROM Size: 64 kB
	Characteristics:
		BIOS characteristics not supported
		Targeted content distribution is supported
	BIOS Revision: 1.0

b) it report an error 
   error: internal error UUID mismatch between <uuid> and <sysinfo>

c) just delete , no error report

Is there alreday a patch covering the bug ?

Comment 5 John Ferlan 2013-04-26 18:35:10 UTC
a. Validating the 'date' is possible; however, your assertion about 'release' being a date is incorrect. It is the System BIOS Major and Minor release. This is passed as a string to the underlying hypervisor driver.  Knowing what is and isn't valid is not something easily discernible by libvirt. Theoretically, it would be of a format <major>.<minor> if both are provided, but it's also possible to just provide the <major> value since the two values would be contiguous in a Type 0 block.

b. Mismatched uuid's were fixed by upstream commit '4117672ea' which appears in libvirt v0.8.7; however, that doesn't seem to be the original complaint.  The original complaint was that adding additional "-" to the uuid could have caused an error (an easily missed nuance of the complaint) depending on the placement of the "-".  If added within any byte pairing, then the change would be flagged as a "malformed uuid element"; however, if added between any byte pairing, then the change would be OK according to virUUIDParse() rules.

However, since guest startup was disallowed with the incorrectly placed "-", the code will be changed in order to make the proper checks.

c. This is not possible as the parsing code looks for specific strings and will only save those that it finds. The code does not look for invalid strings nor are the existing interfaces designed to loop through a list of "valid" entries and signal when an "invalid" entry is discovered.

I will be sending patches for 'a' and 'b' upstream shortly.

Comment 6 John Ferlan 2013-05-15 17:44:34 UTC
A change has been submitted/pushed upstream, see:

https://www.redhat.com/archives/libvir-list/2013-May/msg00940.html

Comment 10 RHEL Program Management 2014-04-04 20:59:15 UTC
Development Management has reviewed and declined this request.
You may appeal this decision by reopening this request.