[libvirt] [PATCH] Properly report failure to create raw storage volume files

Daniel Veillard veillard at redhat.com
Tue Jul 13 09:07:25 UTC 2010


On Tue, Jul 13, 2010 at 03:00:33AM -0400, Laine Stump wrote:
> We were previously checking for a return < 0 from virFileOperation(),
> but that function returns a standard errno, which is 0 on success, or
> some small positive number on failure. The result was that we wouldn't
> report failures to create storage volume files; instead they would
> appear to be created, but then would vanish as soon as a pool-refresh
> was done (or cause some later error as soon as someone tried to access
> the volume).
> 
> The other uses of virFileOperation() were already properly checking
> for != 0.
> ---
>  src/storage/storage_backend.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/src/storage/storage_backend.c b/src/storage/storage_backend.c
> index aba8937..9792eed 100644
> --- a/src/storage/storage_backend.c
> +++ b/src/storage/storage_backend.c
> @@ -362,7 +362,7 @@ virStorageBackendCreateRaw(virConnectPtr conn ATTRIBUTE_UNUSED,
>                                         createRawFileOpHook, &hdata,
>                                         VIR_FILE_OP_FORCE_PERMS |
>                                         (pool->def->type == VIR_STORAGE_POOL_NETFS
> -                                        ? VIR_FILE_OP_AS_UID : 0))) < 0) {
> +                                        ? VIR_FILE_OP_AS_UID : 0))) != 0) {
>      virReportSystemError(createstat,
>                           _("cannot create path '%s'"),
>                           vol->target.path);

  Ah, good caatch, ACK !

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel at veillard.com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/




More information about the libvir-list mailing list