[PATCH v6 2/9] Revert "snapshot: Add virDomainSnapshotObjListFormat"

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

 



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@xxxxxxxxxx>
---
 src/conf/snapshot_conf.h            |  7 ----
 src/conf/virdomainsnapshotobjlist.h |  7 ----
 src/conf/snapshot_conf.c            |  2 +-
 src/conf/virdomainsnapshotobjlist.c | 61 -----------------------------
 src/libvirt_private.syms            |  1 -
 5 files changed, 1 insertion(+), 77 deletions(-)

diff --git a/src/conf/snapshot_conf.h b/src/conf/snapshot_conf.h
index d082ffbad0..cc8f384bf7 100644
--- a/src/conf/snapshot_conf.h
+++ b/src/conf/snapshot_conf.h
@@ -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);
diff --git a/src/conf/virdomainsnapshotobjlist.h b/src/conf/virdomainsnapshotobjlist.h
index 626cdcafa7..38d34ea010 100644
--- a/src/conf/virdomainsnapshotobjlist.h
+++ b/src/conf/virdomainsnapshotobjlist.h
@@ -30,13 +30,6 @@
 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);

diff --git a/src/conf/snapshot_conf.c b/src/conf/snapshot_conf.c
index cc3f71ab6f..4ce120451e 100644
--- a/src/conf/snapshot_conf.c
+++ b/src/conf/snapshot_conf.c
@@ -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,
diff --git a/src/conf/virdomainsnapshotobjlist.c b/src/conf/virdomainsnapshotobjlist.c
index 20f4ff22f2..04221134da 100644
--- a/src/conf/virdomainsnapshotobjlist.c
+++ b/src/conf/virdomainsnapshotobjlist.c
@@ -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)
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 03b4db98fe..80abbfd0ce 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -996,7 +996,6 @@ virDomainSnapshotForEach;
 virDomainSnapshotGetCurrent;
 virDomainSnapshotGetCurrentName;
 virDomainSnapshotIsCurrentName;
-virDomainSnapshotObjListFormat;
 virDomainSnapshotObjListFree;
 virDomainSnapshotObjListGetNames;
 virDomainSnapshotObjListNew;
-- 
2.20.1

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

  Powered by Linux