Red Hat Bugzilla – Bug 1122255
'virsh desc $dom blah' doesn't survive libvirtd restart
Last modified: 2015-03-05 02:41:30 EST
cloning to RHEL 7. In particular, VDSM wants to set <metadata>, and needs this fixed to ensure that setting survives libvirtd restart +++ This bug was initially created as a clone of Bug #1122205 +++ 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: --- Additional comment from Eric Blake on 2014-07-22 13:12:01 MDT --- Upstream patch proposed: https://www.redhat.com/archives/libvir-list/2014-July/msg01150.html
Moving to POST, since rebase will pick this up: commit 60e49440598b4aeb4a32bf23bfa5ed85672cbd6a Author: Eric Blake <eblake@redhat.com> Date: Tue Jul 22 09:41:05 2014 -0600 metadata: track title edits across libvirtd restart https://bugzilla.redhat.com/show_bug.cgi?id=1122205 Although the edits were changing in-memory XML, it was not flushed to disk; so unless some other action changes XML, a libvirtd restart would lose the changed information. * src/conf/domain_conf.c (virDomainObjSetMetadata): Add parameter, to save live status across restarts. (virDomainSaveXML): Allow for test driver. * src/conf/domain_conf.h (virDomainObjSetMetadata): Adjust signature. * src/bhyve/bhyve_driver.c (bhyveDomainSetMetadata): Adjust caller. * src/lxc/lxc_driver.c (lxcDomainSetMetadata): Likewise. * src/qemu/qemu_driver.c (qemuDomainSetMetadata): Likewise. * src/test/test_driver.c (testDomainSetMetadata): Likewise. Signed-off-by: Eric Blake <eblake@redhat.com>
I could reproduce this issue with libvirt-1.1.1-29.el7.x86_64: 1. Prepare a guest's xml file with description "desc1" [root@rhel7-e Desktop]# grep desc rhel6u5.xml <description>desc1</description> 2. Start a new transient domain [root@rhel7-e Desktop]#virsh create rhel6u5.xml Domain rhel6u5 created from rhel6u5.xml [root@rhel7-e Desktop]# virsh list Id Name State ---------------------------------------------------- 7 rhel6u5 running 3. Check the description [root@rhel7-e Desktop]#virsh desc rhel6u5 desc1 4. Modify the description [root@rhel7-e Desktop]#virsh desc rhel6u5 desc2 Domain description updated successfully 5. Check the description [root@rhel7-e Desktop]#virsh desc rhel6u5 desc2 6. Restart libvirtd service [root@rhel7-e Desktop]#service libvirtd restart Redirecting to /bin/systemctl restart libvirtd.service 7. Check the description [root@rhel7-e Desktop]#virsh desc rhel6u5 desc1 8. Modify the description [root@rhel7-e Desktop]#virsh desc rhel6u5 desc3 Domain description updated successfully 9. Suspend the domain [root@rhel7-e Desktop]#virsh suspend rhel6u5 Domain rhel6 suspended 10. Restart libvirtd service [root@rhel7-e Desktop]#service libvirtd restart Redirecting to /bin/systemctl restart libvirtd.service 11. Check the description [root@rhel7-e Desktop]#virsh desc rhel6u5 desc3 Verify this issue with libvirt-1.2.7-1.el7: 1. Prepare a guest's xml file with description "desc1" [root@rhel7-e Desktop]# grep desc rhel6u5.xml <description>desc1</description> 2. Start a new transient domain [root@rhel7-e Desktop]#virsh create rhel6u5.xml Domain rhel6u5 created from rhel6u5.xml [root@rhel7-e Desktop]# virsh list Id Name State ---------------------------------------------------- 7 rhel6u5 running 3. Check the description [root@rhel7-e Desktop]#virsh desc rhel6u5 desc1 4. Modify the description [root@rhel7-e Desktop]#virsh desc rhel6u5 desc2 Domain description updated successfully 5. Check the description [root@rhel7-e Desktop]#virsh desc rhel6u5 desc2 6. Restart libvirtd service [root@rhel7-e Desktop]#service libvirtd restart Redirecting to /bin/systemctl restart libvirtd.service 7. Check the description [root@rhel7-e Desktop]#virsh desc rhel6u5 desc2 8. Modify the description [root@rhel7-e Desktop]#virsh desc rhel6u5 desc3 Domain description updated successfully 9. Suspend the domain [root@rhel7-e Desktop]#virsh suspend rhel6u5 Domain rhel6 suspended 10. Restart libvirtd service [root@rhel7-e Desktop]#service libvirtd restart Redirecting to /bin/systemctl restart libvirtd.service 11. Check the description [root@rhel7-e Desktop]#virsh desc rhel6u5 desc3
Test for updating the desc for a running persistent domain with --live/--current/--config with build libvirt-1.2.8-1.el7.x86_64, and all of tests could work well. [root@rhel7-b1 ~]# virsh dumpxml rhel7 | grep desc <description>desc1</description> [root@rhel7-b1 ~]# virsh start rhel7 Domain rhel7 started [root@rhel7-b1 ~]# virsh list Id Name State ---------------------------------------------------- 8 rhel7 running [root@rhel7-b1 ~]# virsh desc rhel7 desc1 [root@rhel7-b1 ~]# virsh desc rhel7 --live desc1 [root@rhel7-b1 ~]# virsh desc rhel7 --config desc1 [root@rhel7-b1 ~]# virsh desc rhel7 --current desc1 [root@rhel7-b1 ~]# virsh desc rhel7 --live desc2 Domain description updated successfully [root@rhel7-b1 ~]# virsh desc rhel7 --live desc2 [root@rhel7-b1 ~]# virsh desc rhel7 desc2 [root@rhel7-b1 ~]# service libvirtd restart Redirecting to /bin/systemctl restart libvirtd.service [root@rhel7-b1 ~]# virsh desc rhel7 desc2 [root@rhel7-b1 ~]# virsh desc rhel7 --live desc2 [root@rhel7-b1 ~]# virsh desc rhel7 --config desc1 [root@rhel7-b1 ~]# virsh desc rhel7 --config desc3 Domain description updated successfully [root@rhel7-b1 ~]# virsh desc rhel7 --config desc3 [root@rhel7-b1 ~]# service libvirtd restart Redirecting to /bin/systemctl restart libvirtd.service [root@rhel7-b1 ~]# virsh desc rhel7 --config desc3 [root@rhel7-b1 ~]# virsh desc rhel7 --current desc2 [root@rhel7-b1 ~]# virsh desc rhel7 --current desc4 Domain description updated successfully [root@rhel7-b1 ~]# virsh desc rhel7 --current desc4 [root@rhel7-b1 ~]# virsh desc rhel7 desc4 [root@rhel7-b1 ~]# service libvirtd restart Redirecting to /bin/systemctl restart libvirtd.service [root@rhel7-b1 ~]# virsh desc rhel7 --current desc4 [root@rhel7-b1 ~]# virsh destroy rhel7 Domain rhel7 destroyed [root@rhel7-b1 ~]# virsh desc rhel7 desc3
I can produce this bug on build libvirt-1.1.1-29.el7.x86_64 verify it on build libvirt-1.2.8-9.el7.x86_64 verify steps 1. prepare a transient domain with desc <description>desc</description> # virsh create /tmp/rhel7.xml Domain rhel7 created from /tmp/rhel7.xml # virsh list --all Id Name State ---------------------------------------------------- 106 rhel7 running 2. list and update desc by command # virsh desc rhel7 desc # virsh desc rhel7 desc1 Domain description updated successfully # virsh desc rhel7 desc1 3. restart libvirtd service # service libvirtd restart Redirecting to /bin/systemctl restart libvirtd.service # virsh list --all Id Name State ---------------------------------------------------- 106 rhel7 running [root@server html]# virsh desc rhel7 desc1 4. suspend guest and do step 2, 3 again # virsh suspend rhel7 Domain rhel7 suspended # virsh desc rhel7 desc1 # virsh desc rhel7 desc2 Domain description updated successfully # virsh desc rhel7 desc2 # service libvirtd restart Redirecting to /bin/systemctl restart libvirtd.service # virsh desc rhel7 desc2 [root@server html]# virsh list --all Id Name State ---------------------------------------------------- 106 rhel7 paused 5. prepare a persistent guest # virsh list --all Id Name State ---------------------------------------------------- 103 rhel7 running [root@server html]# virsh desc rhel7 desc3 [root@server html]# virsh desc rhel7 desc4 Domain description updated successfully [root@server html]# virsh desc rhel7 desc4 [root@server html]# service libvirtd restart Redirecting to /bin/systemctl restart libvirtd.service [root@server html]# virsh desc rhel7 desc4 6 retest desc for different parameters # virsh desc rhel7 desc1 --live Domain description updated successfully # virsh desc rhel7 --live desc1 [root@server html]# virsh desc rhel7 --config desc # virsh desc rhel7 desc2 --config Domain description updated successfully # virsh desc rhel7 --config desc2 # virsh desc rhel7 desc1 # virsh destroy rhel7 Domain rhel7 destroyed # virsh desc rhel7 desc2 # virsh start rhel7 Domain rhel7 started # virsh desc rhel7 desc3 --current Domain description updated successfully # virsh desc rhel7 desc3 # virsh destroy rhel7 Domain rhel7 destroyed # virsh desc rhel7 desc2 7.test with --title for transient guest # virsh create /tmp/rhel7.xml Domain rhel7 created from /tmp/rhel7.xml # virsh desc rhel7 desc # virsh desc rhel7 --title No description for domain: rhel7 # virsh desc rhel7 --title title Domain description updated successfully # virsh desc rhel7 --title title # service libvirtd restart Redirecting to /bin/systemctl restart libvirtd.service # virsh desc rhel7 --title title # virsh list --all Id Name State ---------------------------------------------------- 105 rhel7 running for persistent guest repeat steps 5,6 all success move to verified
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/RHSA-2015-0323.html