mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-21 19:02:25 +00:00
Revert "snapshot: Add virDomainSnapshotObjListFormat"
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>
This commit is contained in:
parent
57d252c740
commit
0b4fac6afd
@ -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,
|
||||
|
@ -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);
|
||||
|
@ -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)
|
||||
|
@ -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);
|
||||
|
||||
|
@ -996,7 +996,6 @@ virDomainSnapshotForEach;
|
||||
virDomainSnapshotGetCurrent;
|
||||
virDomainSnapshotGetCurrentName;
|
||||
virDomainSnapshotIsCurrentName;
|
||||
virDomainSnapshotObjListFormat;
|
||||
virDomainSnapshotObjListFree;
|
||||
virDomainSnapshotObjListGetNames;
|
||||
virDomainSnapshotObjListNew;
|
||||
|
Loading…
x
Reference in New Issue
Block a user