mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
snapshot: Make virDomainSnapshotDef a virObject
This brings about a couple of benefits: - use of VIR_AUTOUNREF() simplifies several callers - Fixes a todo about virDomainMomentObjList not being polymorphic enough Signed-off-by: Eric Blake <eblake@redhat.com> Acked-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
parent
7fe07761a7
commit
57387ff54b
2
cfg.mk
2
cfg.mk
@ -133,7 +133,6 @@ useless_free_options = \
|
|||||||
--name=virDomainNetDefFree \
|
--name=virDomainNetDefFree \
|
||||||
--name=virDomainObjFree \
|
--name=virDomainObjFree \
|
||||||
--name=virDomainSmartcardDefFree \
|
--name=virDomainSmartcardDefFree \
|
||||||
--name=virDomainSnapshotDefFree \
|
|
||||||
--name=virDomainSnapshotObjFree \
|
--name=virDomainSnapshotObjFree \
|
||||||
--name=virDomainSoundDefFree \
|
--name=virDomainSoundDefFree \
|
||||||
--name=virDomainVideoDefFree \
|
--name=virDomainVideoDefFree \
|
||||||
@ -211,7 +210,6 @@ useless_free_options = \
|
|||||||
# y virDomainInputDefFree
|
# y virDomainInputDefFree
|
||||||
# y virDomainNetDefFree
|
# y virDomainNetDefFree
|
||||||
# y virDomainObjFree
|
# y virDomainObjFree
|
||||||
# y virDomainSnapshotDefFree
|
|
||||||
# n virDomainSnapshotFree (returns int)
|
# n virDomainSnapshotFree (returns int)
|
||||||
# n virDomainSnapshotFreeName (returns int)
|
# n virDomainSnapshotFreeName (returns int)
|
||||||
# y virDomainSnapshotObjFree
|
# y virDomainSnapshotObjFree
|
||||||
|
@ -34,8 +34,34 @@
|
|||||||
|
|
||||||
VIR_LOG_INIT("conf.moment_conf");
|
VIR_LOG_INIT("conf.moment_conf");
|
||||||
|
|
||||||
void virDomainMomentDefClear(virDomainMomentDefPtr def)
|
static virClassPtr virDomainMomentDefClass;
|
||||||
|
static void virDomainMomentDefDispose(void *obj);
|
||||||
|
|
||||||
|
static int
|
||||||
|
virDomainMomentOnceInit(void)
|
||||||
{
|
{
|
||||||
|
if (!VIR_CLASS_NEW(virDomainMomentDef, virClassForObject()))
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
VIR_ONCE_GLOBAL_INIT(virDomainMoment);
|
||||||
|
|
||||||
|
virClassPtr
|
||||||
|
virClassForDomainMomentDef(void)
|
||||||
|
{
|
||||||
|
if (virDomainMomentInitialize() < 0)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
return virDomainMomentDefClass;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
virDomainMomentDefDispose(void *obj)
|
||||||
|
{
|
||||||
|
virDomainMomentDefPtr def = obj;
|
||||||
|
|
||||||
VIR_FREE(def->name);
|
VIR_FREE(def->name);
|
||||||
VIR_FREE(def->description);
|
VIR_FREE(def->description);
|
||||||
VIR_FREE(def->parent_name);
|
VIR_FREE(def->parent_name);
|
||||||
|
@ -25,9 +25,12 @@
|
|||||||
|
|
||||||
# include "internal.h"
|
# include "internal.h"
|
||||||
# include "virconftypes.h"
|
# include "virconftypes.h"
|
||||||
|
# include "virobject.h"
|
||||||
|
|
||||||
/* Base class for a domain moment */
|
/* Base class for a domain moment */
|
||||||
struct _virDomainMomentDef {
|
struct _virDomainMomentDef {
|
||||||
|
virObject parent;
|
||||||
|
|
||||||
/* Common portion of public XML. */
|
/* Common portion of public XML. */
|
||||||
char *name;
|
char *name;
|
||||||
char *description;
|
char *description;
|
||||||
@ -37,7 +40,7 @@ struct _virDomainMomentDef {
|
|||||||
virDomainDefPtr dom;
|
virDomainDefPtr dom;
|
||||||
};
|
};
|
||||||
|
|
||||||
void virDomainMomentDefClear(virDomainMomentDefPtr def);
|
virClassPtr virClassForDomainMomentDef(void);
|
||||||
|
|
||||||
int virDomainMomentDefPostParse(virDomainMomentDefPtr def);
|
int virDomainMomentDefPostParse(virDomainMomentDefPtr def);
|
||||||
|
|
||||||
|
@ -50,6 +50,20 @@
|
|||||||
|
|
||||||
VIR_LOG_INIT("conf.snapshot_conf");
|
VIR_LOG_INIT("conf.snapshot_conf");
|
||||||
|
|
||||||
|
static virClassPtr virDomainSnapshotDefClass;
|
||||||
|
static void virDomainSnapshotDefDispose(void *obj);
|
||||||
|
|
||||||
|
static int
|
||||||
|
virDomainSnapshotOnceInit(void)
|
||||||
|
{
|
||||||
|
if (!VIR_CLASS_NEW(virDomainSnapshotDef, virClassForDomainMomentDef()))
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
VIR_ONCE_GLOBAL_INIT(virDomainSnapshot);
|
||||||
|
|
||||||
VIR_ENUM_IMPL(virDomainSnapshotLocation,
|
VIR_ENUM_IMPL(virDomainSnapshotLocation,
|
||||||
VIR_DOMAIN_SNAPSHOT_LOCATION_LAST,
|
VIR_DOMAIN_SNAPSHOT_LOCATION_LAST,
|
||||||
"default",
|
"default",
|
||||||
@ -81,29 +95,30 @@ virDomainSnapshotDiskDefClear(virDomainSnapshotDiskDefPtr disk)
|
|||||||
disk->src = NULL;
|
disk->src = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Allocate a new virDomainSnapshotDef; free with virObjectUnref() */
|
||||||
virDomainSnapshotDefPtr
|
virDomainSnapshotDefPtr
|
||||||
virDomainSnapshotDefNew(void)
|
virDomainSnapshotDefNew(void)
|
||||||
{
|
{
|
||||||
virDomainSnapshotDefPtr def;
|
virDomainSnapshotDefPtr def;
|
||||||
|
|
||||||
ignore_value(VIR_ALLOC(def));
|
if (virDomainSnapshotInitialize() < 0)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
def = virObjectNew(virDomainSnapshotDefClass);
|
||||||
return def;
|
return def;
|
||||||
}
|
}
|
||||||
|
|
||||||
void virDomainSnapshotDefFree(virDomainSnapshotDefPtr def)
|
static void
|
||||||
|
virDomainSnapshotDefDispose(void *obj)
|
||||||
{
|
{
|
||||||
|
virDomainSnapshotDefPtr def = obj;
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
if (!def)
|
|
||||||
return;
|
|
||||||
|
|
||||||
virDomainMomentDefClear(&def->parent);
|
|
||||||
VIR_FREE(def->file);
|
VIR_FREE(def->file);
|
||||||
for (i = 0; i < def->ndisks; i++)
|
for (i = 0; i < def->ndisks; i++)
|
||||||
virDomainSnapshotDiskDefClear(&def->disks[i]);
|
virDomainSnapshotDiskDefClear(&def->disks[i]);
|
||||||
VIR_FREE(def->disks);
|
VIR_FREE(def->disks);
|
||||||
virObjectUnref(def->cookie);
|
virObjectUnref(def->cookie);
|
||||||
VIR_FREE(def);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -373,7 +388,7 @@ virDomainSnapshotDefParse(xmlXPathContextPtr ctxt,
|
|||||||
VIR_FREE(nodes);
|
VIR_FREE(nodes);
|
||||||
VIR_FREE(memorySnapshot);
|
VIR_FREE(memorySnapshot);
|
||||||
VIR_FREE(memoryFile);
|
VIR_FREE(memoryFile);
|
||||||
virDomainSnapshotDefFree(def);
|
virObjectUnref(def);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -995,7 +1010,7 @@ virDomainSnapshotRedefinePrep(virDomainPtr domain,
|
|||||||
/* Drop and rebuild the parent relationship, but keep all
|
/* Drop and rebuild the parent relationship, but keep all
|
||||||
* child relations by reusing snap. */
|
* child relations by reusing snap. */
|
||||||
virDomainMomentDropParent(other);
|
virDomainMomentDropParent(other);
|
||||||
virDomainSnapshotDefFree(otherdef);
|
virObjectUnref(otherdef);
|
||||||
other->def = &(*defptr)->parent;
|
other->def = &(*defptr)->parent;
|
||||||
*defptr = NULL;
|
*defptr = NULL;
|
||||||
*snap = other;
|
*snap = other;
|
||||||
|
@ -115,7 +115,6 @@ virDomainSnapshotDefPtr virDomainSnapshotDefParseNode(xmlDocPtr xml,
|
|||||||
bool *current,
|
bool *current,
|
||||||
unsigned int flags);
|
unsigned int flags);
|
||||||
virDomainSnapshotDefPtr virDomainSnapshotDefNew(void);
|
virDomainSnapshotDefPtr virDomainSnapshotDefNew(void);
|
||||||
void virDomainSnapshotDefFree(virDomainSnapshotDefPtr def);
|
|
||||||
char *virDomainSnapshotDefFormat(const char *uuidstr,
|
char *virDomainSnapshotDefFormat(const char *uuidstr,
|
||||||
virDomainSnapshotDefPtr def,
|
virDomainSnapshotDefPtr def,
|
||||||
virCapsPtr caps,
|
virCapsPtr caps,
|
||||||
|
@ -208,8 +208,7 @@ virDomainMomentObjFree(virDomainMomentObjPtr moment)
|
|||||||
|
|
||||||
VIR_DEBUG("obj=%p", moment);
|
VIR_DEBUG("obj=%p", moment);
|
||||||
|
|
||||||
/* FIXME: Make this polymorphic by inheriting from virObject */
|
virObjectUnref(moment->def);
|
||||||
virDomainSnapshotDefFree(virDomainSnapshotObjGetDef(moment));
|
|
||||||
VIR_FREE(moment);
|
VIR_FREE(moment);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4081,7 +4081,6 @@ esxDomainSnapshotCreateXML(virDomainPtr domain, const char *xmlDesc,
|
|||||||
unsigned int flags)
|
unsigned int flags)
|
||||||
{
|
{
|
||||||
esxPrivate *priv = domain->conn->privateData;
|
esxPrivate *priv = domain->conn->privateData;
|
||||||
virDomainSnapshotDefPtr def = NULL;
|
|
||||||
esxVI_ObjectContent *virtualMachine = NULL;
|
esxVI_ObjectContent *virtualMachine = NULL;
|
||||||
esxVI_VirtualMachineSnapshotTree *rootSnapshotList = NULL;
|
esxVI_VirtualMachineSnapshotTree *rootSnapshotList = NULL;
|
||||||
esxVI_VirtualMachineSnapshotTree *snapshotTree = NULL;
|
esxVI_VirtualMachineSnapshotTree *snapshotTree = NULL;
|
||||||
@ -4091,6 +4090,7 @@ esxDomainSnapshotCreateXML(virDomainPtr domain, const char *xmlDesc,
|
|||||||
virDomainSnapshotPtr snapshot = NULL;
|
virDomainSnapshotPtr snapshot = NULL;
|
||||||
bool diskOnly = (flags & VIR_DOMAIN_SNAPSHOT_CREATE_DISK_ONLY) != 0;
|
bool diskOnly = (flags & VIR_DOMAIN_SNAPSHOT_CREATE_DISK_ONLY) != 0;
|
||||||
bool quiesce = (flags & VIR_DOMAIN_SNAPSHOT_CREATE_QUIESCE) != 0;
|
bool quiesce = (flags & VIR_DOMAIN_SNAPSHOT_CREATE_QUIESCE) != 0;
|
||||||
|
VIR_AUTOUNREF(virDomainSnapshotDefPtr) def = NULL;
|
||||||
|
|
||||||
/* ESX supports disk-only and quiesced snapshots; libvirt tracks no
|
/* ESX supports disk-only and quiesced snapshots; libvirt tracks no
|
||||||
* snapshot metadata so supporting that flag is trivial. */
|
* snapshot metadata so supporting that flag is trivial. */
|
||||||
@ -4151,7 +4151,6 @@ esxDomainSnapshotCreateXML(virDomainPtr domain, const char *xmlDesc,
|
|||||||
snapshot = virGetDomainSnapshot(domain, def->parent.name);
|
snapshot = virGetDomainSnapshot(domain, def->parent.name);
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
virDomainSnapshotDefFree(def);
|
|
||||||
esxVI_ObjectContent_Free(&virtualMachine);
|
esxVI_ObjectContent_Free(&virtualMachine);
|
||||||
esxVI_VirtualMachineSnapshotTree_Free(&rootSnapshotList);
|
esxVI_VirtualMachineSnapshotTree_Free(&rootSnapshotList);
|
||||||
esxVI_ManagedObjectReference_Free(&task);
|
esxVI_ManagedObjectReference_Free(&task);
|
||||||
|
@ -892,7 +892,6 @@ virSecretEventValueChangedNew;
|
|||||||
# conf/snapshot_conf.h
|
# conf/snapshot_conf.h
|
||||||
virDomainSnapshotAlignDisks;
|
virDomainSnapshotAlignDisks;
|
||||||
virDomainSnapshotDefFormat;
|
virDomainSnapshotDefFormat;
|
||||||
virDomainSnapshotDefFree;
|
|
||||||
virDomainSnapshotDefIsExternal;
|
virDomainSnapshotDefIsExternal;
|
||||||
virDomainSnapshotDefNew;
|
virDomainSnapshotDefNew;
|
||||||
virDomainSnapshotDefParseString;
|
virDomainSnapshotDefParseString;
|
||||||
|
@ -481,7 +481,7 @@ qemuDomainSnapshotLoad(virDomainObjPtr vm,
|
|||||||
|
|
||||||
snap = virDomainSnapshotAssignDef(vm->snapshots, def);
|
snap = virDomainSnapshotAssignDef(vm->snapshots, def);
|
||||||
if (snap == NULL) {
|
if (snap == NULL) {
|
||||||
virDomainSnapshotDefFree(def);
|
virObjectUnref(def);
|
||||||
} else if (cur) {
|
} else if (cur) {
|
||||||
if (current)
|
if (current)
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
@ -15552,7 +15552,6 @@ qemuDomainSnapshotCreateXML(virDomainPtr domain,
|
|||||||
char *xml = NULL;
|
char *xml = NULL;
|
||||||
virDomainMomentObjPtr snap = NULL;
|
virDomainMomentObjPtr snap = NULL;
|
||||||
virDomainSnapshotPtr snapshot = NULL;
|
virDomainSnapshotPtr snapshot = NULL;
|
||||||
virDomainSnapshotDefPtr def = NULL;
|
|
||||||
virDomainMomentObjPtr current = NULL;
|
virDomainMomentObjPtr current = NULL;
|
||||||
bool update_current = true;
|
bool update_current = true;
|
||||||
bool redefine = flags & VIR_DOMAIN_SNAPSHOT_CREATE_REDEFINE;
|
bool redefine = flags & VIR_DOMAIN_SNAPSHOT_CREATE_REDEFINE;
|
||||||
@ -15564,6 +15563,7 @@ qemuDomainSnapshotCreateXML(virDomainPtr domain,
|
|||||||
virCapsPtr caps = NULL;
|
virCapsPtr caps = NULL;
|
||||||
qemuDomainObjPrivatePtr priv;
|
qemuDomainObjPrivatePtr priv;
|
||||||
virDomainSnapshotState state;
|
virDomainSnapshotState state;
|
||||||
|
VIR_AUTOFREE(virDomainSnapshotDefPtr) def = NULL;
|
||||||
|
|
||||||
virCheckFlags(VIR_DOMAIN_SNAPSHOT_CREATE_REDEFINE |
|
virCheckFlags(VIR_DOMAIN_SNAPSHOT_CREATE_REDEFINE |
|
||||||
VIR_DOMAIN_SNAPSHOT_CREATE_CURRENT |
|
VIR_DOMAIN_SNAPSHOT_CREATE_CURRENT |
|
||||||
@ -15831,7 +15831,6 @@ qemuDomainSnapshotCreateXML(virDomainPtr domain,
|
|||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
virDomainObjEndAPI(&vm);
|
virDomainObjEndAPI(&vm);
|
||||||
virDomainSnapshotDefFree(def);
|
|
||||||
VIR_FREE(xml);
|
VIR_FREE(xml);
|
||||||
virObjectUnref(caps);
|
virObjectUnref(caps);
|
||||||
virObjectUnref(cfg);
|
virObjectUnref(cfg);
|
||||||
|
@ -848,7 +848,7 @@ testParseDomainSnapshots(testDriverPtr privconn,
|
|||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
if (!(snap = virDomainSnapshotAssignDef(domobj->snapshots, def))) {
|
if (!(snap = virDomainSnapshotAssignDef(domobj->snapshots, def))) {
|
||||||
virDomainSnapshotDefFree(def);
|
virObjectUnref(def);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -6348,13 +6348,13 @@ testDomainSnapshotCreateXML(virDomainPtr domain,
|
|||||||
{
|
{
|
||||||
testDriverPtr privconn = domain->conn->privateData;
|
testDriverPtr privconn = domain->conn->privateData;
|
||||||
virDomainObjPtr vm = NULL;
|
virDomainObjPtr vm = NULL;
|
||||||
virDomainSnapshotDefPtr def = NULL;
|
|
||||||
virDomainMomentObjPtr snap = NULL;
|
virDomainMomentObjPtr snap = NULL;
|
||||||
virDomainSnapshotPtr snapshot = NULL;
|
virDomainSnapshotPtr snapshot = NULL;
|
||||||
virObjectEventPtr event = NULL;
|
virObjectEventPtr event = NULL;
|
||||||
bool update_current = true;
|
bool update_current = true;
|
||||||
bool redefine = flags & VIR_DOMAIN_SNAPSHOT_CREATE_REDEFINE;
|
bool redefine = flags & VIR_DOMAIN_SNAPSHOT_CREATE_REDEFINE;
|
||||||
unsigned int parse_flags = VIR_DOMAIN_SNAPSHOT_PARSE_DISKS;
|
unsigned int parse_flags = VIR_DOMAIN_SNAPSHOT_PARSE_DISKS;
|
||||||
|
VIR_AUTOUNREF(virDomainSnapshotDefPtr) def = NULL;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* DISK_ONLY: Not implemented yet
|
* DISK_ONLY: Not implemented yet
|
||||||
@ -6448,7 +6448,6 @@ testDomainSnapshotCreateXML(virDomainPtr domain,
|
|||||||
virDomainObjEndAPI(&vm);
|
virDomainObjEndAPI(&vm);
|
||||||
}
|
}
|
||||||
virObjectEventStateQueue(privconn->eventState, event);
|
virObjectEventStateQueue(privconn->eventState, event);
|
||||||
virDomainSnapshotDefFree(def);
|
|
||||||
return snapshot;
|
return snapshot;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5476,7 +5476,6 @@ vboxDomainSnapshotCreateXML(virDomainPtr dom,
|
|||||||
unsigned int flags)
|
unsigned int flags)
|
||||||
{
|
{
|
||||||
vboxDriverPtr data = dom->conn->privateData;
|
vboxDriverPtr data = dom->conn->privateData;
|
||||||
virDomainSnapshotDefPtr def = NULL;
|
|
||||||
vboxIID domiid;
|
vboxIID domiid;
|
||||||
IMachine *machine = NULL;
|
IMachine *machine = NULL;
|
||||||
IConsole *console = NULL;
|
IConsole *console = NULL;
|
||||||
@ -5488,6 +5487,7 @@ vboxDomainSnapshotCreateXML(virDomainPtr dom,
|
|||||||
nsresult rc;
|
nsresult rc;
|
||||||
resultCodeUnion result;
|
resultCodeUnion result;
|
||||||
virDomainSnapshotPtr ret = NULL;
|
virDomainSnapshotPtr ret = NULL;
|
||||||
|
VIR_AUTOUNREF(virDomainSnapshotDefPtr) def = NULL;
|
||||||
|
|
||||||
if (!data->vboxObj)
|
if (!data->vboxObj)
|
||||||
return ret;
|
return ret;
|
||||||
@ -5587,7 +5587,6 @@ vboxDomainSnapshotCreateXML(virDomainPtr dom,
|
|||||||
gVBoxAPI.UISession.Close(data->vboxSession);
|
gVBoxAPI.UISession.Close(data->vboxSession);
|
||||||
VBOX_RELEASE(machine);
|
VBOX_RELEASE(machine);
|
||||||
vboxIIDUnalloc(&domiid);
|
vboxIIDUnalloc(&domiid);
|
||||||
virDomainSnapshotDefFree(def);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -6200,7 +6199,6 @@ static char *vboxDomainSnapshotGetXMLDesc(virDomainSnapshotPtr snapshot,
|
|||||||
ISnapshot *snap = NULL;
|
ISnapshot *snap = NULL;
|
||||||
ISnapshot *parent = NULL;
|
ISnapshot *parent = NULL;
|
||||||
nsresult rc;
|
nsresult rc;
|
||||||
virDomainSnapshotDefPtr def = NULL;
|
|
||||||
PRUnichar *str16;
|
PRUnichar *str16;
|
||||||
char *str8;
|
char *str8;
|
||||||
PRInt64 timestamp;
|
PRInt64 timestamp;
|
||||||
@ -6208,6 +6206,7 @@ static char *vboxDomainSnapshotGetXMLDesc(virDomainSnapshotPtr snapshot,
|
|||||||
char uuidstr[VIR_UUID_STRING_BUFLEN];
|
char uuidstr[VIR_UUID_STRING_BUFLEN];
|
||||||
char *ret = NULL;
|
char *ret = NULL;
|
||||||
virDomainDefPtr defdom;
|
virDomainDefPtr defdom;
|
||||||
|
VIR_AUTOUNREF(virDomainSnapshotDefPtr) def = NULL;
|
||||||
|
|
||||||
if (!data->vboxObj)
|
if (!data->vboxObj)
|
||||||
return ret;
|
return ret;
|
||||||
@ -6330,7 +6329,6 @@ static char *vboxDomainSnapshotGetXMLDesc(virDomainSnapshotPtr snapshot,
|
|||||||
ret = virDomainSnapshotDefFormat(uuidstr, def, data->caps, data->xmlopt, 0);
|
ret = virDomainSnapshotDefFormat(uuidstr, def, data->caps, data->xmlopt, 0);
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
virDomainSnapshotDefFree(def);
|
|
||||||
VBOX_RELEASE(parent);
|
VBOX_RELEASE(parent);
|
||||||
VBOX_RELEASE(snap);
|
VBOX_RELEASE(snap);
|
||||||
VBOX_RELEASE(machine);
|
VBOX_RELEASE(machine);
|
||||||
|
@ -2576,7 +2576,6 @@ vzDomainSnapshotCreateXML(virDomainPtr domain,
|
|||||||
const char *xmlDesc,
|
const char *xmlDesc,
|
||||||
unsigned int flags)
|
unsigned int flags)
|
||||||
{
|
{
|
||||||
virDomainSnapshotDefPtr def = NULL;
|
|
||||||
virDomainSnapshotPtr snapshot = NULL;
|
virDomainSnapshotPtr snapshot = NULL;
|
||||||
virDomainObjPtr dom;
|
virDomainObjPtr dom;
|
||||||
vzConnPtr privconn = domain->conn->privateData;
|
vzConnPtr privconn = domain->conn->privateData;
|
||||||
@ -2585,6 +2584,7 @@ vzDomainSnapshotCreateXML(virDomainPtr domain,
|
|||||||
virDomainSnapshotObjListPtr snapshots = NULL;
|
virDomainSnapshotObjListPtr snapshots = NULL;
|
||||||
virDomainMomentObjPtr current;
|
virDomainMomentObjPtr current;
|
||||||
bool job = false;
|
bool job = false;
|
||||||
|
VIR_AUTOUNREF(virDomainSnapshotDefPtr) def = NULL;
|
||||||
|
|
||||||
virCheckFlags(0, NULL);
|
virCheckFlags(0, NULL);
|
||||||
|
|
||||||
@ -2636,7 +2636,6 @@ vzDomainSnapshotCreateXML(virDomainPtr domain,
|
|||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
virDomainSnapshotObjListFree(snapshots);
|
virDomainSnapshotObjListFree(snapshots);
|
||||||
virDomainSnapshotDefFree(def);
|
|
||||||
if (job)
|
if (job)
|
||||||
vzDomainObjEndJob(dom);
|
vzDomainObjEndJob(dom);
|
||||||
virDomainObjEndAPI(&dom);
|
virDomainObjEndAPI(&dom);
|
||||||
|
@ -35,10 +35,10 @@ testCompareXMLToXMLFiles(const char *inxml,
|
|||||||
char *outXmlData = NULL;
|
char *outXmlData = NULL;
|
||||||
char *actual = NULL;
|
char *actual = NULL;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
virDomainSnapshotDefPtr def = NULL;
|
|
||||||
unsigned int parseflags = VIR_DOMAIN_SNAPSHOT_PARSE_DISKS;
|
unsigned int parseflags = VIR_DOMAIN_SNAPSHOT_PARSE_DISKS;
|
||||||
unsigned int formatflags = VIR_DOMAIN_SNAPSHOT_FORMAT_SECURE;
|
unsigned int formatflags = VIR_DOMAIN_SNAPSHOT_FORMAT_SECURE;
|
||||||
bool cur = false;
|
bool cur = false;
|
||||||
|
VIR_AUTOUNREF(virDomainSnapshotDefPtr) def = NULL;
|
||||||
|
|
||||||
if (flags & TEST_INTERNAL) {
|
if (flags & TEST_INTERNAL) {
|
||||||
parseflags |= VIR_DOMAIN_SNAPSHOT_PARSE_INTERNAL;
|
parseflags |= VIR_DOMAIN_SNAPSHOT_PARSE_INTERNAL;
|
||||||
@ -85,7 +85,6 @@ testCompareXMLToXMLFiles(const char *inxml,
|
|||||||
VIR_FREE(inXmlData);
|
VIR_FREE(inXmlData);
|
||||||
VIR_FREE(outXmlData);
|
VIR_FREE(outXmlData);
|
||||||
VIR_FREE(actual);
|
VIR_FREE(actual);
|
||||||
virDomainSnapshotDefFree(def);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user