Re: [PATCHv2 14/26] snapshot: prevent stranding snapshot data on domain destruction

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 08/15/2011 05:33 PM, Eric Blake wrote:
Just as leaving managed save metadata behind can cause problems
when creating a new domain that happens to collide with the name
of the just-deleted domain, the same is true of leaving any
snapshot metadata behind.  For safety sake, extend the semantic
change of commit b26a9fa9 to also cover snapshot metadata as a
reason to reject losing the last reference to a domain (undefine
on an inactive, or shutdown/destroy on a transient).  The caller
must first take care of snapshots, possible via the existing
virDomainSnapshotDelete.


+++ b/src/qemu/qemu_driver.c
@@ -1472,6 +1472,7 @@ static int qemuDomainShutdown(virDomainPtr dom) {
      virDomainObjPtr vm;
      int ret = -1;
      qemuDomainObjPrivatePtr priv;
+    int nsnapshots;

      qemuDriverLock(driver);
      vm = virDomainFindByUUID(&driver->domains, dom->uuid);
@@ -1485,6 +1486,14 @@ static int qemuDomainShutdown(virDomainPtr dom) {
          goto cleanup;
      }

+    if (!vm->persistent&&
+        (nsnapshots = virDomainSnapshotObjListNum(&vm->snapshots))) {

I had tested this, then rebased the series to add a parameter to virDomainSnapshotObjListNum in an earlier patch, which breaks compilation of this patch in the order presented in the series. Fix by adding a trailing ', 0' argument on the three lines where compilation fails.

--
Eric Blake   eblake@xxxxxxxxxx    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]