Bug 676374

Summary: cannot set spice's passwdValidTo
Product: Red Hat Enterprise Linux 6 Reporter: Dan Kenigsberg <danken>
Component: libvirtAssignee: Michal Privoznik <mprivozn>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.0CC: berrange, dallan, dyuan, eblake, gsun, jdenemar, mzhan, syeghiay, xen-maint, yoyzhang
Target Milestone: rcKeywords: Regression
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libvirt-0.8.7-6.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-05-19 13:26:54 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Dan Kenigsberg 2011-02-09 16:51:07 UTC
Description of problem:
virsh update-device domname <(echo '<graphics autoport="yes" listen="0" passwd="xxx" port="5900" tlsPort="-1" type="spice" passwdValidTo="2011-02-10T08:42:32" />')
fails with 
error: internal error cannot change port settings on spice graphics

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

How reproducible:
always

Additional info:
(06:33:47 PM) danpb: danken: ahhhh
(06:34:04 PM) danpb:     } else if (def->type == VIR_DOMAIN_GRAPHICS_TYPE_SPICE) {
(06:34:04 PM) danpb:   ....
(06:34:04 PM) danpb:         def->data.spice.listenAddr = virXMLPropString(node, "listen");
(06:34:04 PM) danpb:         def->data.spice.keymap = virXMLPropString(node, "keymap");
(06:34:04 PM) danpb:         if (virDomainGraphicsAuthDefParseXML(node, &def->data.vnc.auth) < 0)
(06:34:04 PM) mkarg is now known as mkarg|afk
(06:34:05 PM) danpb:             goto error;
(06:34:09 PM) danpb: spot the typo there !
(06:34:30 PM) danpb: between 0.8.7-3 and -5 we added another field into def->data.vnc 
(06:34:38 PM) danpb: so this previously harmless typo is now a real bug
(06:34:48 PM) danpb: danken: file a bz for it please & mark it regression

Comment 3 Michal Privoznik 2011-02-10 11:09:20 UTC
patch commited to upstream:

commit 10713b1b98268a6eb05ba0912c1f4643c25f2564
Author: Michal Privoznik <mprivozn@redhat.com>
Date:   Thu Feb 10 10:50:10 2011 +0000

    Fix typo in parsing of spice 'auth' data
    
    A typo s/spice/vnc/ caused parsing of the spice 'auth' data
    to write into the wrong part of the struct, blowing away
    other unrelated data.
    
    * src/conf/domain_conf.c: s/vnc/spice/ in parsing spice auth

Comment 5 Min Zhan 2011-02-12 11:57:39 UTC
Verified as Passed in below environment:
# uname -a
Linux dhcp-65-85.nay.redhat.com 2.6.32-112.el6.x86_64 #1 SMP Wed Feb 2 14:17:15
EST 2011 x86_64 x86_64 x86_64 GNU/Linux
kernel-2.6.32-112.el6.x86_64
qemu-kvm-0.12.1.2-2.132.el6.x86_64
libvirt-0.8.7-6.el6.x86_64


Steps:
1. Prepare a guest with graphics as following:
   <graphics type='spice' port='5905' tlsPort='-1' autoport='no' listen='0.0.0.0' keymap='en-us'/>

2. Start the guest
# virsh start rhel6
Domain rhel6 started

Use spice-client to check guest windows
# /usr/libexec/spicec -h 0.0.0.0 -p 5905

3. Prepare a xml as following
# cat passwd.xml 
<graphics type='spice' port='5905' autoport='no' keymap='en-us'  passwd='hello' tlsPort='-1' listen='0.0.0.0' passwdValidTo='2011-02-12T20:10:00'/>

4.Change spice password on the fly for the guest.
# virsh update-device rhel6 passwd.xml 
Device updated successfully

Connect guest windows again
# /usr/libexec/spicec -h 0.0.0.0 -p 5905 -w hello

# virsh dumpxml rhel6
...
 <graphics type='spice' port='5905' tlsPort='-1' autoport='no' listen='0.0.0.0' keymap='en-us' passwdValidTo='2011-02-12T20:10:00'/>
...

Comment 8 Michal Privoznik 2011-05-04 08:40:51 UTC
* The problem was typo in source code resulting accessing uninitialized union and thus crash

* setting auth against spice caused libvirt to print error message

* The typo was fixed

* So setting auth works well

Comment 9 errata-xmlrpc 2011-05-19 13:26:54 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