--- src/vbox/vbox_common.c | 27 +++++++++++++++++++++++++++ src/vbox/vbox_tmpl.c | 34 ---------------------------------- src/vbox/vbox_uniformed_api.h | 2 ++ 3 files changed, 29 insertions(+), 34 deletions(-) diff --git a/src/vbox/vbox_common.c b/src/vbox/vbox_common.c index f38305a..dcd8ab8 100644 --- a/src/vbox/vbox_common.c +++ b/src/vbox/vbox_common.c @@ -6429,3 +6429,30 @@ int vboxDomainSnapshotIsCurrent(virDomainSnapshotPtr snapshot, vboxIIDUnalloc(&iid); 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; +} diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c index fb3ed61..6d80a26 100644 --- a/src/vbox/vbox_tmpl.c +++ b/src/vbox/vbox_tmpl.c @@ -1522,40 +1522,6 @@ vboxDomainSnapshotGet(vboxGlobalData *data, 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 static int vboxDomainSnapshotRestore(virDomainPtr dom, diff --git a/src/vbox/vbox_uniformed_api.h b/src/vbox/vbox_uniformed_api.h index c761bda..ac8a6b7 100644 --- a/src/vbox/vbox_uniformed_api.h +++ b/src/vbox/vbox_uniformed_api.h @@ -591,6 +591,8 @@ virDomainSnapshotPtr vboxDomainSnapshotCurrent(virDomainPtr dom, unsigned int flags); int vboxDomainSnapshotIsCurrent(virDomainSnapshotPtr snapshot, unsigned int flags); +int vboxDomainSnapshotHasMetadata(virDomainSnapshotPtr snapshot, + unsigned int flags); /* Version specified functions for installing uniformed API */ void vbox22InstallUniformedAPI(vboxUniformedAPI *pVBoxAPI); -- 1.7.9.5 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list