--- src/vbox/vbox_common.c | 26 ++++++++++++++++++++++++++ src/vbox/vbox_tmpl.c | 33 --------------------------------- src/vbox/vbox_uniformed_api.h | 3 +++ 3 files changed, 29 insertions(+), 33 deletions(-) diff --git a/src/vbox/vbox_common.c b/src/vbox/vbox_common.c index dc9018f..5178cda 100644 --- a/src/vbox/vbox_common.c +++ b/src/vbox/vbox_common.c @@ -6200,3 +6200,29 @@ int vboxDomainSnapshotListNames(virDomainPtr dom, char **names, vboxIIDUnalloc(&iid); return ret; } + +virDomainSnapshotPtr +vboxDomainSnapshotLookupByName(virDomainPtr dom, const char *name, + unsigned int flags) +{ + VBOX_OBJECT_CHECK(dom->conn, virDomainSnapshotPtr, NULL); + vboxIIDUnion iid; + IMachine *machine = NULL; + ISnapshot *snapshot = NULL; + + virCheckFlags(0, NULL); + + if (openSessionForMachine(data, dom->uuid, &iid, &machine, false) < 0) + goto cleanup; + + if (!(snapshot = vboxDomainSnapshotGet(data, dom, machine, name))) + goto cleanup; + + ret = virGetDomainSnapshot(dom, name); + + cleanup: + VBOX_RELEASE(snapshot); + VBOX_RELEASE(machine); + vboxIIDUnalloc(&iid); + return ret; +} diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c index 7b6f847..5aef7dd 100644 --- a/src/vbox/vbox_tmpl.c +++ b/src/vbox/vbox_tmpl.c @@ -1522,39 +1522,6 @@ vboxDomainSnapshotGet(vboxGlobalData *data, return snapshot; } -static virDomainSnapshotPtr -vboxDomainSnapshotLookupByName(virDomainPtr dom, - const char *name, - unsigned int flags) -{ - VBOX_OBJECT_CHECK(dom->conn, virDomainSnapshotPtr, NULL); - vboxIID iid = VBOX_IID_INITIALIZER; - IMachine *machine = NULL; - ISnapshot *snapshot = NULL; - nsresult rc; - - virCheckFlags(0, NULL); - - 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; - } - - if (!(snapshot = vboxDomainSnapshotGet(data, dom, machine, name))) - goto cleanup; - - ret = virGetDomainSnapshot(dom, name); - - cleanup: - VBOX_RELEASE(snapshot); - VBOX_RELEASE(machine); - vboxIIDUnalloc(&iid); - return ret; -} - static int vboxDomainHasCurrentSnapshot(virDomainPtr dom, unsigned int flags) diff --git a/src/vbox/vbox_uniformed_api.h b/src/vbox/vbox_uniformed_api.h index f0cfb18..afbc351 100644 --- a/src/vbox/vbox_uniformed_api.h +++ b/src/vbox/vbox_uniformed_api.h @@ -580,6 +580,9 @@ char *vboxDomainSnapshotGetXMLDesc(virDomainSnapshotPtr snapshot, int vboxDomainSnapshotNum(virDomainPtr dom, unsigned int flags); int vboxDomainSnapshotListNames(virDomainPtr dom, char **names, int nameslen, unsigned int flags); +virDomainSnapshotPtr +vboxDomainSnapshotLookupByName(virDomainPtr dom, const char *name, + 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