Bug 1183890 - save-image-edit will make spice or vnc passwd disappear when we edit something
Summary: save-image-edit will make spice or vnc passwd disappear when we edit something
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt
Version: 7.1
Hardware: x86_64
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: Michal Privoznik
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-01-20 06:11 UTC by Luyao Huang
Modified: 2015-11-19 06:08 UTC (History)
7 users (show)

Fixed In Version: libvirt-1.2.13-1.el7
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-11-19 06:08:23 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2015:2202 0 normal SHIPPED_LIVE libvirt bug fix and enhancement update 2015-11-19 08:17:58 UTC

Description Luyao Huang 2015-01-20 06:11:11 UTC
description of problem:
save-image-edit will make spice or vnc passwd disappear when we try to edit it

Version-Release number of selected component (if applicable):
libvirt-1.2.8-13.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
 
1.prepare a running guest with spice passwd

# virsh dumpxml test3 --security-info
    <graphics type='spice' autoport='yes' listen='0.0.0.0' keymap='en-us' passwd='111113'>
      <listen type='address' address='0.0.0.0'/>
    </graphics>

2. start and check the passwd work well
# virsh start test3

# virsh dumpxml test3 --security-info
    <graphics type='spice' port='5900' autoport='yes' listen='0.0.0.0' keymap='en-us' passwd='111113'>
      <listen type='address' address='0.0.0.0'/>
    </graphics>

3.save guest to file and edit
# virsh save test3 test3.save

Domain test3 saved to test3.save


# virsh save-image-edit test3.save
    <graphics type='spice' autoport='yes' listen='0.0.0.0' keymap='en-us' passwd='111113'>
      <listen type='address' address='0.0.0.0'/>
    </graphics>

add a blank line at last (or edit some other things).

State file test3.save edited.


4. passwd will disapear and if we restore the guest will found it is really go away

# virsh save-image-dumpxml test3.save --security-info
    <graphics type='spice' autoport='yes' listen='0.0.0.0' keymap='en-us'>
      <listen type='address' address='0.0.0.0'/>
    </graphics>

Actual results:
save-image-edit will make spice or vnc passwd disappear when we edit something

Expected results:
we can edit it success and passwd will work well when we restore the vm
or output a error when we try to edit it and keep the old passwd


Additional info:

Comment 2 Ján Tomko 2015-01-20 12:58:45 UTC
A patch mentioning this bug has been sent upstream:
https://www.redhat.com/archives/libvir-list/2015-January/msg00685.html

Comment 3 Michal Privoznik 2015-01-28 16:26:04 UTC
I've just pushed the patch upstream:

commit f76df311e8896957b92d0e0c5251ee3e6754d9ac
Author:     Luyao Huang <lhuang@redhat.com>
AuthorDate: Tue Jan 20 17:04:41 2015 +0800
Commit:     Michal Privoznik <mprivozn@redhat.com>
CommitDate: Wed Jan 28 16:56:34 2015 +0100

    qemu: fix cannot set graphic passwd via qemuDomainSaveImageDefineXML
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1183890
    
    When we try to update a xml to a image file, we will clear the
    graphics passwd settings, because we do not pass VIR_DOMAIN_XML_SECURE
    to qemuDomainDefCopy, qemuDomainDefFormatBuf won't format the passwd.
    
    Add VIR_DOMAIN_XML_SECURE flag when we call qemuDomainDefCopy
    in qemuDomainSaveImageUpdateDef.
    
    Signed-off-by: Luyao Huang <lhuang@redhat.com>

v1.2.12-30-gf76df31

Comment 5 vivian zhang 2015-05-25 09:14:48 UTC
I can produce this bug with build libvirt-1.2.8-13.el7.x86_64

Verify with build libvirt-1.2.15-2.el7.x86_64

Steps:1

1. edit guest with spice passwd
# virsh edit vm2
...
<graphics type='spice' autoport='yes' listen='0.0.0.0' keymap='en-us' passwd='aaaaaa'>
      <listen type='address' address='0.0.0.0'/>
    </graphics>
...

2. start guest and dumpxml --security-info, to check passwd works
# virsh dumpxml vm2 --security-info
...
<graphics type='spice' port='5900' autoport='yes' listen='0.0.0.0' keymap='en-us' passwd='aaaaaa'>
      <listen type='address' address='0.0.0.0'/>
    </graphics>
...

3.save guest

# virsh save vm2 vm2.save

Domain vm2 saved to vm2.save

4. edit save file, modify some place
# virsh save-image-edit vm2.save 
State file vm2.save edited.

5. dumpxml save file, check passwd still exist

# virsh save-image-dumpxml vm2.save --security-info
...
<graphics type='spice' autoport='yes' listen='0.0.0.0' keymap='en-us' passwd='aaaaaa'>
      <listen type='address' address='0.0.0.0'/>
    </graphics>
...

6. test graphics type=vnc, reproduce step 1-5, get the same result

...
<graphics type='vnc' port='-1' autoport='yes' listen='0.0.0.0' keymap='en-us' passwd='cccccc'>
      <listen type='address' address='0.0.0.0'/>
    </graphics>
...

move to verified

Comment 7 errata-xmlrpc 2015-11-19 06:08:23 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


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