Bug 1122205 - 'virsh desc $dom blah' doesn't survive libvirtd restart
Summary: 'virsh desc $dom blah' doesn't survive libvirtd restart
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: libvirt
Version: 6.6
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Peter Krempa
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On: 1115039
Blocks: 1122255
TreeView+ depends on / blocked
 
Reported: 2014-07-22 18:53 UTC by Eric Blake
Modified: 2014-10-14 04:23 UTC (History)
9 users (show)

Fixed In Version: libvirt-0.10.2-45.el6
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 1122255 (view as bug list)
Environment:
Last Closed: 2014-10-14 04:23:15 UTC


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2014:1374 normal SHIPPED_LIVE libvirt bug fix and enhancement update 2014-10-14 08:11:54 UTC

Description Eric Blake 2014-07-22 18:53:06 UTC
Description of problem:
I noticed this while reviewing bug 1115039, although the issue is independent. By itself, virDomainSetMetadata doesn't save active XML changes to disk; if no other command is issued which also saves to disk, then the edits are lost across libvirtd restarts.

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

How reproducible:
100%

Steps to Reproduce:
1. Start a new transient domain with a known description "desc1" (in build -42, you can omit the description, but in build -41, description has to exist or libvirtd will crash)
2. modify the description: virsh desc $dom desc2
3. check the description: virsh dumpxml $dom | grep desc
4. restart libvirtd: service libvirtd restart
5. check the description: virsh dumpxml $dom | grep desc
6. try again: virsh desc $dom desc3
7. this time, force xml saves: virsh suspend $dom
8. restart libvirtd: service libvirtd restart
9. check the description: virsh dumpxml $dom | grep desc

Actual results:
3.   <description>desc2</description>
5.   <description>desc1</description>
9.   <description>desc3</description>

Expected results:
3.   <description>desc2</description>
5.   <description>desc2</description>
9.   <description>desc3</description>


Additional info:

Comment 1 Eric Blake 2014-07-22 19:12:01 UTC
Upstream patch proposed:
https://www.redhat.com/archives/libvir-list/2014-July/msg01150.html

Comment 2 Eric Blake 2014-07-23 16:15:15 UTC
During review, Martin pointed out that at qemuDomainSetNumaParameters() probably has the same issue.  There are probably other broken APIs, it may be worth a full audit, and maybe retitling this bug to cover all of the APIs that don't save state to disk after modifying in-memory XML.

Comment 5 Luyao Huang 2014-08-15 08:02:47 UTC
I have found some virsh command have this issue:
1.blkiotune --device-weights
steps for reproduce:
 1.# virsh blkiotune test6
  weight         : 1000
  device_weight  : /dev/sda,1000
 2.# virsh dumpxml test6|grep -2 /dev/sda
  <blkiotune>
    <device>
      <path>/dev/sda</path>
      <weight>1000</weight>
    </device>

 3.# virsh blkiotune test6 --device-weights /dev/sda,0

 4.# virsh blkiotune test6
  weight         : 1000
  device_weight  : 
 5.# virsh dumpxml test6|grep -2 /dev/sda

 6.# service libvirtd restart
  Stopping libvirtd daemon:                                  [  OK  ]
  Starting libvirtd daemon:                                  [  OK  ]
 7.# virsh blkiotune test6
  weight         : 1000
  device_weight  : /dev/sda,1000
 8.# virsh blkiotune test6 --device-weights /dev/sda,0
 9.# virsh suspend test6
  Domain test6 suspended
 10.# service libvirtd restart
  Stopping libvirtd daemon:                                  [  OK  ]
  Starting libvirtd daemon:                                  [  OK  ]
 11.# virsh dumpxml test6|grep -2 /dev/sda

 12.# virsh blkiotune test6
  weight         : 1000
  device_weight  : 

2.numatune --nodeset(seems this command use qemuDomainSetNumaParameters)
steps for reproduce just like blkiotune

3.migrate-setspeed
steps for reproduce just like blkiotune

4.domiftune 
steps for reproduce just like blkiotune

Comment 10 Luyao Huang 2014-09-05 06:30:19 UTC
I can reprodeuce it with libvirt-0.10.2-41.el6.x86_64
Verify this bug with libvirt-0.10.2-45.el6.x86_64.

Step:
For disc:
# virsh desc r6 1234
Domain description updated successfully
# virsh desc r6
1234
# virsh dumpxml r6|grep  description
  <description>123</description>

# service libvirtd restart
Stopping libvirtd daemon:                                  [  OK  ]
Starting libvirtd daemon:                                  [  OK  ]

# virsh desc r6
1234

# virsh dumpxml r6|grep description
  <description>123</description>

For metadata:
use rhel7 to connect to rhel6
virsh # metadata test6 --uri http://herp.derp/ --key herp --set  "<derp xmlns:foobar='http://foo.bar/'></derp>"
Metadata modified

virsh # metadata test6 --uri http://herp.derp/ --live
<derp xmlns:foobar="http://foo.bar/"/>

virsh # dumpxml test6
  <metadata>
    <herp:derp xmlns:foobar="http://foo.bar/" xmlns:herp="http://herp.derp/"/>
  </metadata>



restart libvirtd in rhel6
# service libvirtd restart
Stopping libvirtd daemon:                                  [  OK  ]
Starting libvirtd daemon:                                  [  OK  ]


virsh # metadata test6 --uri http://herp.derp/ --live
<derp xmlns:foobar="http://foo.bar/"/>

virsh # dumpxml test6
  <metadata>
    <herp:derp xmlns:foobar="http://foo.bar/" xmlns:herp="http://herp.derp/"/>
  </metadata>

Comment 12 errata-xmlrpc 2014-10-14 04:23:15 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.

http://rhn.redhat.com/errata/RHBA-2014-1374.html


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