mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-14 23:24:23 +03:00
vbox: Rewrite vboxDomainSnapshotHasMetadata
This commit is contained in:
parent
d722d8c7a9
commit
410b2183b7
@ -6417,3 +6417,30 @@ int vboxDomainSnapshotIsCurrent(virDomainSnapshotPtr snapshot,
|
|||||||
vboxIIDUnalloc(&iid);
|
vboxIIDUnalloc(&iid);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int vboxDomainSnapshotHasMetadata(virDomainSnapshotPtr snapshot,
|
||||||
|
unsigned int flags)
|
||||||
|
{
|
||||||
|
virDomainPtr dom = snapshot->domain;
|
||||||
|
VBOX_OBJECT_CHECK(dom->conn, int, -1);
|
||||||
|
vboxIIDUnion iid;
|
||||||
|
IMachine *machine = NULL;
|
||||||
|
ISnapshot *snap = NULL;
|
||||||
|
|
||||||
|
virCheckFlags(0, -1);
|
||||||
|
|
||||||
|
if (openSessionForMachine(data, dom->uuid, &iid, &machine, false) < 0)
|
||||||
|
goto cleanup;
|
||||||
|
|
||||||
|
/* Check that snapshot exists. If so, there is no metadata. */
|
||||||
|
if (!(snap = vboxDomainSnapshotGet(data, dom, machine, snapshot->name)))
|
||||||
|
goto cleanup;
|
||||||
|
|
||||||
|
ret = 0;
|
||||||
|
|
||||||
|
cleanup:
|
||||||
|
VBOX_RELEASE(snap);
|
||||||
|
VBOX_RELEASE(machine);
|
||||||
|
vboxIIDUnalloc(&iid);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
@ -1523,40 +1523,6 @@ vboxDomainSnapshotGet(vboxGlobalData *data,
|
|||||||
return snapshot;
|
return snapshot;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
|
||||||
vboxDomainSnapshotHasMetadata(virDomainSnapshotPtr snapshot,
|
|
||||||
unsigned int flags)
|
|
||||||
{
|
|
||||||
virDomainPtr dom = snapshot->domain;
|
|
||||||
VBOX_OBJECT_CHECK(dom->conn, int, -1);
|
|
||||||
vboxIID iid = VBOX_IID_INITIALIZER;
|
|
||||||
IMachine *machine = NULL;
|
|
||||||
ISnapshot *snap = NULL;
|
|
||||||
nsresult rc;
|
|
||||||
|
|
||||||
virCheckFlags(0, -1);
|
|
||||||
|
|
||||||
vboxIIDFromUUID(&iid, dom->uuid);
|
|
||||||
rc = VBOX_OBJECT_GET_MACHINE(iid.value, &machine);
|
|
||||||
if (NS_FAILED(rc)) {
|
|
||||||
virReportError(VIR_ERR_NO_DOMAIN, "%s",
|
|
||||||
_("no domain with matching UUID"));
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Check that snapshot exists. If so, there is no metadata. */
|
|
||||||
if (!(snap = vboxDomainSnapshotGet(data, dom, machine, snapshot->name)))
|
|
||||||
goto cleanup;
|
|
||||||
|
|
||||||
ret = 0;
|
|
||||||
|
|
||||||
cleanup:
|
|
||||||
VBOX_RELEASE(snap);
|
|
||||||
VBOX_RELEASE(machine);
|
|
||||||
vboxIIDUnalloc(&iid);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if VBOX_API_VERSION < 3001000
|
#if VBOX_API_VERSION < 3001000
|
||||||
static int
|
static int
|
||||||
vboxDomainSnapshotRestore(virDomainPtr dom,
|
vboxDomainSnapshotRestore(virDomainPtr dom,
|
||||||
|
@ -591,6 +591,8 @@ virDomainSnapshotPtr
|
|||||||
vboxDomainSnapshotCurrent(virDomainPtr dom, unsigned int flags);
|
vboxDomainSnapshotCurrent(virDomainPtr dom, unsigned int flags);
|
||||||
int vboxDomainSnapshotIsCurrent(virDomainSnapshotPtr snapshot,
|
int vboxDomainSnapshotIsCurrent(virDomainSnapshotPtr snapshot,
|
||||||
unsigned int flags);
|
unsigned int flags);
|
||||||
|
int vboxDomainSnapshotHasMetadata(virDomainSnapshotPtr snapshot,
|
||||||
|
unsigned int flags);
|
||||||
|
|
||||||
/* Version specified functions for installing uniformed API */
|
/* Version specified functions for installing uniformed API */
|
||||||
void vbox22InstallUniformedAPI(vboxUniformedAPI *pVBoxAPI);
|
void vbox22InstallUniformedAPI(vboxUniformedAPI *pVBoxAPI);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user