[libvirt] [PATCH v1 20/31] virstoragefile: Introduce virStorageSourceChainHasNVMe

Peter Krempa pkrempa at redhat.com
Tue Jul 16 14:22:31 UTC 2019


On Thu, Jul 11, 2019 at 17:54:07 +0200, Michal Privoznik wrote:
> This function will return true if there's a storage source of
> type VIR_STORAGE_TYPE_NVME, or false otherwise.
> 
> Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
> ---
>  src/libvirt_private.syms  |  1 +
>  src/util/virstoragefile.c | 14 ++++++++++++++
>  src/util/virstoragefile.h |  2 ++
>  3 files changed, 17 insertions(+)

[...]

> diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c
> index 18aa33fe05..a9ceb697cf 100644
> --- a/src/util/virstoragefile.c
> +++ b/src/util/virstoragefile.c
> @@ -2157,6 +2157,20 @@ virStorageSourceNVMeDefFree(virStorageSourceNVMeDefPtr def)
>  }
>  
>  
> +bool
> +virStorageSourceChainHasNVMe(const virStorageSource *src)
> +{
> +    const virStorageSource *n;
> +
> +    for (n = src; virStorageSourceIsBacking(n); n = n->backingStore) {
> +        if (n->type == VIR_STORAGE_TYPE_NVME)

It occurs to me that if you introduce this function earlier you will be
able to save some code in the previous patches.

ACK to this though.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20190716/a3d8bff3/attachment-0001.sig>


More information about the libvir-list mailing list