]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
Revert "snapshot: Add virDomainSnapshotObjListFormat"
authorEric Blake <eblake@redhat.com>
Mon, 25 Mar 2019 19:46:18 +0000 (14:46 -0500)
committerEric Blake <eblake@redhat.com>
Tue, 26 Mar 2019 20:07:47 +0000 (15:07 -0500)
This reverts commit 86c0ed6f70268dfa7c3bba95a0ba96fcfe2ab039, and
subsequent refactorings of the function into new files.  There are no
callers of this function - I had originally proposed it for
implementing a new bulk snapshot API, but that proved to be too
invasive given RPC limits. I also tried using it for streamlining how
the qemu driver stores snapshot state across libvirtd restarts
internally, but in the end, the risks of a new internal format
outweighed the benefits of one file per snapshot.

Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
src/conf/snapshot_conf.c
src/conf/snapshot_conf.h
src/conf/virdomainsnapshotobjlist.c
src/conf/virdomainsnapshotobjlist.h
src/libvirt_private.syms

index cc3f71ab6f760349c489979f441bb276c62cd22c..4ce120451ed1a24cd23b779b90440cd4586cb24b 100644 (file)
@@ -787,7 +787,7 @@ virDomainSnapshotDiskDefFormat(virBufferPtr buf,
 
 /* Append XML describing def into buf. Return 0 on success, or -1 on
  * failure with buf cleared. */
-int
+static int
 virDomainSnapshotDefFormatInternal(virBufferPtr buf,
                                    const char *uuidstr,
                                    virDomainSnapshotDefPtr def,
index d082ffbad0d461b10b16e1fdb1048b2612ff6f43..cc8f384bf7252bb7f77ccb91e432934343ea8a3b 100644 (file)
@@ -119,13 +119,6 @@ char *virDomainSnapshotDefFormat(const char *uuidstr,
                                  virCapsPtr caps,
                                  virDomainXMLOptionPtr xmlopt,
                                  unsigned int flags);
-int virDomainSnapshotDefFormatInternal(virBufferPtr buf,
-                                       const char *uuidstr,
-                                       virDomainSnapshotDefPtr def,
-                                       virCapsPtr caps,
-                                       virDomainXMLOptionPtr xmlopt,
-                                       unsigned int flags);
-
 int virDomainSnapshotAlignDisks(virDomainSnapshotDefPtr snapshot,
                                 int default_snapshot,
                                 bool require_match);
index 20f4ff22f216f39ca7eb0af68f6c3c5a406e7f77..04221134dac293d4907d4a6b3f7ca01d7db5208a 100644 (file)
@@ -39,67 +39,6 @@ struct _virDomainSnapshotObjList {
 };
 
 
-/* Struct and callback function used as a hash table callback; each call
- * appends another snapshot XML to buf, with the caller clearing the
- * buffer if any callback fails. */
-struct virDomainSnapshotFormatData {
-    virBufferPtr buf;
-    const char *uuidstr;
-    virCapsPtr caps;
-    virDomainXMLOptionPtr xmlopt;
-    unsigned int flags;
-};
-
-static int
-virDomainSnapshotFormatOne(void *payload,
-                           const void *name ATTRIBUTE_UNUSED,
-                           void *opaque)
-{
-    virDomainMomentObjPtr snap = payload;
-    struct virDomainSnapshotFormatData *data = opaque;
-    return virDomainSnapshotDefFormatInternal(data->buf, data->uuidstr,
-                                              virDomainSnapshotObjGetDef(snap),
-                                              data->caps, data->xmlopt,
-                                              data->flags);
-}
-
-
-/* Format the XML for all snapshots in the list into buf. @flags is
- * virDomainSnapshotFormatFlags. On error, clear the buffer and return
- * -1. */
-int
-virDomainSnapshotObjListFormat(virBufferPtr buf,
-                               const char *uuidstr,
-                               virDomainSnapshotObjListPtr snapshots,
-                               virCapsPtr caps,
-                               virDomainXMLOptionPtr xmlopt,
-                               unsigned int flags)
-{
-    struct virDomainSnapshotFormatData data = {
-        .buf = buf,
-        .uuidstr = uuidstr,
-        .caps = caps,
-        .xmlopt = xmlopt,
-        .flags = flags,
-    };
-
-    virCheckFlags(VIR_DOMAIN_SNAPSHOT_FORMAT_SECURE, -1);
-    virBufferAddLit(buf, "<snapshots");
-    virBufferEscapeString(buf, " current='%s'",
-                          virDomainSnapshotGetCurrentName(snapshots));
-    virBufferAddLit(buf, ">\n");
-    virBufferAdjustIndent(buf, 2);
-    if (virDomainSnapshotForEach(snapshots, virDomainSnapshotFormatOne,
-                                 &data) < 0) {
-        virBufferFreeAndReset(buf);
-        return -1;
-    }
-    virBufferAdjustIndent(buf, -2);
-    virBufferAddLit(buf, "</snapshots>\n");
-    return 0;
-}
-
-
 virDomainMomentObjPtr
 virDomainSnapshotAssignDef(virDomainSnapshotObjListPtr snapshots,
                            virDomainSnapshotDefPtr def)
index 626cdcafa76c421a6ea45b7bb5153ae109f913b4..38d34ea010ef1adbc7adc2361223a31cfae19bf4 100644 (file)
 virDomainSnapshotObjListPtr virDomainSnapshotObjListNew(void);
 void virDomainSnapshotObjListFree(virDomainSnapshotObjListPtr snapshots);
 
-int virDomainSnapshotObjListFormat(virBufferPtr buf,
-                                   const char *uuidstr,
-                                   virDomainSnapshotObjListPtr snapshots,
-                                   virCapsPtr caps,
-                                   virDomainXMLOptionPtr xmlopt,
-                                   unsigned int flags);
-
 virDomainMomentObjPtr virDomainSnapshotAssignDef(virDomainSnapshotObjListPtr snapshots,
                                                  virDomainSnapshotDefPtr def);
 
index 03b4db98fe71f200ad0bb8fd097a19d32fa698a9..80abbfd0ce32d9b7d616ade916907f0bcb2bff62 100644 (file)
@@ -996,7 +996,6 @@ virDomainSnapshotForEach;
 virDomainSnapshotGetCurrent;
 virDomainSnapshotGetCurrentName;
 virDomainSnapshotIsCurrentName;
-virDomainSnapshotObjListFormat;
 virDomainSnapshotObjListFree;
 virDomainSnapshotObjListGetNames;
 virDomainSnapshotObjListNew;