Bug 1570549

Summary: AttributeError: 'SYSInfo' object has no attribute 'parse'
Product: Red Hat Enterprise Linux 7 Reporter: Xiaodai Wang <xiaodwan>
Component: virt-managerAssignee: Pavel Hrdina <phrdina>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: low Docs Contact:
Priority: low    
Version: 7.5CC: crobinso, juzhou, mxie, mzhan, phrdina, tzheng
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: virt-manager-1.5.0-2.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-08-06 13:08:01 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:
Attachments:
Description Flags
virt-manager debug log none

Description Xiaodai Wang 2018-04-23 08:17:21 UTC
Description of problem:
AttributeError: 'SYSInfo' object has no attribute 'parse'

Version-Release number of selected component (if applicable):
virt-manager-1.4.3-3.el7.noarch

How reproducible:
100%

Steps to Reproduce:
1. set smbios_mode to a value which is neighter 'host' nor 'emulate'.
# virt-install --name testvm --memory 1024 --boot initargs="none",smbios_mode=sysinfo --debug --disk none

Actual results:
Traceback (most recent call last):
  File "/usr/share/virt-manager/virtinst/cli.py", line 1204, in parse
    objs = self._parse(inst or self.guest)
  File "/usr/share/virt-manager/virtinst/cli.py", line 1631, in _parse
    VirtCLIParser._parse(self, inst)
  File "/usr/share/virt-manager/virtinst/cli.py", line 1172, in _parse
    param.parse_param(self, inst, self.support_cb)
  File "/usr/share/virt-manager/virtinst/cli.py", line 928, in parse_param
    self.val, self)
  File "/usr/share/virt-manager/virtinst/cli.py", line 1602, in set_smbios_mode_cb
    inst.sysinfo.parse(val)
AttributeError: 'SYSInfo' object has no attribute 'parse'

Expected results:
The guest should be installed successfully.

Additional info:

Comment 1 Xiaodai Wang 2018-04-23 08:20:10 UTC
Created attachment 1425574 [details]
virt-manager debug log

Comment 2 Cole Robinson 2018-04-24 16:33:15 UTC
Not sure how this was expected to ever work. I fixed it upstream:

commit a33ac920405c5d315e18c8dda65076bde1da92ae (HEAD -> master, origin/master, origin/HEAD)
Author: Cole Robinson <crobinso>
Date:   Tue Apr 24 12:26:08 2018 -0400

    cli: Fix --boot smbios_mode=sysinfo (bz 1570549)
    
    Not sure how this was expected to work, just make it do the simple
    thing and set the value in the XML. Add a test case for it

Comment 6 zhoujunqin 2019-05-06 07:31:19 UTC
I can reproduce this bug with package:

virt-manager-1.5.0-1.el7.noarch
virt-install-1.5.0-1.el7.noarch
virt-manager-common-1.5.0-1.el7.noarch

Steps to Reproduce:
1. set smbios_mode to a value which is neighter 'host' nor 'emulate'.
# virt-install --name testvm --memory 1024 --boot initargs="none",smbios_mode=sysinfo --disk none
ERROR    Error: --boot initargs=none,smbios_mode=sysinfo: 'SYSInfo' object has no attribute 'parse'
Even though, i set a value for "--sysinfo"
# virt-install --name testvm --memory 1024 --boot initargs="none",smbios_mode=sysinfo --sysinfo smbios --disk none
ERROR    Error: --boot initargs=none,smbios_mode=sysinfo: 'SYSInfo' object has no attribute 'parse'

Then try to verify this bug with new build:
virt-manager-1.5.0-3.el7.noarch
virt-install-1.5.0-3.el7.noarch
virt-manager-common-1.5.0-3.el7.noarch
libvirt-4.5.0-16.el7.x86_64
qemu-kvm-rhev-2.12.0-27.el7.x86_64

Steps:
Set smbios_mode to a value which is neighter 'host' nor 'emulate'.

Scenario-1 Without sysinfo value setting
# virt-install --name testvm --memory 1024 --boot initargs="none",smbios_mode=sysinfo  --disk none
WARNING  No operating system detected, VM performance may suffer. Specify an OS with --os-variant for optimal results.

Starting install...
ERROR    XML error: Domain 'testvm' sysinfo are not available
Domain installation does not appear to have been successful.
If it was, you can restart your domain by running:
  virsh --connect qemu:///system start testvm
otherwise, please restart your installation.

Result: "ERROR    XML error: Domain 'testvm' sysinfo are not available" is clear to user.

Scenario-2 With sysinfo value setting
# virt-install --name testvm --memory 1024 --boot initargs="none",smbios_mode=sysinfo  --sysinfo smbios --disk none --location http://download.eng.pek2.redhat.com/pub/rhel/released/RHEL-7/7.6/Server/x86_64/os/

Result:
2.1 The guest can be installed successfully.
2.2 XML is generated successfully.
  <sysinfo type='smbios'/>
  <os>
    <type arch='x86_64' machine='pc-i440fx-rhel7.6.0'>hvm</type>
    <kernel>/var/lib/libvirt/boot/virtinst-vmlinuz._Nbyv7</kernel>
    <initrd>/var/lib/libvirt/boot/virtinst-initrd.img.DTNrid</initrd>
    <cmdline>inst.repo=http://download.eng.pek2.redhat.com/pub/rhel/released/RHEL-7/7.6/Server/x86_64/os/</cmdline>
    <boot dev='hd'/>
    <smbios mode='sysinfo'/>
  </os>

@Pavel, please help me have a look of my verification steps, is it enough to verify this bug, thanks.

And I always have a question want to confirm with you, I can set invalid options for --sysinfo in Scenario-2.

# virt-install --sysinfo=?
--sysinfo options:
  baseBoard_asset
  baseBoard_location
  baseBoard_manufacturer
  baseBoard_product
  baseBoard_serial
  baseBoard_version
  bios_date
  bios_release
  bios_vendor
  bios_version
  clearxml
  system_family
  system_manufacturer
  system_product
  system_serial
  system_sku
  system_uuid
  system_version
  type
Here I use "--sysinfo 123", but the installation process stats successfully. Do you think it's a bug or not, thanks.
#  virt-install --name testvm --memory 1024 --boot initargs="none",smbios_mode=sysinfo  --sysinfo 123  --disk none

Comment 7 Pavel Hrdina 2019-05-06 12:08:40 UTC
Hi Junqin,

yes that is good enough to verify this bug.  In virt-manager/virt-install we don't
check every single value whether it makes sense, we leave it to libvirt as it would
be just duplicated work and it would get outdated if libvirt would change any check.

Comment 8 zhoujunqin 2019-05-07 09:29:48 UTC
(In reply to Pavel Hrdina from comment #7)
> Hi Junqin,
> 
> yes that is good enough to verify this bug.  In virt-manager/virt-install we
> don't
> check every single value whether it makes sense, we leave it to libvirt as
> it would
> be just duplicated work and it would get outdated if libvirt would change
> any check.

Hi Pavel,

Got it, thanks for your quick reply.
As you said, I try to edit a vm with following xml content.
# virsh edit rhel7.6
  <sysinfo type='aaa'/>
  <os>
    <type arch='x86_64' machine='pc-i440fx-rhel7.0.0'>hvm</type>
    <boot dev='hd'/>
    <smbios mode='sysinfo'/>
  </os>

then failed to save with error information:
error: XML document failed to validate against schema: Unable to validate doc against /usr/share/libvirt/schemas/domain.rng
Extra element sysinfo in interleave
Element domain failed to validate content

Failed. Try again? [y,n,i,f,?]: 

Result: Yes, libvirt will check it.

So I move this bug from ON_QA to VERIFIED based on above testing result, thanks.

Comment 10 errata-xmlrpc 2019-08-06 13:08:01 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2019:2232