[libvirt] [PATCH 04/10] storage: Add internal API to create temporary storage pools and vols

Eric Blake eblake at redhat.com
Thu Jan 9 23:14:20 UTC 2014


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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 604 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20140109/6668f4ee/attachment-0001.sig>


More information about the libvir-list mailing list