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 981261 - It should report an error while add an invalid pci controller to the guest
Summary: It should report an error while add an invalid pci controller to the guest
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt
Version: 7.0
Hardware: x86_64
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: Ján Tomko
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-07-04 10:30 UTC by zhenfeng wang
Modified: 2014-06-18 00:52 UTC (History)
10 users (show)

Fixed In Version: libvirt-1.1.1-1.el7
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-06-13 12:17:11 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description zhenfeng wang 2013-07-04 10:30:21 UTC
Description of problem:
It should report an error while add an invalid pci controller to the guest

Version-Release number of selected component (if applicable):
libvirt-1.1-0.el7.x86_64
qemu-kvm-1.5.1-2.el7.x86_64
kernel-3.10.0-0.rc7.64.el7.x86_64
How reproducible:
100%

Steps
1.Prepare a normal guest
virsh list
 Id    Name                           State
----------------------------------------------------
 -     rhel72                     shutoff

2.Edit the guest's xml and add the following content to the guest
--
 <controller type='pci' index='-1' model='pci-bridge'/>
--
# virsh dumpxml rhel72|grep pci-bridge
    <controller type='pci' index='-1' model='pci-bridge'>

3.Start the guest,the guest will fail to start
# virsh start rhel72
error: Failed to start domain rhel72
error: Unable to read from monitor: Connection reset by peer
check the qemu's log
LC_ALL=C PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin QEMU_AUDIO_DRV=spice /usr/libexec/qemu-kvm -name rhel72 -S -machine pc-i440fx-rhel7.0.0,accel=kvm,usb=off -m 4001 -realtime mlock=off -smp 2,sockets=2,cores=1,threads=1 -uuid 403f2468-65cb-6be8-3735-4f654d3d5e4c -no-user-config -nodefaults -chardev socket,id=charmonitor,path=/var/lib/libvirt/qemu/rhel72.monitor,server,nowait -mon chardev=charmonitor,id=monitor,mode=control -rtc base=utc -no-shutdown -global PIIX4_PM.disable_s3=0 -global PIIX4_PM.disable_s4=0 -device pci-bridge,chassis_nr=-1,id=pci.-1,bus=pci.0,addr=0x9 -device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 -device piix3-usb-uhci,id=usb1,bus=pci.0,addr=0x7 -device virtio-serial-pci,id=virtio-serial0,bus=pci.0,addr=0x5 -drive file=/mnt/zhwang/rhel7raw.img,if=none,id=drive-virtio-disk0,format=raw,cache=none -device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x8,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 -netdev tap,fd=23,id=hostnet0 -device rtl8139,netdev=hostnet0,id=net0,mac=52:54:004a:03,bus=pci.0,addr=0x3 -chardev pty,id=charserial0 -device isa-serial,chardev=charserial0,id=serial0 -chardev socket,id=charchannel0,path=/var/lib/libvirt/qemu/rhel72.agent,server,nowait -device virtserialport,bus=virtio-serial0.0,nr=1,chardev=charchannel0,id=channel0,name=org.qemu.guest_agent.0 -chardev spicevmc,id=charchannel1,name=vdagent -device virtserialport,bus=virtio-serial0.0,nr=2,chardev=charchannel1,id=channel1,name=com.redhat.spice.0 -spice port=5900,addr=0.0.0.0,disable-ticketing,seamless-migration=on -k en-us -device qxl-vga,id=video0,ram_size=67108864,vram_size=67108864,bus=pci.0,addr=0x2 -device intel-hda,id=sound0,bus=pci.0,addr=0x4 -device hda-duplex,id=sound0-codec0,bus=sound0.0,cad=0 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x6
char device redirected to /dev/pts/1 (label charserial0)
qemu-kvm: -device pci-bridge,chassis_nr=-1,id=pci.-1,bus=pci.0,addr=0x9: Parameter 'chassis_nr' expects uint8_t
2013-07-04 06:57:45.873+0000: shutting down

4.Delete the upper invalid controller, then, edit the guest's xml add the following content to the guest
<controller type='pci' index='-1' model='pci-root'/>
<controller type='pci' index='-1' model='pci-root'/>
<controller type='pci' index='-1' model='pci-root'/>

# virsh dumpxml rhel72 |grep pci-root
    <controller type='pci' index='-1' model='pci-root'/>
    <controller type='pci' index='-1' model='pci-root'/>
    <controller type='pci' index='-1' model='pci-root'/>
    <controller type='pci' index='0' model='pci-root'/>            --this was valid one

5.Start the guest,the invalid pci controller didn't effect the guest start,and we can still see them while guest start completely.
# virsh start rhel72
Domain rhel72 started

# virsh dumpxml rhel72 |grep pci-root
    <controller type='pci' index='-1' model='pci-root'>
    <controller type='pci' index='-1' model='pci-root'>
    <controller type='pci' index='-1' model='pci-root'>
    <controller type='pci' index='0' model='pci-root'>

Actual results:
libvirt didn't check the the invalid pci controllers

Expected results:
It should report an error while add an invalid pci controller to the guest

Comment 2 Ján Tomko 2013-07-12 13:16:43 UTC
Negative controller indexes are fixed upstream now:
commit 945b18eb7d449217de1a3ce349d31eb43c39cf3e
Author:     Jincheng Miao <jmiao>
AuthorDate: 2013-07-12 14:17:23 +0200
Commit:     Ján Tomko <jtomko>
CommitDate: 2013-07-12 14:55:04 +0200

    Change domain controller index type to unsigned
    
    Error out on negative index values.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=981261

git describe: v1.1.0-174-g945b18e 

I've posted a patch rejecting pci-root controllers with non-zero indexes upstream:
https://www.redhat.com/archives/libvir-list/2013-July/msg00810.html

Comment 3 Ján Tomko 2013-07-15 08:02:21 UTC
The second patch is now pushed upstream as well:
commit 47a01895fbd5e9ec03b88b6f995850dd247d711a
Author:     Ján Tomko <jtomko>
AuthorDate: 2013-07-12 15:05:51 +0200
Commit:     Ján Tomko <jtomko>
CommitDate: 2013-07-12 15:05:51 +0200

    conf: reject pci-root controllers with non-zero indexes
    
    https://bugzilla.redhat.com/show_bug.cgi?id=981261

git describe: v1.1.0-175-g47a0189

Comment 4 EricLee 2013-07-31 09:00:59 UTC
Verifying this bug in libvirt-1.1.1-1.el7:

Steps:
Add 
 <controller type='pci' index='-1' model='pci-bridge'/>
to guest xml:

# virsh edit rhel7
error: internal error: Cannot parse controller index -1
Failed. Try again? [y,n,f,?]:
error: internal error: Cannot parse controller index -1
Failed. Try again? [y,n,f,?]:
error: internal error: Cannot parse controller index -1
Failed. Try again? [y,n,f,?]:

Error out on negative index values.

Add 
 <controller type='pci' index='-2' model='pci-root'/>
to guest xml:

# virsh edit rhel7
error: internal error: Cannot parse controller index -2
Failed. Try again? [y,n,f,?]:

Error also out on negative index values.

Working as expected.

So setting VERIFIED.

Comment 5 Ludek Smid 2014-06-13 12:17:11 UTC
This request was resolved in Red Hat Enterprise Linux 7.0.

Contact your manager or support representative in case you have further questions about the request.


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