Bug 1037468

Summary: Hot plug virtio serial port to an used chardev should be forbidded even after the second hotplug
Product: Red Hat Enterprise Linux 6 Reporter: lijin <lijin>
Component: qemu-kvmAssignee: Amit Shah <amit.shah>
Status: CLOSED WONTFIX QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.6CC: acathrow, bcao, bsarathy, ghammer, juzhang, lijin, mkenneth, qzhang, virt-maint
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-08-18 06:02:36 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:

Description lijin 2013-12-03 09:02:03 UTC
Description of problem:
hot plug virtio serial port to existing chardev already been used,qemu prompted warning "Property 'virtserialport.chardev' can't take value 'channel1', it's in use",but hotplug serialport with the same cmd again,the hotplug can success.
The new port can be seen in guest and qtree.

Version-Release number of selected component (if applicable):
    qemu-kvm-rhev-0.12.1.2-2.415.el6_5.3.x86_64
    kernel-2.6.32-433.el6.x86_64
    seabios-0.6.1.2-28.el6.x86_64
    virtio-win-prewhql-74

How reproducible:
100%

Steps to Reproduce:
1. Start guest w/ virtio-serial-pci and virtio-serial-port
CLI:/usr/libexec/qemu-kvm -m 4G -smp 4 -usb -device usb-tablet,id=tablet0 -drive file=/home/win7-64.qcow2,if=none,id=drive-virtio0-0-0,format=qcow2,werror=stop,rerror=stop,cache=none -device ide-drive,drive=drive-virtio0-0-0,id=virti0-0-0,bootindex=1 -netdev tap,id=hostnet0,vhost=on,script=/etc/qemu-ifup -device virtio-net-pci,netdev=hostnet0,id=net0,mac=00:12:10:94:a3:f8 -uuid 8677bf9b-3cf6-47a1-b3e9-94213b801c87 -monitor stdio -spice id=on,disable-ticketing,port=5911 -vga qxl -bios /usr/share/seabios/bios-pm.bin -device virtio-serial-pci,id=virtio-serial0,max_ports=16 -chardev socket,id=channel1,path=/tmp/helloworld1,server,nowait -device virtserialport,chardev=channel1,name=com.redhat.rhevm.vdsm1,bus=virtio-serial0.0,id=port1

2. hot add virtioserialport to the chardev channel1
(qemu)device_add virtserialport,chardev=channel1,name=com.redhat.rhevm.vdsm2,bus=virtio-serial0.0,id=port2

3.hot add virtioserialport to the chardev channel1 again
virtserialport,chardev=channel1,name=com.redhat.rhevm.vdsm2,bus=virtio-serial0.0,id=port2

Actual results:
after step2:qemu prompt "Property 'virtserialport.chardev' can't take value 'channel1', it's in use"
after step3,no warning,and the new can be seen in guest and in qemu qtree.

Expected results:
after step 3,qemu should also prompt a warning message as step2

Additional info:
after the hotplug,both the original and the new port can not work normally.No date can be transferred.

Comment 1 lijin 2013-12-03 09:33:10 UTC
(In reply to lijin from comment #0)
> Description of problem:
> hot plug virtio serial port to existing chardev already been used,qemu
> prompted warning "Property 'virtserialport.chardev' can't take value
> 'channel1', it's in use",but hotplug serialport with the same cmd again,the
> hotplug can success.
> The new port can be seen in guest and qtree.
> 
> Version-Release number of selected component (if applicable):
>     qemu-kvm-rhev-0.12.1.2-2.415.el6_5.3.x86_64
>     kernel-2.6.32-433.el6.x86_64
>     seabios-0.6.1.2-28.el6.x86_64
>     virtio-win-prewhql-74
> 
> How reproducible:
> 100%
> 
> Steps to Reproduce:
> 1. Start guest w/ virtio-serial-pci and virtio-serial-port
> CLI:/usr/libexec/qemu-kvm -m 4G -smp 4 -usb -device usb-tablet,id=tablet0
> -drive
> file=/home/win7-64.qcow2,if=none,id=drive-virtio0-0-0,format=qcow2,
> werror=stop,rerror=stop,cache=none -device
> ide-drive,drive=drive-virtio0-0-0,id=virti0-0-0,bootindex=1 -netdev
> tap,id=hostnet0,vhost=on,script=/etc/qemu-ifup -device
> virtio-net-pci,netdev=hostnet0,id=net0,mac=00:12:10:94:a3:f8 -uuid
> 8677bf9b-3cf6-47a1-b3e9-94213b801c87 -monitor stdio -spice
> id=on,disable-ticketing,port=5911 -vga qxl -bios
> /usr/share/seabios/bios-pm.bin -device
> virtio-serial-pci,id=virtio-serial0,max_ports=16 -chardev
> socket,id=channel1,path=/tmp/helloworld1,server,nowait -device
> virtserialport,chardev=channel1,name=com.redhat.rhevm.vdsm1,bus=virtio-
> serial0.0,id=port1
> 
> 2. hot add virtioserialport to the chardev channel1
> (qemu)device_add
> virtserialport,chardev=channel1,name=com.redhat.rhevm.vdsm2,bus=virtio-
> serial0.0,id=port2
> 
> 3.hot add virtioserialport to the chardev channel1 again
> virtserialport,chardev=channel1,name=com.redhat.rhevm.vdsm2,bus=virtio-
> serial0.0,id=port2
> 
> Actual results:
> after step2:qemu prompt "Property 'virtserialport.chardev' can't take value
> 'channel1', it's in use"
> after step3,no warning,and the new can be seen in guest and in qemu qtree.
> 
> Expected results:
> after step 3,qemu should also prompt a warning message as step2
> 
> Additional info:
> after the hotplug,both the original and the new port can not work
> normally.No date can be transferred.

in this case,I tested with win2012R2 guest instead of win7-64

Comment 2 Gal Hammer 2013-12-09 11:19:44 UTC
Isn't that a kvm-qemu's bug? I assume that you get this error even without a guest OS running.

Comment 3 lijin 2013-12-11 08:38:14 UTC
(In reply to Gal Hammer from comment #2)
> Isn't that a kvm-qemu's bug? I assume that you get this error even without a
> guest OS running.

yes,it is a qemu-kvm bug,change component to qemu-kvm.

Comment 5 lijin 2014-03-18 02:53:40 UTC
win8.1-32 guest hit the similar issue when hot plug a virtserialport to an used chardev,qemu can always prompt "Property 'virtserialport.chardev' can't take value 'chardev1', it's in use",but I still can see the pluged port in "info qtree".

package info:
kernel-3.10.0-110.el7.x86_64
qemu-kvm-rhev-1.5.3-53.el7.x86_64
seabios-1.7.2.2-12.el7.x86_64
virtio-win-prewhql-75

Comment 6 lijin 2014-07-22 07:28:16 UTC
still hit this isssue.

qemu-kvm-rhev-0.12.1.2-2.430.el6.x86_64
kernel-2.6.32-460.el6.x86_64
seabios-0.6.1.2-28.el6.x86_64
virtio-win-prewhql-86

steps:
1.boot win2k8r2 guest with:
/usr/libexec/qemu-kvm -drive file=win2k8R2.qcow2,if=none,cache=none,media=disk,format=qcow2,id=drive-ide0-0-1 -device ide-drive,id=ide0-0-1,drive=drive-ide0-0-1,bootindex=0 -global PIIX4_PM.disable_s3=0 -global PIIX4_PM.disable_s4=0 -vnc :0 -vga cirrus -usb -device usb-tablet -netdev tap,id=hostnet0 -device e1000,netdev=hostnet0,id=net0,mac=52:54:00:7f:f9:F6,bus=pci.0 -monitor unix:/tmp/tt,server,nowait -chardev file,path=/root/console.log,id=serial1 -device isa-serial,chardev=serial1,id=s1 -cpu SandyBridge -smp 4,maxcpus=4,cores=2,threads=2,sockets=1 -m 4G -enable-kvm -qmp tcp:0:4444,server,nowait -device virtio-serial-pci,id=virtio-serial0,max_ports=16 -chardev socket,id=channel0,path=/tmp/tt0,server,nowait -device virtserialport,nr=2,chardev=channel0,name=com.redhat.rhevm.vdsm,bus=virtio-serial0.0,id=port0 -device virtio-serial-pci,id=virtio-serial1,max_ports=31 -chardev socket,id=channel1,path=/tmp/tt1,server,nowait -device virtserialport,nr=2,chardev=channel1,name=com.redhat.rhevm.vdsm1,bus=virtio-serial1.0,id=port1

2.hot add virtioserialport to the already been used chardev:channel1
{"execute":"device_add","arguments":{"driver":"virtserialport","name":"com.redhat.rhevm.vdsm2","chardev":"channel1","bus":"virtio-serial0.0","id":"port2"}}
{"timestamp": {"seconds": 1406013479, "microseconds": 820443}, "event": "DEVICE_DELETED", "data": {"device": "port2"}}
{"error": {"class": "PropertyValueInUse", "desc": "Property 'virtserialport.chardev' can't take value 'channel1', it's in use", "data": 

3.hot add again:
{"device": "virtserialport", "property": "chardev", "value": "channel1"}}}
{"execute":"device_add","arguments":{"driver":"virtserialport","name":"com.redhat.rhevm.vdsm2","chardev":"channel1","bus":"virtio-serial0.0","id":"port2"}}
{"return": {}}

all three ports can be used normally

expected result:
hot add to an already used chardev should failed