RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 675030 - misleading error message from libvirt on bad xml
Summary: misleading error message from libvirt on bad xml
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: libvirt
Version: 6.1
Hardware: Unspecified
OS: Unspecified
low
low
Target Milestone: rc
: ---
Assignee: Eric Blake
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-02-03 23:34 UTC by Eric Blake
Modified: 2011-05-19 13:26 UTC (History)
10 users (show)

Fixed In Version: libvirt-0.8.7-5.el6
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-05-19 13:26:42 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2011:0596 0 normal SHIPPED_LIVE libvirt bug fix and enhancement update 2011-05-18 17:56:36 UTC

Description Eric Blake 2011-02-03 23:34:12 UTC
Description of problem:
upstream commit cdbba1c4960a22b5f8c034dd9257bec2d5fa38d6
Author: Hu Tao <hutao.com>
Date:   Thu Jan 27 15:21:42 2011 +0800

    qemu: Report more accurate error on failure to attach device.

    When attaching device from a xml file and the device is mis-configured,
    virsh gives mis-leading message "out of memory". This patch fixes this.

    Signed-off-by: Eric Blake <eblake>


Version-Release number of selected component (if applicable):
libvirt-0.8.7-4.el6

How reproducible:
100%

Steps to Reproduce:
1. Not quite sure how Hu reproduced it, but probably by creating xml with a <controller> type set to 'ide'
  
Actual results:
out of memory error when the code path detects the bad controller type

Expected results:
proper message about the unknown type

Additional info:

Comment 4 Cui Chun 2011-02-15 07:33:52 UTC
Hi Eric,

I tried to verify this bug in libvirt-0.8.7-6.el6. 
But I am not sure if your updated code was covered. Please check the following steps.

Steps:

1.Start a guest
# virsh start rhel6

2.Create a device with 'ide' controller and attach it to guest
# cat c1.xml 
<controller type='ide' index='0'>
      <alias name='ide0'/>
    </controller>

# virsh attach-device rhel6 c1.xml 
error: Failed to attach device from c1.xml
error: unsupported configuration: disk controller bus 'ide' cannot be hotplugged.

3.Recreate a device with the invaild controller and attach it to guest
# cat c2.xml 
<controller type='fdsfside' index='0'>
      <alias name='ide0'/>
    </controller>

# virsh attach-device rhel6 c1.xml 
error: Failed to attach device from c2.xml
error: internal error Unknown controller type 'fdsfside'


** In step3, ("Unknown controller type: %s") error message can be shown.

Unfortunately, the same error message (in step3) also can be shown in libvirt-0.8.7-4.el6. 

 
Would you please give some suggestions on this bugs?


Thanks,
Chun Cui

Comment 5 Eric Blake 2011-02-15 16:36:59 UTC
(In reply to comment #4)
> I tried to verify this bug in libvirt-0.8.7-6.el6. 
> But I am not sure if your updated code was covered. Please check the following
> steps.

I've asked the original reporter, Hu Tao, for how he tested his upstream patch.

Meanwhile, note that:

> 3.Recreate a device with the invaild controller and attach it to guest
> # cat c2.xml 
> <controller type='fdsfside' index='0'>
>       <alias name='ide0'/>
>     </controller>
> 
> # virsh attach-device rhel6 c1.xml 
> error: Failed to attach device from c2.xml
> error: internal error Unknown controller type 'fdsfside'

There are two different error messages:

src/conf/domain_conf.c:                                 _("Unknown controller type '%s'"), type);
src/qemu/qemu_command.c:                        _("Unknown controller type: %s"),

You hit the pre-existing one in domain_conf.c (no colon), not the new message in qemu_command.c (with a colon), so this test did not tickle the changed code path.  So I think it has to be a known existing controller type to get past the parsing in domain_conf.c, which leaves 'ide', 'fdc', 'scsi', 'sata', 'virtio-serial', and 'ccid'.  Then, in qemu_command.c, the new message can only be triggered if you hit the 'ide' or default: case label; your testing showed that 'ide' got filtered early, and the switch statement covers 'scsi', 'virtio-serial', and 'ccid', but that leaves 'fdc' and 'sata'.  So maybe trying your step 2, but with 'sata' or 'fdc' instead of 'ide', will trigger things?

Comment 6 Hu Tao 2011-02-16 02:49:15 UTC
Have a try with this xml:

<controller type='scsi' index='1'>
  <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x1'/>
</controller>

where slot 0x09 is an unused slot, you can specify any unused slot.

With commit cdbba1c4960a2 the error message is:
error: internal error Only PCI device addresses with function=0 are supported

Without commit cdbba1c4960a2 the error message is:
error: out of memory

Comment 7 Cui Chun 2011-02-17 03:29:02 UTC
Tried the xml mentioned in comment6. The error message is same with first error (commit cdbba1c4960a2 the error message)

Test environment:
libvirt-0.8.7-6.el6
qemu-kvm-0.12.1.2-2.144.el6
kernel-2.6.32-113.el6

cat c3.xml 
<controller type='scsi' index='1'>
  <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x1'/>
</controller>


# virsh attach-device rhel6 c3.xml 
error: Failed to attach device from c3.xml
error: internal error Only PCI device addresses with function=0 are supported

Comment 8 Hu Tao 2011-02-17 03:48:28 UTC
That error message should be fine.

Have you tried the xml with commit cdbba1c4960a2 reverted? If you do not use git, you can manually edit c source file to remove changes introduced by commit cdbba1c4960a2 then rebuild libvirt-0.8.7-6.el6 then repeat steps in comment 7. If you get 'error: out of memory', then commit cdbba1c4960a2 is in effect. Because we're not actually out of memory, but don't support PCI device addresses with function=1.

Comment 9 Cui Chun 2011-02-17 05:08:40 UTC
(In reply to comment #8)
> That error message should be fine.
> 
> Have you tried the xml with commit cdbba1c4960a2 reverted? If you do not use
> git, you can manually edit c source file to remove changes introduced by commit
> cdbba1c4960a2 then rebuild libvirt-0.8.7-6.el6 then repeat steps in comment 7.
> If you get 'error: out of memory', then commit cdbba1c4960a2 is in effect.
> Because we're not actually out of memory, but don't support PCI device
> addresses with function=1.

Yes, I have checked on libvirt-0.8.7-4.el6.x86_64 without commit cdbba1c4960a2 and get "error: out of memory".

-------
# virsh attach-device rhel6 c3.xml 
error: Failed to attach device from c3.xml
error: out of memory
------

So this bug is fixed. Can I change it's status?

Comment 10 Hu Tao 2011-02-17 05:54:57 UTC
Fine. Thanks for your verification.

Comment 11 Cui Chun 2011-02-17 06:00:25 UTC
Thanks for Hu Tao's great help.

Changed it to verified status.

Comment 12 zhanghaiyan 2011-04-20 12:16:17 UTC
Adding the following xml to a shutoff guest xml, then start the guest will causes 'out of memory' error. For this issue, I report a separate bug 698197 
<controller type='scsi' index='1'>
  <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x1'/>
</controller>

Comment 15 errata-xmlrpc 2011-05-19 13:26:42 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2011-0596.html


Note You need to log in before you can comment on or make changes to this bug.