
On 01/09/2014 09:15 AM, Peter Krempa wrote:
If a VM driver wants to access stuff provided by a storage driver the volume needs to be a part of a storage pool. As this wasn't designed in from the beginning we need a way to convert generic domain disk and snapshot disk definitions into temporary pools and volumes. This patch allows that by adding private storage driver APIs that can be used to obtain a pool and vol definition. --- docs/hvsupport.pl | 3 ++ src/Makefile.am | 3 +- src/check-drivername.pl | 1 + src/driver.h | 13 +++++++++ src/libvirt_internal.c | 71 ++++++++++++++++++++++++++++++++++++++++++++++++ src/libvirt_internal.h | 22 +++++++++++++++ src/libvirt_private.syms | 3 ++ 7 files changed, 115 insertions(+), 1 deletion(-) create mode 100644 src/libvirt_internal.c
diff --git a/docs/hvsupport.pl b/docs/hvsupport.pl index f8483f9..a7d1f6b 100755 --- a/docs/hvsupport.pl +++ b/docs/hvsupport.pl @@ -176,6 +176,9 @@ $apis{virDomainMigratePerform3Params} = "1.1.0"; $apis{virDomainMigrateFinish3Params} = "1.1.0"; $apis{virDomainMigrateConfirm3Params} = "1.1.0";
+$apis{virStorageEphemeralFree} = "1.2.1"; +$apis{virStorageEphemeralFromDiskDef} = "1.2.1"; +$apis{virStorageEphemeralFromSnapshotDiskDef} = "1.2.1";
Missed 1.2.1 (this is definitely post-release material), but yeah, I've always wanted to have a way to have domains be able to refer to polymorphic storage volume APIs that just do the right thing for a variety of storage types, instead of recoding things in two locations.
+++ b/src/libvirt_internal.c @@ -0,0 +1,71 @@ +/* + * libvirt_internal.c: internally exported APIs, not for public use + * + * Copyright (C) 2013 Red Hat, Inc.
2014, now :)
+virStorageEphemeralPtr +virStorageEphemeralFromDiskDef(virConnectPtr conn, + virDomainDiskDefPtr def) +{ + if (conn->storageDriver->storageEphemeralFromDiskDef) + return conn->storageDriver->storageEphemeralFromDiskDef(conn, def); + + virReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
My recent cleanup series to libvirt.c include virReportUnsupportedError() insated of raw use of this error type.
+ return NULL; +} + + +virStorageEphemeralPtr +virStorageEphemeralFromSnapshotDiskDef(virConnectPtr conn, + virDomainSnapshotDiskDefPtr def) +{ + if (conn->storageDriver->storageEphemeralFromSnapshotDiskDef) + return conn->storageDriver->storageEphemeralFromSnapshotDiskDef(conn, def); + + virReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
and again. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org