snapshot: Rename virDomainSnapshotObjPtr

Now that the core of SnapshotObj is agnostic to snapshots and can be
shared with upcoming checkpoint code, it is time to rename the struct
and the functions specific to list operations. A later patch will
shuffle which file holds the common code. This is a fairly mechanical
patch.

Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
This commit is contained in:
Eric Blake 2019-03-21 23:45:25 -05:00
parent 1ab05da228
commit e055a816af
18 changed files with 251 additions and 251 deletions

View File

@ -431,7 +431,7 @@ virDomainSnapshotDefParseString(const char *xmlStr,
int
virDomainSnapshotRedefineValidate(virDomainSnapshotDefPtr def,
const unsigned char *domain_uuid,
virDomainSnapshotObjPtr other,
virDomainMomentObjPtr other,
virDomainXMLOptionPtr xmlopt,
unsigned int flags)
{
@ -911,7 +911,7 @@ virDomainSnapshotDefIsExternal(virDomainSnapshotDefPtr def)
}
bool
virDomainSnapshotIsExternal(virDomainSnapshotObjPtr snap)
virDomainSnapshotIsExternal(virDomainMomentObjPtr snap)
{
virDomainSnapshotDefPtr def = virDomainSnapshotObjGetDef(snap);
@ -922,13 +922,13 @@ int
virDomainSnapshotRedefinePrep(virDomainPtr domain,
virDomainObjPtr vm,
virDomainSnapshotDefPtr *defptr,
virDomainSnapshotObjPtr *snap,
virDomainMomentObjPtr *snap,
virDomainXMLOptionPtr xmlopt,
bool *update_current,
unsigned int flags)
{
virDomainSnapshotDefPtr def = *defptr;
virDomainSnapshotObjPtr other;
virDomainMomentObjPtr other;
virDomainSnapshotDefPtr otherdef;
bool check_if_stolen;
@ -983,7 +983,7 @@ virDomainSnapshotRedefinePrep(virDomainPtr domain,
/* Drop and rebuild the parent relationship, but keep all
* child relations by reusing snap. */
virDomainSnapshotDropParent(other);
virDomainMomentDropParent(other);
virDomainSnapshotDefFree(otherdef);
other->def = &(*defptr)->common;
*defptr = NULL;

View File

@ -131,19 +131,19 @@ int virDomainSnapshotAlignDisks(virDomainSnapshotDefPtr snapshot,
bool require_match);
bool virDomainSnapshotDefIsExternal(virDomainSnapshotDefPtr def);
bool virDomainSnapshotIsExternal(virDomainSnapshotObjPtr snap);
bool virDomainSnapshotIsExternal(virDomainMomentObjPtr snap);
int virDomainSnapshotRedefinePrep(virDomainPtr domain,
virDomainObjPtr vm,
virDomainSnapshotDefPtr *def,
virDomainSnapshotObjPtr *snap,
virDomainMomentObjPtr *snap,
virDomainXMLOptionPtr xmlopt,
bool *update_current,
unsigned int flags);
int virDomainSnapshotRedefineValidate(virDomainSnapshotDefPtr def,
const unsigned char *domain_uuid,
virDomainSnapshotObjPtr other,
virDomainMomentObjPtr other,
virDomainXMLOptionPtr xmlopt,
unsigned int flags);

View File

@ -220,6 +220,9 @@ typedef virDomainMemtune *virDomainMemtunePtr;
typedef struct _virDomainMomentDef virDomainMomentDef;
typedef virDomainMomentDef *virDomainMomentDefPtr;
typedef struct _virDomainMomentObj virDomainMomentObj;
typedef virDomainMomentObj *virDomainMomentObjPtr;
typedef struct _virDomainNVRAMDef virDomainNVRAMDef;
typedef virDomainNVRAMDef *virDomainNVRAMDefPtr;
@ -280,9 +283,6 @@ typedef virDomainSmartcardDef *virDomainSmartcardDefPtr;
typedef struct _virDomainSnapshotDef virDomainSnapshotDef;
typedef virDomainSnapshotDef *virDomainSnapshotDefPtr;
typedef struct _virDomainSnapshotObj virDomainSnapshotObj;
typedef virDomainSnapshotObj *virDomainSnapshotObjPtr;
typedef struct _virDomainSnapshotObjList virDomainSnapshotObjList;
typedef virDomainSnapshotObjList *virDomainSnapshotObjListPtr;

View File

@ -33,80 +33,80 @@
VIR_LOG_INIT("conf.virdomainsnapshotobj");
/* Run iter(data) on all direct children of snapshot, while ignoring all
* other entries in snapshots. Return the number of children
/* Run iter(data) on all direct children of moment, while ignoring all
* other entries in moments. Return the number of children
* visited. No particular ordering is guaranteed. */
int
virDomainSnapshotForEachChild(virDomainSnapshotObjPtr snapshot,
virHashIterator iter,
void *data)
virDomainMomentForEachChild(virDomainMomentObjPtr moment,
virHashIterator iter,
void *data)
{
virDomainSnapshotObjPtr child = snapshot->first_child;
virDomainMomentObjPtr child = moment->first_child;
while (child) {
virDomainSnapshotObjPtr next = child->sibling;
virDomainMomentObjPtr next = child->sibling;
(iter)(child, child->def->name, data);
child = next;
}
return snapshot->nchildren;
return moment->nchildren;
}
struct snapshot_act_on_descendant {
struct moment_act_on_descendant {
int number;
virHashIterator iter;
void *data;
};
static int
virDomainSnapshotActOnDescendant(void *payload,
const void *name,
void *data)
virDomainMomentActOnDescendant(void *payload,
const void *name,
void *data)
{
virDomainSnapshotObjPtr obj = payload;
struct snapshot_act_on_descendant *curr = data;
virDomainMomentObjPtr obj = payload;
struct moment_act_on_descendant *curr = data;
(curr->iter)(payload, name, curr->data);
curr->number += 1 + virDomainSnapshotForEachDescendant(obj,
curr->number += 1 + virDomainMomentForEachDescendant(obj,
curr->iter,
curr->data);
return 0;
}
/* Run iter(data) on all descendants of snapshot, while ignoring all
* other entries in snapshots. Return the number of descendants
/* Run iter(data) on all descendants of moment, while ignoring all
* other entries in moments. Return the number of descendants
* visited. The visit is guaranteed to be topological, but no
* particular order between siblings is guaranteed. */
int
virDomainSnapshotForEachDescendant(virDomainSnapshotObjPtr snapshot,
virHashIterator iter,
void *data)
virDomainMomentForEachDescendant(virDomainMomentObjPtr moment,
virHashIterator iter,
void *data)
{
struct snapshot_act_on_descendant act;
struct moment_act_on_descendant act;
act.number = 0;
act.iter = iter;
act.data = data;
virDomainSnapshotForEachChild(snapshot,
virDomainSnapshotActOnDescendant, &act);
virDomainMomentForEachChild(moment,
virDomainMomentActOnDescendant, &act);
return act.number;
}
/* Prepare to reparent or delete snapshot, by removing it from its
/* Prepare to reparent or delete moment, by removing it from its
* current listed parent. Note that when bulk removing all children
* of a parent, it is faster to just 0 the count rather than calling
* this function on each child. */
void
virDomainSnapshotDropParent(virDomainSnapshotObjPtr snapshot)
virDomainMomentDropParent(virDomainMomentObjPtr moment)
{
virDomainSnapshotObjPtr prev = NULL;
virDomainSnapshotObjPtr curr = NULL;
virDomainMomentObjPtr prev = NULL;
virDomainMomentObjPtr curr = NULL;
snapshot->parent->nchildren--;
curr = snapshot->parent->first_child;
while (curr != snapshot) {
moment->parent->nchildren--;
curr = moment->parent->first_child;
while (curr != moment) {
if (!curr) {
VIR_WARN("inconsistent snapshot relations");
return;
@ -115,42 +115,42 @@ virDomainSnapshotDropParent(virDomainSnapshotObjPtr snapshot)
curr = curr->sibling;
}
if (prev)
prev->sibling = snapshot->sibling;
prev->sibling = moment->sibling;
else
snapshot->parent->first_child = snapshot->sibling;
snapshot->parent = NULL;
snapshot->sibling = NULL;
moment->parent->first_child = moment->sibling;
moment->parent = NULL;
moment->sibling = NULL;
}
/* Update @snapshot to no longer have children. */
/* Update @moment to no longer have children. */
void
virDomainSnapshotDropChildren(virDomainSnapshotObjPtr snapshot)
virDomainMomentDropChildren(virDomainMomentObjPtr moment)
{
snapshot->nchildren = 0;
snapshot->first_child = NULL;
moment->nchildren = 0;
moment->first_child = NULL;
}
/* Add @snapshot to @parent's list of children. */
/* Add @moment to @parent's list of children. */
void
virDomainSnapshotSetParent(virDomainSnapshotObjPtr snapshot,
virDomainSnapshotObjPtr parent)
virDomainMomentSetParent(virDomainMomentObjPtr moment,
virDomainMomentObjPtr parent)
{
snapshot->parent = parent;
moment->parent = parent;
parent->nchildren++;
snapshot->sibling = parent->first_child;
parent->first_child = snapshot;
moment->sibling = parent->first_child;
parent->first_child = moment;
}
/* Take all children of @from and convert them into children of @to. */
void
virDomainSnapshotMoveChildren(virDomainSnapshotObjPtr from,
virDomainSnapshotObjPtr to)
virDomainMomentMoveChildren(virDomainMomentObjPtr from,
virDomainMomentObjPtr to)
{
virDomainSnapshotObjPtr child;
virDomainSnapshotObjPtr last;
virDomainMomentObjPtr child;
virDomainMomentObjPtr last;
if (!from->first_child)
return;

View File

@ -27,29 +27,29 @@
# include "virconftypes.h"
# include "virhash.h"
struct _virDomainSnapshotObj {
struct _virDomainMomentObj {
virDomainMomentDefPtr def; /* non-NULL except for metaroot */
virDomainSnapshotObjPtr parent; /* non-NULL except for metaroot, before
virDomainSnapshotUpdateRelations, or
after virDomainSnapshotDropParent */
virDomainSnapshotObjPtr sibling; /* NULL if last child of parent */
virDomainMomentObjPtr parent; /* non-NULL except for metaroot, before
virDomainSnapshotUpdateRelations, or
after virDomainMomentDropParent */
virDomainMomentObjPtr sibling; /* NULL if last child of parent */
size_t nchildren;
virDomainSnapshotObjPtr first_child; /* NULL if no children */
virDomainMomentObjPtr first_child; /* NULL if no children */
};
int virDomainSnapshotForEachChild(virDomainSnapshotObjPtr snapshot,
virHashIterator iter,
void *data);
int virDomainSnapshotForEachDescendant(virDomainSnapshotObjPtr snapshot,
virHashIterator iter,
void *data);
void virDomainSnapshotDropParent(virDomainSnapshotObjPtr snapshot);
void virDomainSnapshotDropChildren(virDomainSnapshotObjPtr snapshot);
void virDomainSnapshotMoveChildren(virDomainSnapshotObjPtr from,
virDomainSnapshotObjPtr to);
void virDomainSnapshotSetParent(virDomainSnapshotObjPtr snapshot,
virDomainSnapshotObjPtr parent);
int virDomainMomentForEachChild(virDomainMomentObjPtr moment,
virHashIterator iter,
void *data);
int virDomainMomentForEachDescendant(virDomainMomentObjPtr moment,
virHashIterator iter,
void *data);
void virDomainMomentDropParent(virDomainMomentObjPtr moment);
void virDomainMomentDropChildren(virDomainMomentObjPtr moment);
void virDomainMomentMoveChildren(virDomainMomentObjPtr from,
virDomainMomentObjPtr to);
void virDomainMomentSetParent(virDomainMomentObjPtr moment,
virDomainMomentObjPtr parent);
#endif /* LIBVIRT_VIRDOMAINSNAPSHOTOBJ_H */

View File

@ -35,12 +35,12 @@
VIR_LOG_INIT("conf.virdomainsnapshotobjlist");
struct _virDomainSnapshotObjList {
/* name string -> virDomainSnapshotObj mapping
/* name string -> virDomainMomentObj mapping
* for O(1), lockless lookup-by-name */
virHashTable *objs;
virDomainSnapshotObj metaroot; /* Special parent of all root snapshots */
virDomainSnapshotObjPtr current; /* The current snapshot, if any */
virDomainMomentObj metaroot; /* Special parent of all root snapshots */
virDomainMomentObjPtr current; /* The current snapshot, if any */
};
@ -64,7 +64,7 @@ virDomainSnapshotObjListParse(const char *xmlStr,
int n;
size_t i;
int keepBlanksDefault = xmlKeepBlanksDefault(0);
virDomainSnapshotObjPtr snap;
virDomainMomentObjPtr snap;
VIR_AUTOFREE(xmlNodePtr *) nodes = NULL;
VIR_AUTOFREE(char *) current = NULL;
@ -165,7 +165,7 @@ virDomainSnapshotFormatOne(void *payload,
const void *name ATTRIBUTE_UNUSED,
void *opaque)
{
virDomainSnapshotObjPtr snap = payload;
virDomainMomentObjPtr snap = payload;
struct virDomainSnapshotFormatData *data = opaque;
return virDomainSnapshotDefFormatInternal(data->buf, data->uuidstr,
virDomainSnapshotObjGetDef(snap),
@ -211,9 +211,9 @@ virDomainSnapshotObjListFormat(virBufferPtr buf,
/* Snapshot Obj functions */
static virDomainSnapshotObjPtr virDomainSnapshotObjNew(void)
static virDomainMomentObjPtr virDomainMomentObjNew(void)
{
virDomainSnapshotObjPtr snapshot;
virDomainMomentObjPtr snapshot;
if (VIR_ALLOC(snapshot) < 0)
return NULL;
@ -223,7 +223,7 @@ static virDomainSnapshotObjPtr virDomainSnapshotObjNew(void)
return snapshot;
}
static void virDomainSnapshotObjFree(virDomainSnapshotObjPtr snapshot)
static void virDomainMomentObjFree(virDomainMomentObjPtr snapshot)
{
if (!snapshot)
return;
@ -234,10 +234,10 @@ static void virDomainSnapshotObjFree(virDomainSnapshotObjPtr snapshot)
VIR_FREE(snapshot);
}
virDomainSnapshotObjPtr virDomainSnapshotAssignDef(virDomainSnapshotObjListPtr snapshots,
virDomainSnapshotDefPtr def)
virDomainMomentObjPtr virDomainSnapshotAssignDef(virDomainSnapshotObjListPtr snapshots,
virDomainSnapshotDefPtr def)
{
virDomainSnapshotObjPtr snap;
virDomainMomentObjPtr snap;
if (virHashLookup(snapshots->objs, def->common.name) != NULL) {
virReportError(VIR_ERR_INTERNAL_ERROR,
@ -246,7 +246,7 @@ virDomainSnapshotObjPtr virDomainSnapshotAssignDef(virDomainSnapshotObjListPtr s
return NULL;
}
if (!(snap = virDomainSnapshotObjNew()))
if (!(snap = virDomainMomentObjNew()))
return NULL;
if (virHashAddEntry(snapshots->objs, snap->def->name, snap) < 0) {
@ -260,7 +260,7 @@ virDomainSnapshotObjPtr virDomainSnapshotAssignDef(virDomainSnapshotObjListPtr s
/* Snapshot Obj List functions */
static bool
virDomainSnapshotFilter(virDomainSnapshotObjPtr obj,
virDomainSnapshotFilter(virDomainMomentObjPtr obj,
unsigned int flags)
{
virDomainSnapshotDefPtr def = virDomainSnapshotObjGetDef(obj);
@ -295,9 +295,9 @@ static void
virDomainSnapshotObjListDataFree(void *payload,
const void *name ATTRIBUTE_UNUSED)
{
virDomainSnapshotObjPtr obj = payload;
virDomainMomentObjPtr obj = payload;
virDomainSnapshotObjFree(obj);
virDomainMomentObjFree(obj);
}
virDomainSnapshotObjListPtr
@ -324,21 +324,21 @@ virDomainSnapshotObjListFree(virDomainSnapshotObjListPtr snapshots)
}
struct virDomainSnapshotNameData {
struct virDomainMomentNameData {
char **const names;
int maxnames;
unsigned int flags;
int count;
bool error;
virDomainSnapshotObjListFilter filter;
virDomainMomentObjListFilter filter;
};
static int virDomainSnapshotObjListCopyNames(void *payload,
const void *name ATTRIBUTE_UNUSED,
void *opaque)
static int virDomainMomentObjListCopyNames(void *payload,
const void *name ATTRIBUTE_UNUSED,
void *opaque)
{
virDomainSnapshotObjPtr obj = payload;
struct virDomainSnapshotNameData *data = opaque;
virDomainMomentObjPtr obj = payload;
struct virDomainMomentNameData *data = opaque;
if (data->error)
return 0;
@ -363,13 +363,13 @@ static int virDomainSnapshotObjListCopyNames(void *payload,
int
virDomainSnapshotObjListGetNames(virDomainSnapshotObjListPtr snapshots,
virDomainSnapshotObjPtr from,
virDomainMomentObjPtr from,
char **const names,
int maxnames,
unsigned int flags)
{
struct virDomainSnapshotNameData data = { names, maxnames, flags, 0,
false, virDomainSnapshotFilter };
struct virDomainMomentNameData data = { names, maxnames, flags, 0,
false, virDomainSnapshotFilter };
size_t i;
if (!from) {
@ -413,17 +413,17 @@ virDomainSnapshotObjListGetNames(virDomainSnapshotObjListPtr snapshots,
* simpler full hashtable visit or counter will do. */
if (from->def || (names &&
(flags & VIR_DOMAIN_SNAPSHOT_LIST_TOPOLOGICAL)))
virDomainSnapshotForEachDescendant(from,
virDomainSnapshotObjListCopyNames,
&data);
virDomainMomentForEachDescendant(from,
virDomainMomentObjListCopyNames,
&data);
else if (names || data.flags)
virHashForEach(snapshots->objs, virDomainSnapshotObjListCopyNames,
virHashForEach(snapshots->objs, virDomainMomentObjListCopyNames,
&data);
else
data.count = virHashSize(snapshots->objs);
} else if (names || data.flags) {
virDomainSnapshotForEachChild(from,
virDomainSnapshotObjListCopyNames, &data);
virDomainMomentForEachChild(from,
virDomainMomentObjListCopyNames, &data);
} else {
data.count = from->nchildren;
}
@ -439,13 +439,13 @@ virDomainSnapshotObjListGetNames(virDomainSnapshotObjListPtr snapshots,
int
virDomainSnapshotObjListNum(virDomainSnapshotObjListPtr snapshots,
virDomainSnapshotObjPtr from,
virDomainMomentObjPtr from,
unsigned int flags)
{
return virDomainSnapshotObjListGetNames(snapshots, from, NULL, 0, flags);
}
virDomainSnapshotObjPtr
virDomainMomentObjPtr
virDomainSnapshotFindByName(virDomainSnapshotObjListPtr snapshots,
const char *name)
{
@ -462,7 +462,7 @@ virDomainSnapshotObjListSize(virDomainSnapshotObjListPtr snapshots)
/* Return the current snapshot, or NULL */
virDomainSnapshotObjPtr
virDomainMomentObjPtr
virDomainSnapshotGetCurrent(virDomainSnapshotObjListPtr snapshots)
{
return snapshots->current;
@ -491,7 +491,7 @@ virDomainSnapshotIsCurrentName(virDomainSnapshotObjListPtr snapshots,
/* Update the current snapshot, using NULL if no current remains */
void
virDomainSnapshotSetCurrent(virDomainSnapshotObjListPtr snapshots,
virDomainSnapshotObjPtr snapshot)
virDomainMomentObjPtr snapshot)
{
snapshots->current = snapshot;
}
@ -500,7 +500,7 @@ virDomainSnapshotSetCurrent(virDomainSnapshotObjListPtr snapshots,
/* Remove snapshot from the list; return true if it was current */
bool
virDomainSnapshotObjListRemove(virDomainSnapshotObjListPtr snapshots,
virDomainSnapshotObjPtr snapshot)
virDomainMomentObjPtr snapshot)
{
bool ret = snapshots->current == snapshot;
virHashRemoveEntry(snapshots->objs, snapshot->def->name);
@ -514,7 +514,7 @@ void
virDomainSnapshotObjListRemoveAll(virDomainSnapshotObjListPtr snapshots)
{
virHashRemoveAll(snapshots->objs);
virDomainSnapshotDropChildren(&snapshots->metaroot);
virDomainMomentDropChildren(&snapshots->metaroot);
}
@ -533,19 +533,19 @@ virDomainSnapshotForEach(virDomainSnapshotObjListPtr snapshots,
* wire up the hierarchical relations for the given snapshot. The error
* indicator gets set if a parent is missing or a requested parent would
* cause a circular parent chain. */
struct snapshot_set_relation {
struct moment_set_relation {
virDomainSnapshotObjListPtr snapshots;
int err;
};
static int
virDomainSnapshotSetRelations(void *payload,
const void *name ATTRIBUTE_UNUSED,
void *data)
virDomainMomentSetRelations(void *payload,
const void *name ATTRIBUTE_UNUSED,
void *data)
{
virDomainSnapshotObjPtr obj = payload;
struct snapshot_set_relation *curr = data;
virDomainSnapshotObjPtr tmp;
virDomainSnapshotObjPtr parent;
virDomainMomentObjPtr obj = payload;
struct moment_set_relation *curr = data;
virDomainMomentObjPtr tmp;
virDomainMomentObjPtr parent;
parent = virDomainSnapshotFindByName(curr->snapshots, obj->def->parent);
if (!parent) {
@ -564,7 +564,7 @@ virDomainSnapshotSetRelations(void *payload,
tmp = tmp->parent;
}
}
virDomainSnapshotSetParent(obj, parent);
virDomainMomentSetParent(obj, parent);
return 0;
}
@ -575,10 +575,10 @@ virDomainSnapshotSetRelations(void *payload,
int
virDomainSnapshotUpdateRelations(virDomainSnapshotObjListPtr snapshots)
{
struct snapshot_set_relation act = { snapshots, 0 };
struct moment_set_relation act = { snapshots, 0 };
virDomainSnapshotDropChildren(&snapshots->metaroot);
virHashForEach(snapshots->objs, virDomainSnapshotSetRelations, &act);
virDomainMomentDropChildren(&snapshots->metaroot);
virHashForEach(snapshots->objs, virDomainMomentSetRelations, &act);
if (act.err)
snapshots->current = NULL;
return act.err;
@ -587,7 +587,7 @@ virDomainSnapshotUpdateRelations(virDomainSnapshotObjListPtr snapshots)
int
virDomainListSnapshots(virDomainSnapshotObjListPtr snapshots,
virDomainSnapshotObjPtr from,
virDomainMomentObjPtr from,
virDomainPtr dom,
virDomainSnapshotPtr **snaps,
unsigned int flags)

View File

@ -27,9 +27,9 @@
# include "virdomainsnapshotobj.h"
# include "virbuffer.h"
/* Filter that returns true if a given snapshot matches the filter flags */
typedef bool (*virDomainSnapshotObjListFilter)(virDomainSnapshotObjPtr obj,
unsigned int flags);
/* Filter that returns true if a given moment matches the filter flags */
typedef bool (*virDomainMomentObjListFilter)(virDomainMomentObjPtr obj,
unsigned int flags);
virDomainSnapshotObjListPtr virDomainSnapshotObjListNew(void);
void virDomainSnapshotObjListFree(virDomainSnapshotObjListPtr snapshots);
@ -47,27 +47,27 @@ int virDomainSnapshotObjListFormat(virBufferPtr buf,
virDomainXMLOptionPtr xmlopt,
unsigned int flags);
virDomainSnapshotObjPtr virDomainSnapshotAssignDef(virDomainSnapshotObjListPtr snapshots,
virDomainSnapshotDefPtr def);
virDomainMomentObjPtr virDomainSnapshotAssignDef(virDomainSnapshotObjListPtr snapshots,
virDomainSnapshotDefPtr def);
int virDomainSnapshotObjListGetNames(virDomainSnapshotObjListPtr snapshots,
virDomainSnapshotObjPtr from,
virDomainMomentObjPtr from,
char **const names, int maxnames,
unsigned int flags);
int virDomainSnapshotObjListNum(virDomainSnapshotObjListPtr snapshots,
virDomainSnapshotObjPtr from,
virDomainMomentObjPtr from,
unsigned int flags);
virDomainSnapshotObjPtr virDomainSnapshotFindByName(virDomainSnapshotObjListPtr snapshots,
const char *name);
virDomainMomentObjPtr virDomainSnapshotFindByName(virDomainSnapshotObjListPtr snapshots,
const char *name);
int virDomainSnapshotObjListSize(virDomainSnapshotObjListPtr snapshots);
virDomainSnapshotObjPtr virDomainSnapshotGetCurrent(virDomainSnapshotObjListPtr snapshots);
virDomainMomentObjPtr virDomainSnapshotGetCurrent(virDomainSnapshotObjListPtr snapshots);
const char *virDomainSnapshotGetCurrentName(virDomainSnapshotObjListPtr snapshots);
bool virDomainSnapshotIsCurrentName(virDomainSnapshotObjListPtr snapshots,
const char *name);
void virDomainSnapshotSetCurrent(virDomainSnapshotObjListPtr snapshots,
virDomainSnapshotObjPtr snapshot);
virDomainMomentObjPtr snapshot);
bool virDomainSnapshotObjListRemove(virDomainSnapshotObjListPtr snapshots,
virDomainSnapshotObjPtr snapshot);
virDomainMomentObjPtr snapshot);
void virDomainSnapshotObjListRemoveAll(virDomainSnapshotObjListPtr snapshots);
int virDomainSnapshotForEach(virDomainSnapshotObjListPtr snapshots,
virHashIterator iter,
@ -98,14 +98,14 @@ int virDomainSnapshotUpdateRelations(virDomainSnapshotObjListPtr snapshots);
VIR_DOMAIN_SNAPSHOT_FILTERS_LOCATION)
int virDomainListSnapshots(virDomainSnapshotObjListPtr snapshots,
virDomainSnapshotObjPtr from,
virDomainMomentObjPtr from,
virDomainPtr dom,
virDomainSnapshotPtr **snaps,
unsigned int flags);
/* Access the snapshot-specific definition from a given list member. */
static inline virDomainSnapshotDefPtr
virDomainSnapshotObjGetDef(virDomainSnapshotObjPtr obj)
virDomainSnapshotObjGetDef(virDomainMomentObjPtr obj)
{
return (virDomainSnapshotDefPtr) obj->def;
}

View File

@ -980,12 +980,12 @@ virDomainObjListRename;
# conf/virdomainsnapshotobj.h
virDomainSnapshotDropChildren;
virDomainSnapshotDropParent;
virDomainSnapshotForEachChild;
virDomainSnapshotForEachDescendant;
virDomainSnapshotMoveChildren;
virDomainSnapshotSetParent;
virDomainMomentDropChildren;
virDomainMomentDropParent;
virDomainMomentForEachChild;
virDomainMomentForEachDescendant;
virDomainMomentMoveChildren;
virDomainMomentSetParent;
# conf/virdomainsnapshotobjlist.h

View File

@ -10632,7 +10632,7 @@ qemuBuildCommandLine(virQEMUDriverPtr driver,
virSecurityManagerPtr secManager,
virDomainObjPtr vm,
const char *migrateURI,
virDomainSnapshotObjPtr snapshot,
virDomainMomentObjPtr snapshot,
virNetDevVPortProfileOp vmop,
bool standalone,
bool enableFips,

View File

@ -47,7 +47,7 @@ virCommandPtr qemuBuildCommandLine(virQEMUDriverPtr driver,
virSecurityManagerPtr secManager,
virDomainObjPtr vm,
const char *migrateURI,
virDomainSnapshotObjPtr snapshot,
virDomainMomentObjPtr snapshot,
virNetDevVPortProfileOp vmop,
bool standalone,
bool enableFips,

View File

@ -8448,7 +8448,7 @@ qemuFindQemuImgBinary(virQEMUDriverPtr driver)
int
qemuDomainSnapshotWriteMetadata(virDomainObjPtr vm,
virDomainSnapshotObjPtr snapshot,
virDomainMomentObjPtr snapshot,
virCapsPtr caps,
virDomainXMLOptionPtr xmlopt,
const char *snapshotDir)
@ -8566,7 +8566,7 @@ qemuDomainSnapshotForEachQcow2Raw(virQEMUDriverPtr driver,
int
qemuDomainSnapshotForEachQcow2(virQEMUDriverPtr driver,
virDomainObjPtr vm,
virDomainSnapshotObjPtr snap,
virDomainMomentObjPtr snap,
const char *op,
bool try_all)
{
@ -8585,14 +8585,14 @@ qemuDomainSnapshotForEachQcow2(virQEMUDriverPtr driver,
int
qemuDomainSnapshotDiscard(virQEMUDriverPtr driver,
virDomainObjPtr vm,
virDomainSnapshotObjPtr snap,
virDomainMomentObjPtr snap,
bool update_parent,
bool metadata_only)
{
char *snapFile = NULL;
int ret = -1;
qemuDomainObjPrivatePtr priv;
virDomainSnapshotObjPtr parentsnap = NULL;
virDomainMomentObjPtr parentsnap = NULL;
virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
if (!metadata_only) {
@ -8638,7 +8638,7 @@ qemuDomainSnapshotDiscard(virQEMUDriverPtr driver,
if (unlink(snapFile) < 0)
VIR_WARN("Failed to unlink %s", snapFile);
if (update_parent)
virDomainSnapshotDropParent(snap);
virDomainMomentDropParent(snap);
virDomainSnapshotObjListRemove(vm->snapshots, snap);
ret = 0;
@ -8654,7 +8654,7 @@ int qemuDomainSnapshotDiscardAll(void *payload,
const void *name ATTRIBUTE_UNUSED,
void *data)
{
virDomainSnapshotObjPtr snap = payload;
virDomainMomentObjPtr snap = payload;
virQEMUSnapRemovePtr curr = data;
int err;

View File

@ -681,20 +681,20 @@ int qemuDomainLogAppendMessage(virQEMUDriverPtr driver,
const char *qemuFindQemuImgBinary(virQEMUDriverPtr driver);
int qemuDomainSnapshotWriteMetadata(virDomainObjPtr vm,
virDomainSnapshotObjPtr snapshot,
virDomainMomentObjPtr snapshot,
virCapsPtr caps,
virDomainXMLOptionPtr xmlopt,
const char *snapshotDir);
int qemuDomainSnapshotForEachQcow2(virQEMUDriverPtr driver,
virDomainObjPtr vm,
virDomainSnapshotObjPtr snap,
virDomainMomentObjPtr snap,
const char *op,
bool try_all);
int qemuDomainSnapshotDiscard(virQEMUDriverPtr driver,
virDomainObjPtr vm,
virDomainSnapshotObjPtr snap,
virDomainMomentObjPtr snap,
bool update_current,
bool metadata_only);

View File

@ -198,11 +198,11 @@ qemuDomObjFromSnapshot(virDomainSnapshotPtr snapshot)
/* Looks up snapshot object from VM and name */
static virDomainSnapshotObjPtr
static virDomainMomentObjPtr
qemuSnapObjFromName(virDomainObjPtr vm,
const char *name)
{
virDomainSnapshotObjPtr snap = NULL;
virDomainMomentObjPtr snap = NULL;
snap = virDomainSnapshotFindByName(vm->snapshots, name);
if (!snap)
virReportError(VIR_ERR_NO_DOMAIN_SNAPSHOT,
@ -214,7 +214,7 @@ qemuSnapObjFromName(virDomainObjPtr vm,
/* Looks up snapshot object from VM and snapshotPtr */
static virDomainSnapshotObjPtr
static virDomainMomentObjPtr
qemuSnapObjFromSnapshot(virDomainObjPtr vm,
virDomainSnapshotPtr snapshot)
{
@ -417,8 +417,8 @@ qemuDomainSnapshotLoad(virDomainObjPtr vm,
char *xmlStr;
char *fullpath;
virDomainSnapshotDefPtr def = NULL;
virDomainSnapshotObjPtr snap = NULL;
virDomainSnapshotObjPtr current = NULL;
virDomainMomentObjPtr snap = NULL;
virDomainMomentObjPtr current = NULL;
bool cur;
unsigned int flags = (VIR_DOMAIN_SNAPSHOT_PARSE_REDEFINE |
VIR_DOMAIN_SNAPSHOT_PARSE_DISKS |
@ -2140,7 +2140,7 @@ qemuDomainSnapshotCountExternal(void *payload,
const void *name ATTRIBUTE_UNUSED,
void *data)
{
virDomainSnapshotObjPtr snap = payload;
virDomainMomentObjPtr snap = payload;
int *count = data;
if (virDomainSnapshotIsExternal(snap))
@ -14513,7 +14513,7 @@ qemuDomainSnapshotFSThaw(virQEMUDriverPtr driver ATTRIBUTE_UNUSED,
static int
qemuDomainSnapshotCreateInactiveInternal(virQEMUDriverPtr driver,
virDomainObjPtr vm,
virDomainSnapshotObjPtr snap)
virDomainMomentObjPtr snap)
{
return qemuDomainSnapshotForEachQcow2(driver, vm, snap, "-c", false);
}
@ -14523,7 +14523,7 @@ qemuDomainSnapshotCreateInactiveInternal(virQEMUDriverPtr driver,
static int
qemuDomainSnapshotCreateInactiveExternal(virQEMUDriverPtr driver,
virDomainObjPtr vm,
virDomainSnapshotObjPtr snap,
virDomainMomentObjPtr snap,
bool reuse)
{
size_t i;
@ -14630,7 +14630,7 @@ qemuDomainSnapshotCreateInactiveExternal(virQEMUDriverPtr driver,
static int
qemuDomainSnapshotCreateActiveInternal(virQEMUDriverPtr driver,
virDomainObjPtr vm,
virDomainSnapshotObjPtr snap,
virDomainMomentObjPtr snap,
unsigned int flags)
{
qemuDomainObjPrivatePtr priv = vm->privateData;
@ -15176,7 +15176,7 @@ qemuDomainSnapshotDiskDataFree(qemuDomainSnapshotDiskDataPtr data,
static qemuDomainSnapshotDiskDataPtr
qemuDomainSnapshotDiskDataCollect(virQEMUDriverPtr driver,
virDomainObjPtr vm,
virDomainSnapshotObjPtr snap,
virDomainMomentObjPtr snap,
bool reuse)
{
size_t i;
@ -15333,7 +15333,7 @@ qemuDomainSnapshotCreateSingleDiskActive(virQEMUDriverPtr driver,
static int
qemuDomainSnapshotCreateDiskActive(virQEMUDriverPtr driver,
virDomainObjPtr vm,
virDomainSnapshotObjPtr snap,
virDomainMomentObjPtr snap,
unsigned int flags,
qemuDomainAsyncJob asyncJob)
{
@ -15462,7 +15462,7 @@ qemuDomainSnapshotCreateDiskActive(virQEMUDriverPtr driver,
static int
qemuDomainSnapshotCreateActiveExternal(virQEMUDriverPtr driver,
virDomainObjPtr vm,
virDomainSnapshotObjPtr snap,
virDomainMomentObjPtr snap,
unsigned int flags)
{
virObjectEventPtr event;
@ -15660,14 +15660,14 @@ qemuDomainSnapshotCreateXML(virDomainPtr domain,
virQEMUDriverPtr driver = domain->conn->privateData;
virDomainObjPtr vm = NULL;
char *xml = NULL;
virDomainSnapshotObjPtr snap = NULL;
virDomainMomentObjPtr snap = NULL;
virDomainSnapshotPtr snapshot = NULL;
virDomainSnapshotDefPtr def = NULL;
virDomainSnapshotObjPtr current = NULL;
virDomainMomentObjPtr current = NULL;
bool update_current = true;
bool redefine = flags & VIR_DOMAIN_SNAPSHOT_CREATE_REDEFINE;
unsigned int parse_flags = VIR_DOMAIN_SNAPSHOT_PARSE_DISKS;
virDomainSnapshotObjPtr other = NULL;
virDomainMomentObjPtr other = NULL;
int align_location = VIR_DOMAIN_SNAPSHOT_LOCATION_INTERNAL;
bool align_match = true;
virQEMUDriverConfigPtr cfg = NULL;
@ -15931,7 +15931,7 @@ qemuDomainSnapshotCreateXML(virDomainPtr domain,
} else {
other = virDomainSnapshotFindByName(vm->snapshots,
snap->def->parent);
virDomainSnapshotSetParent(snap, other);
virDomainMomentSetParent(snap, other);
}
} else if (snap) {
virDomainSnapshotObjListRemove(vm->snapshots, snap);
@ -16035,7 +16035,7 @@ qemuDomainSnapshotListChildrenNames(virDomainSnapshotPtr snapshot,
unsigned int flags)
{
virDomainObjPtr vm = NULL;
virDomainSnapshotObjPtr snap = NULL;
virDomainMomentObjPtr snap = NULL;
int n = -1;
virCheckFlags(VIR_DOMAIN_SNAPSHOT_LIST_DESCENDANTS |
@ -16065,7 +16065,7 @@ qemuDomainSnapshotNumChildren(virDomainSnapshotPtr snapshot,
unsigned int flags)
{
virDomainObjPtr vm = NULL;
virDomainSnapshotObjPtr snap = NULL;
virDomainMomentObjPtr snap = NULL;
int n = -1;
virCheckFlags(VIR_DOMAIN_SNAPSHOT_LIST_DESCENDANTS |
@ -16095,7 +16095,7 @@ qemuDomainSnapshotListAllChildren(virDomainSnapshotPtr snapshot,
unsigned int flags)
{
virDomainObjPtr vm = NULL;
virDomainSnapshotObjPtr snap = NULL;
virDomainMomentObjPtr snap = NULL;
int n = -1;
virCheckFlags(VIR_DOMAIN_SNAPSHOT_LIST_DESCENDANTS |
@ -16126,7 +16126,7 @@ qemuDomainSnapshotLookupByName(virDomainPtr domain,
unsigned int flags)
{
virDomainObjPtr vm;
virDomainSnapshotObjPtr snap = NULL;
virDomainMomentObjPtr snap = NULL;
virDomainSnapshotPtr snapshot = NULL;
virCheckFlags(0, NULL);
@ -16176,7 +16176,7 @@ qemuDomainSnapshotGetParent(virDomainSnapshotPtr snapshot,
unsigned int flags)
{
virDomainObjPtr vm;
virDomainSnapshotObjPtr snap = NULL;
virDomainMomentObjPtr snap = NULL;
virDomainSnapshotPtr parent = NULL;
virCheckFlags(0, NULL);
@ -16241,7 +16241,7 @@ qemuDomainSnapshotGetXMLDesc(virDomainSnapshotPtr snapshot,
virQEMUDriverPtr driver = snapshot->domain->conn->privateData;
virDomainObjPtr vm = NULL;
char *xml = NULL;
virDomainSnapshotObjPtr snap = NULL;
virDomainMomentObjPtr snap = NULL;
char uuidstr[VIR_UUID_STRING_BUFLEN];
virCheckFlags(VIR_DOMAIN_SNAPSHOT_XML_SECURE, NULL);
@ -16273,7 +16273,7 @@ qemuDomainSnapshotIsCurrent(virDomainSnapshotPtr snapshot,
{
virDomainObjPtr vm = NULL;
int ret = -1;
virDomainSnapshotObjPtr snap = NULL;
virDomainMomentObjPtr snap = NULL;
virCheckFlags(0, -1);
@ -16300,7 +16300,7 @@ qemuDomainSnapshotHasMetadata(virDomainSnapshotPtr snapshot,
{
virDomainObjPtr vm = NULL;
int ret = -1;
virDomainSnapshotObjPtr snap = NULL;
virDomainMomentObjPtr snap = NULL;
virCheckFlags(0, -1);
@ -16328,7 +16328,7 @@ qemuDomainSnapshotHasMetadata(virDomainSnapshotPtr snapshot,
static int
qemuDomainSnapshotRevertInactive(virQEMUDriverPtr driver,
virDomainObjPtr vm,
virDomainSnapshotObjPtr snap)
virDomainMomentObjPtr snap)
{
/* Try all disks, but report failure if we skipped any. */
int ret = qemuDomainSnapshotForEachQcow2(driver, vm, snap, "-a", true);
@ -16343,8 +16343,8 @@ qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot,
virQEMUDriverPtr driver = snapshot->domain->conn->privateData;
virDomainObjPtr vm = NULL;
int ret = -1;
virDomainSnapshotObjPtr snap = NULL;
virDomainSnapshotObjPtr current = NULL;
virDomainMomentObjPtr snap = NULL;
virDomainMomentObjPtr current = NULL;
virDomainSnapshotDefPtr snapdef;
virObjectEventPtr event = NULL;
virObjectEventPtr event2 = NULL;
@ -16762,7 +16762,7 @@ typedef struct _virQEMUSnapReparent virQEMUSnapReparent;
typedef virQEMUSnapReparent *virQEMUSnapReparentPtr;
struct _virQEMUSnapReparent {
virQEMUDriverConfigPtr cfg;
virDomainSnapshotObjPtr parent;
virDomainMomentObjPtr parent;
virDomainObjPtr vm;
virCapsPtr caps;
virDomainXMLOptionPtr xmlopt;
@ -16775,7 +16775,7 @@ qemuDomainSnapshotReparentChildren(void *payload,
const void *name ATTRIBUTE_UNUSED,
void *data)
{
virDomainSnapshotObjPtr snap = payload;
virDomainMomentObjPtr snap = payload;
virQEMUSnapReparentPtr rep = data;
if (rep->err < 0)
@ -16803,7 +16803,7 @@ qemuDomainSnapshotDelete(virDomainSnapshotPtr snapshot,
virQEMUDriverPtr driver = snapshot->domain->conn->privateData;
virDomainObjPtr vm = NULL;
int ret = -1;
virDomainSnapshotObjPtr snap = NULL;
virDomainMomentObjPtr snap = NULL;
virQEMUSnapRemove rem;
virQEMUSnapReparent rep;
bool metadata_only = !!(flags & VIR_DOMAIN_SNAPSHOT_DELETE_METADATA_ONLY);
@ -16834,9 +16834,9 @@ qemuDomainSnapshotDelete(virDomainSnapshotPtr snapshot,
external++;
if (flags & (VIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN |
VIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN_ONLY))
virDomainSnapshotForEachDescendant(snap,
qemuDomainSnapshotCountExternal,
&external);
virDomainMomentForEachDescendant(snap,
qemuDomainSnapshotCountExternal,
&external);
if (external) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("deletion of %d external disk snapshots not "
@ -16852,9 +16852,9 @@ qemuDomainSnapshotDelete(virDomainSnapshotPtr snapshot,
rem.metadata_only = metadata_only;
rem.err = 0;
rem.current = false;
virDomainSnapshotForEachDescendant(snap,
qemuDomainSnapshotDiscardAll,
&rem);
virDomainMomentForEachDescendant(snap,
qemuDomainSnapshotDiscardAll,
&rem);
if (rem.err < 0)
goto endjob;
if (rem.current) {
@ -16878,16 +16878,16 @@ qemuDomainSnapshotDelete(virDomainSnapshotPtr snapshot,
rep.err = 0;
rep.caps = driver->caps;
rep.xmlopt = driver->xmlopt;
virDomainSnapshotForEachChild(snap,
qemuDomainSnapshotReparentChildren,
&rep);
virDomainMomentForEachChild(snap,
qemuDomainSnapshotReparentChildren,
&rep);
if (rep.err < 0)
goto endjob;
virDomainSnapshotMoveChildren(snap, snap->parent);
virDomainMomentMoveChildren(snap, snap->parent);
}
if (flags & VIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN_ONLY) {
virDomainSnapshotDropChildren(snap);
virDomainMomentDropChildren(snap);
ret = 0;
} else {
ret = qemuDomainSnapshotDiscard(driver, vm, snap, true, metadata_only);

View File

@ -6469,7 +6469,7 @@ qemuProcessLaunch(virConnectPtr conn,
virDomainObjPtr vm,
qemuDomainAsyncJob asyncJob,
qemuProcessIncomingDefPtr incoming,
virDomainSnapshotObjPtr snapshot,
virDomainMomentObjPtr snapshot,
virNetDevVPortProfileOp vmop,
unsigned int flags)
{
@ -6882,7 +6882,7 @@ qemuProcessStart(virConnectPtr conn,
const char *migrateFrom,
int migrateFd,
const char *migratePath,
virDomainSnapshotObjPtr snapshot,
virDomainMomentObjPtr snapshot,
virNetDevVPortProfileOp vmop,
unsigned int flags)
{

View File

@ -92,7 +92,7 @@ int qemuProcessStart(virConnectPtr conn,
const char *migrateFrom,
int stdin_fd,
const char *stdin_path,
virDomainSnapshotObjPtr snapshot,
virDomainMomentObjPtr snapshot,
virNetDevVPortProfileOp vmop,
unsigned int flags);
@ -125,7 +125,7 @@ int qemuProcessLaunch(virConnectPtr conn,
virDomainObjPtr vm,
qemuDomainAsyncJob asyncJob,
qemuProcessIncomingDefPtr incoming,
virDomainSnapshotObjPtr snapshot,
virDomainMomentObjPtr snapshot,
virNetDevVPortProfileOp vmop,
unsigned int flags);

View File

@ -822,7 +822,7 @@ testParseDomainSnapshots(testDriverPtr privconn,
bool cur;
for (i = 0; i < nsdata->num_snap_nodes; i++) {
virDomainSnapshotObjPtr snap;
virDomainMomentObjPtr snap;
virDomainSnapshotDefPtr def;
xmlNodePtr node = testParseXMLDocFromFile(nodes[i], file,
"domainsnapshot");
@ -5946,11 +5946,11 @@ testDomainManagedSaveRemove(virDomainPtr dom, unsigned int flags)
* Snapshot APIs
*/
static virDomainSnapshotObjPtr
static virDomainMomentObjPtr
testSnapObjFromName(virDomainObjPtr vm,
const char *name)
{
virDomainSnapshotObjPtr snap = NULL;
virDomainMomentObjPtr snap = NULL;
snap = virDomainSnapshotFindByName(vm->snapshots, name);
if (!snap)
virReportError(VIR_ERR_NO_DOMAIN_SNAPSHOT,
@ -5959,7 +5959,7 @@ testSnapObjFromName(virDomainObjPtr vm,
return snap;
}
static virDomainSnapshotObjPtr
static virDomainMomentObjPtr
testSnapObjFromSnapshot(virDomainObjPtr vm,
virDomainSnapshotPtr snapshot)
{
@ -6042,7 +6042,7 @@ testDomainSnapshotListChildrenNames(virDomainSnapshotPtr snapshot,
unsigned int flags)
{
virDomainObjPtr vm = NULL;
virDomainSnapshotObjPtr snap = NULL;
virDomainMomentObjPtr snap = NULL;
int n = -1;
virCheckFlags(VIR_DOMAIN_SNAPSHOT_LIST_DESCENDANTS |
@ -6068,7 +6068,7 @@ testDomainSnapshotNumChildren(virDomainSnapshotPtr snapshot,
unsigned int flags)
{
virDomainObjPtr vm = NULL;
virDomainSnapshotObjPtr snap = NULL;
virDomainMomentObjPtr snap = NULL;
int n = -1;
virCheckFlags(VIR_DOMAIN_SNAPSHOT_LIST_DESCENDANTS |
@ -6094,7 +6094,7 @@ testDomainSnapshotListAllChildren(virDomainSnapshotPtr snapshot,
unsigned int flags)
{
virDomainObjPtr vm = NULL;
virDomainSnapshotObjPtr snap = NULL;
virDomainMomentObjPtr snap = NULL;
int n = -1;
virCheckFlags(VIR_DOMAIN_SNAPSHOT_LIST_DESCENDANTS |
@ -6121,7 +6121,7 @@ testDomainSnapshotLookupByName(virDomainPtr domain,
unsigned int flags)
{
virDomainObjPtr vm;
virDomainSnapshotObjPtr snap = NULL;
virDomainMomentObjPtr snap = NULL;
virDomainSnapshotPtr snapshot = NULL;
virCheckFlags(0, NULL);
@ -6162,7 +6162,7 @@ testDomainSnapshotGetParent(virDomainSnapshotPtr snapshot,
unsigned int flags)
{
virDomainObjPtr vm;
virDomainSnapshotObjPtr snap = NULL;
virDomainMomentObjPtr snap = NULL;
virDomainSnapshotPtr parent = NULL;
virCheckFlags(0, NULL);
@ -6193,7 +6193,7 @@ testDomainSnapshotCurrent(virDomainPtr domain,
{
virDomainObjPtr vm;
virDomainSnapshotPtr snapshot = NULL;
virDomainSnapshotObjPtr current;
virDomainMomentObjPtr current;
virCheckFlags(0, NULL);
@ -6220,7 +6220,7 @@ testDomainSnapshotGetXMLDesc(virDomainSnapshotPtr snapshot,
{
virDomainObjPtr vm = NULL;
char *xml = NULL;
virDomainSnapshotObjPtr snap = NULL;
virDomainMomentObjPtr snap = NULL;
char uuidstr[VIR_UUID_STRING_BUFLEN];
testDriverPtr privconn = snapshot->domain->conn->privateData;
@ -6322,7 +6322,7 @@ testDomainSnapshotCreateXML(virDomainPtr domain,
testDriverPtr privconn = domain->conn->privateData;
virDomainObjPtr vm = NULL;
virDomainSnapshotDefPtr def = NULL;
virDomainSnapshotObjPtr snap = NULL;
virDomainMomentObjPtr snap = NULL;
virDomainSnapshotPtr snapshot = NULL;
virObjectEventPtr event = NULL;
bool update_current = true;
@ -6411,12 +6411,12 @@ testDomainSnapshotCreateXML(virDomainPtr domain,
cleanup:
if (vm) {
if (snapshot) {
virDomainSnapshotObjPtr other;
virDomainMomentObjPtr other;
if (update_current)
virDomainSnapshotSetCurrent(vm->snapshots, snap);
other = virDomainSnapshotFindByName(vm->snapshots,
snap->def->parent);
virDomainSnapshotSetParent(snap, other);
virDomainMomentSetParent(snap, other);
}
virDomainObjEndAPI(&vm);
}
@ -6438,7 +6438,7 @@ testDomainSnapshotDiscardAll(void *payload,
const void *name ATTRIBUTE_UNUSED,
void *data)
{
virDomainSnapshotObjPtr snap = payload;
virDomainMomentObjPtr snap = payload;
testSnapRemoveDataPtr curr = data;
curr->current |= virDomainSnapshotObjListRemove(curr->vm->snapshots, snap);
@ -6448,7 +6448,7 @@ testDomainSnapshotDiscardAll(void *payload,
typedef struct _testSnapReparentData testSnapReparentData;
typedef testSnapReparentData *testSnapReparentDataPtr;
struct _testSnapReparentData {
virDomainSnapshotObjPtr parent;
virDomainMomentObjPtr parent;
virDomainObjPtr vm;
int err;
};
@ -6458,7 +6458,7 @@ testDomainSnapshotReparentChildren(void *payload,
const void *name ATTRIBUTE_UNUSED,
void *data)
{
virDomainSnapshotObjPtr snap = payload;
virDomainMomentObjPtr snap = payload;
testSnapReparentDataPtr rep = data;
if (rep->err < 0)
@ -6480,8 +6480,8 @@ testDomainSnapshotDelete(virDomainSnapshotPtr snapshot,
unsigned int flags)
{
virDomainObjPtr vm = NULL;
virDomainSnapshotObjPtr snap = NULL;
virDomainSnapshotObjPtr parentsnap = NULL;
virDomainMomentObjPtr snap = NULL;
virDomainMomentObjPtr parentsnap = NULL;
int ret = -1;
virCheckFlags(VIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN |
@ -6498,9 +6498,9 @@ testDomainSnapshotDelete(virDomainSnapshotPtr snapshot,
testSnapRemoveData rem;
rem.vm = vm;
rem.current = false;
virDomainSnapshotForEachDescendant(snap,
testDomainSnapshotDiscardAll,
&rem);
virDomainMomentForEachDescendant(snap,
testDomainSnapshotDiscardAll,
&rem);
if (rem.current)
virDomainSnapshotSetCurrent(vm->snapshots, snap);
} else if (snap->nchildren) {
@ -6508,19 +6508,19 @@ testDomainSnapshotDelete(virDomainSnapshotPtr snapshot,
rep.parent = snap->parent;
rep.vm = vm;
rep.err = 0;
virDomainSnapshotForEachChild(snap,
testDomainSnapshotReparentChildren,
&rep);
virDomainMomentForEachChild(snap,
testDomainSnapshotReparentChildren,
&rep);
if (rep.err < 0)
goto cleanup;
virDomainSnapshotMoveChildren(snap, snap->parent);
virDomainMomentMoveChildren(snap, snap->parent);
}
if (flags & VIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN_ONLY) {
virDomainSnapshotDropChildren(snap);
virDomainMomentDropChildren(snap);
} else {
virDomainSnapshotDropParent(snap);
virDomainMomentDropParent(snap);
if (snap == virDomainSnapshotGetCurrent(vm->snapshots)) {
if (snap->def->parent) {
parentsnap = virDomainSnapshotFindByName(vm->snapshots,
@ -6546,7 +6546,7 @@ testDomainRevertToSnapshot(virDomainSnapshotPtr snapshot,
{
testDriverPtr privconn = snapshot->domain->conn->privateData;
virDomainObjPtr vm = NULL;
virDomainSnapshotObjPtr snap = NULL;
virDomainMomentObjPtr snap = NULL;
virObjectEventPtr event = NULL;
virObjectEventPtr event2 = NULL;
virDomainDefPtr config = NULL;

View File

@ -2132,10 +2132,10 @@ static int vzDomainSetMemory(virDomainPtr domain, unsigned long memory)
return ret;
}
static virDomainSnapshotObjPtr
static virDomainMomentObjPtr
vzSnapObjFromName(virDomainSnapshotObjListPtr snapshots, const char *name)
{
virDomainSnapshotObjPtr snap = NULL;
virDomainMomentObjPtr snap = NULL;
snap = virDomainSnapshotFindByName(snapshots, name);
if (!snap)
virReportError(VIR_ERR_NO_DOMAIN_SNAPSHOT,
@ -2144,7 +2144,7 @@ vzSnapObjFromName(virDomainSnapshotObjListPtr snapshots, const char *name)
return snap;
}
static virDomainSnapshotObjPtr
static virDomainMomentObjPtr
vzSnapObjFromSnapshot(virDomainSnapshotObjListPtr snapshots,
virDomainSnapshotPtr snapshot)
{
@ -2156,8 +2156,8 @@ vzCurrentSnapshotIterator(void *payload,
const void *name ATTRIBUTE_UNUSED,
void *data)
{
virDomainSnapshotObjPtr snapshot = payload;
virDomainSnapshotObjPtr *current = data;
virDomainMomentObjPtr snapshot = payload;
virDomainMomentObjPtr *current = data;
if (snapshot->def->current)
*current = snapshot;
@ -2165,10 +2165,10 @@ vzCurrentSnapshotIterator(void *payload,
return 0;
}
static virDomainSnapshotObjPtr
static virDomainMomentObjPtr
vzFindCurrentSnapshot(virDomainSnapshotObjListPtr snapshots)
{
virDomainSnapshotObjPtr current = NULL;
virDomainMomentObjPtr current = NULL;
virDomainSnapshotForEach(snapshots, vzCurrentSnapshotIterator, &current);
return current;
@ -2268,7 +2268,7 @@ vzDomainSnapshotGetXMLDesc(virDomainSnapshotPtr snapshot, unsigned int flags)
{
virDomainObjPtr dom;
char *xml = NULL;
virDomainSnapshotObjPtr snap;
virDomainMomentObjPtr snap;
char uuidstr[VIR_UUID_STRING_BUFLEN];
virDomainSnapshotObjListPtr snapshots = NULL;
vzConnPtr privconn = snapshot->domain->conn->privateData;
@ -2304,7 +2304,7 @@ static int
vzDomainSnapshotNumChildren(virDomainSnapshotPtr snapshot, unsigned int flags)
{
virDomainObjPtr dom;
virDomainSnapshotObjPtr snap;
virDomainMomentObjPtr snap;
virDomainSnapshotObjListPtr snapshots = NULL;
int n = -1;
@ -2339,7 +2339,7 @@ vzDomainSnapshotListChildrenNames(virDomainSnapshotPtr snapshot,
unsigned int flags)
{
virDomainObjPtr dom;
virDomainSnapshotObjPtr snap;
virDomainMomentObjPtr snap;
virDomainSnapshotObjListPtr snapshots = NULL;
int n = -1;
@ -2373,7 +2373,7 @@ vzDomainSnapshotListAllChildren(virDomainSnapshotPtr snapshot,
unsigned int flags)
{
virDomainObjPtr dom;
virDomainSnapshotObjPtr snap;
virDomainMomentObjPtr snap;
virDomainSnapshotObjListPtr snapshots = NULL;
int n = -1;
@ -2407,7 +2407,7 @@ vzDomainSnapshotLookupByName(virDomainPtr domain,
unsigned int flags)
{
virDomainObjPtr dom;
virDomainSnapshotObjPtr snap;
virDomainMomentObjPtr snap;
virDomainSnapshotPtr snapshot = NULL;
virDomainSnapshotObjListPtr snapshots = NULL;
@ -2465,7 +2465,7 @@ static virDomainSnapshotPtr
vzDomainSnapshotGetParent(virDomainSnapshotPtr snapshot, unsigned int flags)
{
virDomainObjPtr dom;
virDomainSnapshotObjPtr snap;
virDomainMomentObjPtr snap;
virDomainSnapshotPtr parent = NULL;
virDomainSnapshotObjListPtr snapshots = NULL;
@ -2505,7 +2505,7 @@ vzDomainSnapshotCurrent(virDomainPtr domain, unsigned int flags)
virDomainObjPtr dom;
virDomainSnapshotPtr snapshot = NULL;
virDomainSnapshotObjListPtr snapshots = NULL;
virDomainSnapshotObjPtr current;
virDomainMomentObjPtr current;
virCheckFlags(0, NULL);
@ -2539,7 +2539,7 @@ vzDomainSnapshotIsCurrent(virDomainSnapshotPtr snapshot, unsigned int flags)
virDomainObjPtr dom;
int ret = -1;
virDomainSnapshotObjListPtr snapshots = NULL;
virDomainSnapshotObjPtr current;
virDomainMomentObjPtr current;
virCheckFlags(0, -1);
@ -2568,7 +2568,7 @@ vzDomainSnapshotHasMetadata(virDomainSnapshotPtr snapshot,
{
virDomainObjPtr dom;
int ret = -1;
virDomainSnapshotObjPtr snap;
virDomainMomentObjPtr snap;
virDomainSnapshotObjListPtr snapshots = NULL;
virCheckFlags(0, -1);
@ -2606,7 +2606,7 @@ vzDomainSnapshotCreateXML(virDomainPtr domain,
vzDriverPtr driver = privconn->driver;
unsigned int parse_flags = VIR_DOMAIN_SNAPSHOT_PARSE_DISKS;
virDomainSnapshotObjListPtr snapshots = NULL;
virDomainSnapshotObjPtr current;
virDomainMomentObjPtr current;
bool job = false;
virCheckFlags(0, NULL);

View File

@ -4655,8 +4655,8 @@ prlsdkParseSnapshotTree(const char *treexml)
xmlNodePtr root;
xmlNodePtr *nodes = NULL;
virDomainSnapshotDefPtr def = NULL;
virDomainSnapshotObjPtr snapshot;
virDomainSnapshotObjPtr current = NULL;
virDomainMomentObjPtr snapshot;
virDomainMomentObjPtr current = NULL;
virDomainSnapshotObjListPtr snapshots = NULL;
char *xmlstr = NULL;
int n;