Bug 890606

Summary: duplicate virtio-serial addresses are not rejected
Product: Red Hat Enterprise Linux 7 Reporter: zhenfeng wang <zhwang>
Component: libvirtAssignee: Ján Tomko <jtomko>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: low Docs Contact:
Priority: low    
Version: 7.0CC: ajia, cwei, dyuan, gsun, jtomko, mzhan, rbalakri
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: libvirt-1.2.15-1.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-11-19 05:36:41 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 zhenfeng wang 2012-12-28 05:37:24 UTC
Description of problem:
Better to report an error if there are two same virtio-serial address in the guest's xml
Version-Release number of selected component (if applicable):
kernel-2.6.32-348.el6.x86_64
libvirt-0.10.2-12.el6.x86_64
qemu-kvm-0.12.1.2-2.346.el6.x86_64

How reproducible:
100%
1 prepare a guest add the following to the guest xml
# virsh list --all
rhelnew                        shut off

# virsh edit rhelnew
---
---
  <channel type='unix'>
      <source mode='bind' path='/var/lib/libvirt/qemu/rhelnew.agent'/>
      <target type='virtio' name='org.qemu.guest_agent.0'/>
      <address type='virtio-serial' controller='0' bus='0' port='1'/>
    </channel>
    <channel type='spicevmc'>
      <target type='virtio' name='com.redhat.spice.0'/>
      <address type='virtio-serial' controller='0' bus='0' port='1'/>
    </channel>
----
-----
then save the xml
2 start the guest will report error
# virsh start rhelnew
error: Failed to start domain rhelnew
error: Unable to read from monitor: Connection reset by peer

# virsh start rhelnew
error: Failed to start domain rhelnew
error: internal error process exited while connecting to monitor: 2012-12-27 03:24:14.029+0000: 27788: debug : virFileClose:72 : Closed fd 31
2012-12-27 03:24:14.029+0000: 27788: debug : virFileClose:72 : Closed fd 39
2012-12-27 03:24:14.031+0000: 27788: debug : virFileClose:72 : Closed fd 3
char device redirected to /dev/pts/6
qemu-kvm: -device virtserialport,bus=virtio-serial0.0,nr=1,chardev=charchannel1,id=channel1,name=com.redhat.spice.0: virtio-serial-bus: A port already exists at id 1
qemu-kvm: -device virtserialport,bus=virtio-serial0.0,nr=1,chardev=charchannel1,id=channel1,name=com.redhat.spice.0: Device 'virtserialport' could not be initialized



Actual results:
it didn't report error while there were two same virtio-serial address exsitting in the guest xml

Expected results:
Better to report an error if there are two same virtio-serial address in the guest's xml ,just like the pci address
# virsh edit rhelnew
---
    <video>
      <model type='qxl' vram='65536' heads='1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
    </video>
    <memballoon model='virtio'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
----
then save will report error
# virsh edit rhelnew
error: XML error: Attempted double use of PCI Address '0:0:2.0'
Failed. Try again? [y,n,f,?]:

Comment 2 RHEL Program Management 2012-12-31 06:47:15 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 6 Jiri Denemark 2014-04-04 21:37:21 UTC
This bug was not selected to be addressed in Red Hat Enterprise Linux 6. We will look at it again within the Red Hat Enterprise Linux 7 product.

Comment 8 Ján Tomko 2015-03-02 14:49:01 UTC
*** Bug 1177584 has been marked as a duplicate of this bug. ***

Comment 9 Ján Tomko 2015-03-03 14:47:19 UTC
Upstream patches:
https://www.redhat.com/archives/libvir-list/2015-March/msg00071.html

Comment 11 Ján Tomko 2015-03-17 11:42:39 UTC
Another version of the patches:
https://www.redhat.com/archives/libvir-list/2015-March/msg00821.html

Comment 13 Ján Tomko 2015-04-02 13:06:42 UTC
Fixed upstream by:
commit 5903378834bafb031407ab02ce37dcc9ec782d1f
Author:     Ján Tomko <jtomko>
CommitDate: 2015-04-02 15:00:13 +0200

    Allocate virtio-serial addresses when starting a domain   

git describe: v1.2.14-30-g5903378

Comment 15 Hu Jianwei 2015-05-07 01:46:39 UTC
Verified as below:

[root@localhost ~]# rpm -q libvirt
libvirt-1.2.15-1.el7.x86_64

Prepare a block of xml as below 
    <channel type='spicevmc'>
      <target type='virtio' name='com.redhat.spice.0'/>
      <address type='virtio-serial' controller='0' bus='0' port='1'/>
    </channel>
    <channel type='pty'>
      <target type='virtio' name='org.linux-kvm.port.0'/>
      <address type='virtio-serial' controller='0' bus='0' port='1'/>
    </channel>

Then save the xml with the configuration.
[root@localhost ~]# virsh edit r71
error: XML error: virtio serial port 1 on controller 0 is already occupied
Failed. Try again? [y,n,i,f,?]: 

We can get expected results, move to verified.

Comment 17 errata-xmlrpc 2015-11-19 05:36:41 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://rhn.redhat.com/errata/RHBA-2015-2202.html