Re: [PATCH 09/12] storage: Cleanup failures in virStorageBackendCreateRaw

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

 



On Fri, Oct 09, 2015 at 09:34:08 -0400, John Ferlan wrote:
> If the volume target path doesn't exist prior to calling virFileOpenAs and
> we have a successful call, then we know we've had a successful creation.
> For any other failures in the function we should clean up after ourselves
> by using virFileDelete if we're about to return failure.
> 
> Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx>
> ---
>  src/storage/storage_backend.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/src/storage/storage_backend.c b/src/storage/storage_backend.c
> index 7d0de63..32f85ac 100644
> --- a/src/storage/storage_backend.c
> +++ b/src/storage/storage_backend.c

...

> @@ -520,6 +522,8 @@ virStorageBackendCreateRaw(virConnectPtr conn ATTRIBUTE_UNUSED,
>      if (vol->target.perms->mode != (mode_t) -1)
>          open_mode = vol->target.perms->mode;
>  
> +    if (virFileExists(vol->target.path))
> +        exists = true;

Why even bother checking? Shouldn't this function fail right away if the
target file exists?

Peter

Attachment: signature.asc
Description: Digital signature

--
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]