[libvirt] [PATCH] sanlock: Use VIR_ERR_RESOURCE_BUSY if sanlock_acquire fails
Eric Blake
eblake at redhat.com
Tue Apr 14 15:27:24 UTC 2015
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 at redhat.com>
> ---
> 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 604 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20150414/0a731ce6/attachment-0001.sig>
More information about the libvir-list
mailing list