Bug 1129198

Summary: [Doc]Add a note that spice channel is ignored without spice graphics
Product: Red Hat Enterprise Linux 7 Reporter: Hu Jianwei <jiahu>
Component: libvirtAssignee: Pavel Hrdina <phrdina>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: low Docs Contact:
Priority: medium    
Version: 7.0CC: dyuan, fjin, honzhang, mzhan, phrdina, rbalakri
Target Milestone: rcKeywords: Reopened
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: libvirt-1.2.14-1.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-11-19 05:47:30 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 Hu Jianwei 2014-08-12 09:45:33 UTC
Description of problem:
A domain with spiceport char device and without spice graphics, libvirt directly ignored the related -chardev options in qemu command line, started domain successfully.

Version-Release number of selected component (if applicable):
libvirt-1.2.7-1.el7.x86_64
qemu-kvm-rhev-2.1.0-1.el7.x86_64
kernel-3.10.0-138.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
Set a vnc graphics in domain xml as below:
    <graphics type='vnc' port='5900' autoport='yes' listen='127.0.0.1'>
      <listen type='address' address='127.0.0.1'/>
    </graphics>

[root@localhost libvirt-1.2.7]# virsh dumpxml r7 | grep spiceport -b4

1370:    <serial type='spiceport'>
1400-      <source channel='org.qemu.console.serial.0'/>
1452-      <target port='1'/>
1477-    </serial>
1491:    <console type='spiceport'>
1522-      <source channel='org.qemu.console.serial.0'/>
1574-      <target type='serial' port='1'/>
1613-    </console>

[root@localhost libvirt-1.2.7]# virsh start r7
Domain r7 started

[root@localhost ~]# ps aux | grep qemu-kvm
qemu      3469 23.6  7.4 1733864 580052 ?      Sl   16:58   0:24 /usr/libexec/qemu-kvm -name r7 -S -machine pc-i440fx-rhel7.0.0,accel=kvm,usb=off -m 1024 -realtime mlock=off -smp 1,sockets=1,cores=1,threads=1 -uuid 628e1918-eb89-4ded-8c10-f81e93b8eb7c -no-user-config -nodefaults -chardev socket,id=charmonitor,path=/var/lib/libvirt/qemu/r7.monitor,server,nowait -mon chardev=charmonitor,id=monitor,mode=control -rtc base=utc -no-shutdown -boot strict=on -device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 -device virtio-serial-pci,id=virtio-serial0,bus=pci.0,addr=0x5 -drive file=/var/lib/libvirt/images/r7_latest.img,if=none,id=drive-ide0-0-0,format=raw,cache=none -device ide-hd,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0,bootindex=1 -netdev tap,fd=25,id=hostnet0 -device rtl8139,netdev=hostnet0,id=net0,mac=52:54:00:06:82:2b,bus=pci.0,addr=0x3 -vnc 127.0.0.1:0 -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 -msg timestamp=on

[root@localhost ~]# virsh list --all
 Id    Name                           State
----------------------------------------------------
 21    r7                             running

[root@localhost ~]# virsh dumpxml r7 | grep spiceport -b5
...
2104:    <serial type='spiceport'>
2134-      <source channel='org.qemu.console.serial.0'/>
2186-      <target port='1'/>
2211-      <alias name='serial0'/>
2241-    </serial>
2255:    <console type='spiceport'>
2286-      <source channel='org.qemu.console.serial.0'/>
2338-      <target type='serial' port='1'/>
2377-      <alias name='serial0'/>
2407-    </console>
...

Actual results:
As shown above steps, libvirt ignored the spiceport device continue to start domain.

[root@localhost libvirt-1.2.7]# grep "== VIR_DOMAIN_CHR_TYPE_SPICEPORT" ./src/qemu/qemu_command.c -b5
298519-
298520-    for (i = 0; i < def->nserials; i++) {
298562-        virDomainChrDefPtr serial = def->serials[i];
298615-        char *devstr;
298637-
298638:        if (serial->source.type == VIR_DOMAIN_CHR_TYPE_SPICEPORT && !spice)
298714-            continue;
298736-
298737-        /* Use -chardev with -device if they are available */
298799-        if (virQEMUCapsSupportsChardev(def, qemuCaps, serial)) {
298864-            virCommandAddArg(cmd, "-chardev");

 
Expected results:
Libvirt had better report a clear error message or do a sanity check before starting, rather than starting domain without such spiceport device in qemu command line.

Additional info:
From: man qemu-kvm
       -chardev spiceport ,id=id ,debug=debug, name=name
           spiceport is only available when spice support is built in.

           debug debug level for spicevmc

           name name of spice port to connect to

           Connect to a spice port, allowing a Spice client to handle the traffic identified by a name (preferably a fqdn).

Comment 2 Pavel Hrdina 2015-02-26 12:49:42 UTC
Hi, I don't agree that this is a BUG.  The additional info says that from QEMU's point of view the spiceport is available only if QEMU was built with spice support.  It doesn't tell anything about how we should handle XML description of domains in libvirt.  We specifically choose to ignore the spiceport for case that there is no spice graphics to not be that restrictive about our XML descriptions.

I've proposed a patch to update our documentation to mention this behavior:
https://www.redhat.com/archives/libvir-list/2015-February/msg01110.html

Comment 3 Hu Jianwei 2015-02-27 02:14:01 UTC
Thanks for your reply, I changed it as a doc bug and assign it to you. Please help me deal with it. Thanks.

Comment 4 Pavel Hrdina 2015-03-09 13:41:17 UTC
Hi, sure.  I've already posted a v2 patch to add the documentation note and after the patch will be ACKed and pushed to upstream I'll update the bug to POST.

https://www.redhat.com/archives/libvir-list/2015-February/msg01203.html

Comment 5 Pavel Hrdina 2015-03-10 10:17:34 UTC
Upstream commit

commit 242e8c54728abc464b92d55a5ce76121803c97e4
Author: Pavel Hrdina <phrdina>
Date:   Thu Feb 26 11:59:41 2015 +0100

    docs: add a note that spice channel is usable only with spice graphics
    
    To prevent a confusion about missing chardev argument in qemu
    command line add a note about that behavior into documentation.
    
    Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1129198
    
    Signed-off-by: Pavel Hrdina <phrdina>

Comment 8 Fangge Jin 2015-07-01 09:55:25 UTC
Hi Pavel Hrdina,

By this sentence "Note: depending on the hypervisor, spiceports might (or might not) be enabled on domains with or without spice graphics.", do you mean 
1) depending on the hypervisor,  spiceports might be enabled on domains with or without spice graphics, and might not be enabled on domians with or without spice graphics.

or 
2) depending on the hepervisor, spiceports might be enabled on domains with spice graphics, and might not be enabled on domains without spice graphics.

Thanks!
fjin

Comment 9 Pavel Hrdina 2015-07-01 10:15:38 UTC
Hi Jin,

the 2) is correct interpretation of that sentence.

Comment 10 Fangge Jin 2015-07-01 10:30:35 UTC
Verified on build libvirt-1.2.16-1.el7.x86_64. The doc has been updated, move to verified.

Comment 13 errata-xmlrpc 2015-11-19 05:47:30 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