[libvirt] [PATCH] qemu: snapshot: inactive external snapshot can't work after libvirtd restart

When create inactive external snapshot, after update disk definitions, virDomainSaveConfig is needed, if not after restart libvirtd the new snapshot file definitions in xml will be lost. Reproduce steps: 1. prepare a shut off guest $ virsh domstate rhel7 && virsh domblklist rhel7 shut off Target Source ------------------------------------------------ vda /var/lib/libvirt/images/rhel7.img 2. create external disk snapshot $ virsh snapshot-create rhel7 --disk-only && virsh domblklist rhel7 Domain snapshot 1417882967 created Target Source ------------------------------------------------ vda /var/lib/libvirt/images/rhel7.1417882967 3. restart libvirtd then check guest source file $ service libvirtd restart && virsh domblklist rhel7 Redirecting to /bin/systemctl restart libvirtd.service Target Source ------------------------------------------------ vda /var/lib/libvirt/images/rhel7.img This was first reported by Eric Blake http://www.redhat.com/archives/libvir-list/2014-December/msg00369.html Signed-off-by: Shanzhi Yu <shyu@redhat.com> --- src/qemu/qemu_driver.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 9152cf5..9f8ea0a 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -12847,6 +12847,9 @@ qemuDomainSnapshotCreateInactiveExternal(virQEMUDriverPtr driver, goto cleanup; } defdisk->src->format = snapdisk->src->format; + + if (virDomainSaveConfig(cfg->configDir, vm->def) < 0) + goto cleanup; } } -- 2.1.0

On 12/06/2014 11:32 AM, Shanzhi Yu wrote:
When create inactive external snapshot, after update disk definitions, virDomainSaveConfig is needed, if not after restart libvirtd the new snapshot file definitions in xml will be lost.
Reproduce steps:
1. prepare a shut off guest $ virsh domstate rhel7 && virsh domblklist rhel7 shut off
Target Source ------------------------------------------------ vda /var/lib/libvirt/images/rhel7.img
2. create external disk snapshot $ virsh snapshot-create rhel7 --disk-only && virsh domblklist rhel7 Domain snapshot 1417882967 created Target Source ------------------------------------------------ vda /var/lib/libvirt/images/rhel7.1417882967
3. restart libvirtd then check guest source file $ service libvirtd restart && virsh domblklist rhel7 Redirecting to /bin/systemctl restart libvirtd.service Target Source ------------------------------------------------ vda /var/lib/libvirt/images/rhel7.img
This was first reported by Eric Blake http://www.redhat.com/archives/libvir-list/2014-December/msg00369.html
Signed-off-by: Shanzhi Yu <shyu@redhat.com> --- src/qemu/qemu_driver.c | 3 +++ 1 file changed, 3 insertions(+)
Looks like this one may have been lost in the shuffle prior to the holidays... Seems reasonable to me - although I'll wait a bit before pushing just in case by popping it to the top of the stack again it causes more discussion... John
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 9152cf5..9f8ea0a 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -12847,6 +12847,9 @@ qemuDomainSnapshotCreateInactiveExternal(virQEMUDriverPtr driver, goto cleanup; } defdisk->src->format = snapdisk->src->format; + + if (virDomainSaveConfig(cfg->configDir, vm->def) < 0) + goto cleanup; } }

On 01/14/2015 12:14 AM, John Ferlan wrote:
On 12/06/2014 11:32 AM, Shanzhi Yu wrote:
When create inactive external snapshot, after update disk definitions, virDomainSaveConfig is needed, if not after restart libvirtd the new snapshot file definitions in xml will be lost.
Reproduce steps:
1. prepare a shut off guest $ virsh domstate rhel7 && virsh domblklist rhel7 shut off
Target Source ------------------------------------------------ vda /var/lib/libvirt/images/rhel7.img
2. create external disk snapshot $ virsh snapshot-create rhel7 --disk-only && virsh domblklist rhel7 Domain snapshot 1417882967 created Target Source ------------------------------------------------ vda /var/lib/libvirt/images/rhel7.1417882967
3. restart libvirtd then check guest source file $ service libvirtd restart && virsh domblklist rhel7 Redirecting to /bin/systemctl restart libvirtd.service Target Source ------------------------------------------------ vda /var/lib/libvirt/images/rhel7.img
This was first reported by Eric Blake http://www.redhat.com/archives/libvir-list/2014-December/msg00369.html
Signed-off-by: Shanzhi Yu <shyu@redhat.com> --- src/qemu/qemu_driver.c | 3 +++ 1 file changed, 3 insertions(+)
Looks like this one may have been lost in the shuffle prior to the holidays...
Seems reasonable to me - although I'll wait a bit before pushing just in case by popping it to the top of the stack again it causes more discussion...
John
Thanks. I almost forgot it myself.
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 9152cf5..9f8ea0a 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -12847,6 +12847,9 @@ qemuDomainSnapshotCreateInactiveExternal(virQEMUDriverPtr driver, goto cleanup; } defdisk->src->format = snapdisk->src->format; + + if (virDomainSaveConfig(cfg->configDir, vm->def) < 0) + goto cleanup; } }
-- Regards shyu
participants (2)
-
John Ferlan
-
Shanzhi Yu