Re: [PATCHv4 00/51] shared snapshot meta-data

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

 



Hello,

On Friday 02 September 2011 11:57:15 Daniel Veillard wrote:
> Review:
>  29 Isn't there a way to save the domain snapshot on shared storage when
>     available to try to avoid the problem ? It wouldn't work all the
>     time but might be simpler than rolling out a v4. or consider the
>     snapshot data as extra domain resource that could be migrated on
>     the fly like we can do for disk images in some cases.

We are currently doing this and it works more or less.
1. You have to put /var/lib/libvirt/qemu/snapshot/ on a shared storage, but 
only that and not /var/lib/libvirt/qemu/ itself, because there the UNIX 
domain monitor sockets are located; if you do that, you'll get problems 
because on migration two KVM instances will use the same path name for their 
monitor sockets.
2. You have to hook qemuDomainSnapshotLoad() to qemudDomainMigrateFinish2() 
(and qemudDomainDefine()) to get already existing snapshots associated to 
newly migrated domains, either via migrate() for live domains, or via 
define() for non-live domains.
3. You need do remove the locking from qemudDomainDefine(), because the two 
functions mentioned above alread hold the domain lock.

That is what get me started to work on "Fix memory leak while scanning 
snapshots", "killall -SIGHUP libvirtd / virStateReload" and "Reload snapshots 
on SIGHUP". At leas our patched 0.8.7 is working fine with those changes.

Sincerely
Philipp
-- 
Philipp Hahn           Open Source Software Engineer      hahn@xxxxxxxxxxxxx
Univention GmbH        Linux for Your Business        fon: +49 421 22 232- 0
Mary-Somerville-Str.1  D-28359 Bremen                 fax: +49 421 22 232-99
                                                   http://www.univention.de/
----------------------------------------------------------------------------
Treffen Sie Univention auf der IT&Business vom 20. bis 22. September 2011
auf dem Gemeinschaftsstand der Open Source Business Alliance in Stuttgart in
Halle 3 Stand 3D27-7.
Bug #22072: Re-scan for snapshots after migration and on SIGHUP to libvirtd.

libvirts extended snapshot data from /var/lib/libvirt/qemu/snapshot/ is not transferred to the destionation host as the domain xml data from /etc/libvirt/qemu/ is.
Also this information is currently only loaded once on libvirtd startup, so even if this data would be available, libvirtd wouldn't notice until it's restarted.
1. After migation automatically scan for snapshot data 
2. On SIGHUP, also rescan snapshot data
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -1081,7 +1081,7 @@ err_exit:
     return NULL;
 }
 
-static void qemuDomainSnapshotLoad(void *payload,
+static void _qemuDomainSnapshotLoad(void *payload,
                                    const char *name ATTRIBUTE_UNUSED,
                                    void *data)
 {
@@ -1096,7 +1096,6 @@ static void qemuDomainSnapshotLoad(void 
     virDomainSnapshotDefPtr def = NULL;
     char ebuf[1024];
 
-    virDomainObjLock(vm);
     if (virAsprintf(&snapDir, "%s/%s", baseDir, vm->def->name) < 0) {
         VIR_ERROR(_("Failed to allocate memory for snapshot directory for domain %s"),
                    vm->def->name);
@@ -1166,6 +1165,15 @@ cleanup:
     if (dir)
         closedir(dir);
     VIR_FREE(snapDir);
+}
+
+static void qemuDomainSnapshotLoad(void *payload,
+                                   const char *name,
+                                   void *data)
+{
+    virDomainObjPtr vm = (virDomainObjPtr)payload;
+    virDomainObjLock(vm);
+    _qemuDomainSnapshotLoad(payload, name, data);
     virDomainObjUnlock(vm);
 }
 
@@ -1487,6 +1495,9 @@ qemudReload(void) {
                             qemu_driver->configDir,
                             qemu_driver->autostartDir,
                             0, qemudNotifyLoadDomain, qemu_driver);
+
+    virHashForEach(qemu_driver->domains.objs, qemuDomainSnapshotLoad,
+                   qemu_driver->snapshotDir);
     qemuDriverUnlock(qemu_driver);
 
     qemudAutostartConfigs(qemu_driver);
@@ -6411,6 +6411,8 @@ static virDomainPtr qemudDomainDefine(vi
         goto cleanup;
     }
 
+    _qemuDomainSnapshotLoad(vm, NULL, qemu_driver->snapshotDir); /* Bug #22072 */
+
     event = virDomainEventNewFromObj(vm,
                                      VIR_DOMAIN_EVENT_DEFINED,
                                      !dupVM ?
@@ -9065,6 +9076,8 @@ qemudDomainMigrateFinish2 (virConnectPtr
                 goto endjob;
             }
 
+            _qemuDomainSnapshotLoad(vm, NULL, qemu_driver->snapshotDir); /* Bug #22072 */
+
             event = virDomainEventNewFromObj(vm,
                                              VIR_DOMAIN_EVENT_DEFINED,
                                              newVM ?

Attachment: signature.asc
Description: This is a digitally signed message part.

--
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]