Re: [PATCH] sanlock: Use VIR_ERR_RESOURCE_BUSY if sanlock_acquire fails

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

 



On 04/14/2015 08:40 AM, Jiri Denemark wrote:
> When acquiring resource via sanlock fails, we would report it as
> VIR_ERR_INTERNAL_ERROR, which is not very friendly to applications using
> libvirt. Moreover, the lockd driver would report the same failure as
> VIR_ERR_RESOURCE_BUSY, which looks better.
> 
> Unfortunately, in sanlock driver we don't really know if acquiring the
> resource failed because it was already locked or there was another
> reason behind. But the end result is the same and I think using
> VIR_ERR_RESOURCE_BUSY reason for all acquire failures is still better
> than what we have now.
> 
> https://bugzilla.redhat.com/show_bug.cgi?id=1165119
> Signed-off-by: Jiri Denemark <jdenemar@xxxxxxxxxx>
> ---
>  src/locking/lock_driver_sanlock.c | 2 +-
>  src/util/virerror.c               | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)

ACK

> 
> diff --git a/src/locking/lock_driver_sanlock.c b/src/locking/lock_driver_sanlock.c
> index dbe79bc..e052875 100644
> --- a/src/locking/lock_driver_sanlock.c
> +++ b/src/locking/lock_driver_sanlock.c
> @@ -975,7 +975,7 @@ static int virLockManagerSanlockAcquire(virLockManagerPtr lock,
>                                    priv->res_count, priv->res_args,
>                                    opt)) < 0) {
>              if (rv <= -200)
> -                virReportError(VIR_ERR_INTERNAL_ERROR,
> +                virReportError(VIR_ERR_RESOURCE_BUSY,
>                                 _("Failed to acquire lock: error %d"), rv);
>              else
>                  virReportSystemError(-rv, "%s",
> diff --git a/src/util/virerror.c b/src/util/virerror.c
> index c4e84e7..91c8686 100644
> --- a/src/util/virerror.c
> +++ b/src/util/virerror.c
> @@ -1326,7 +1326,7 @@ virErrorMsg(virErrorNumber error, const char *info)
>              if (info == NULL)
>                  errmsg = _("resource busy");
>              else
> -                errmsg = _("resource busy %s");
> +                errmsg = _("resource busy: %s");
>              break;
>          case VIR_ERR_ACCESS_DENIED:
>              if (info == NULL)
> 

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP 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]