Re: [libvirt] [PATCH] storage: Report errors in FindPoolSources

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Oct 12, 2009 at 10:32:12AM -0400, Cole Robinson wrote:
> 
> Signed-off-by: Cole Robinson <crobinso@xxxxxxxxxx>
> ---
>  src/storage/storage_driver.c |   15 ++++++++++++---
>  1 files changed, 12 insertions(+), 3 deletions(-)
> 
> diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c
> index 9ab53e1..4f8949b 100644
> --- a/src/storage/storage_driver.c
> +++ b/src/storage/storage_driver.c
> @@ -440,15 +440,24 @@ storageFindPoolSources(virConnectPtr conn,
>      char *ret = NULL;
>  
>      backend_type = virStoragePoolTypeFromString(type);
> -    if (backend_type < 0)
> +    if (backend_type < 0) {
> +        virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR,
> +                              _("unknown storage pool type %s"), type);
>          goto cleanup;
> +    }
>  
>      backend = virStorageBackendForType(backend_type);
>      if (backend == NULL)
>          goto cleanup;
>  
> -    if (backend->findPoolSources)
> -        ret = backend->findPoolSources(conn, srcSpec, flags);
> +    if (!backend->findPoolSources) {
> +        virStorageReportError(conn, VIR_ERR_NO_SUPPORT,
> +                              _("pool type '%s' does not support source "
> +                                "discovery"), type);
> +        goto cleanup;
> +    }
> +
> +    ret = backend->findPoolSources(conn, srcSpec, flags);
>  
>  cleanup:
>      return ret;

ACK

Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]