From 4864e377c9a6ef08cd65672775e520751a27f6d7 Mon Sep 17 00:00:00 2001 From: Jiri Denemark Date: Tue, 14 Apr 2015 16:27:37 +0200 Subject: [PATCH] sanlock: Use VIR_ERR_RESOURCE_BUSY if sanlock_acquire fails 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 --- src/locking/lock_driver_sanlock.c | 2 +- src/util/virerror.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/locking/lock_driver_sanlock.c b/src/locking/lock_driver_sanlock.c index dbe79bcb66..e052875e25 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 c4e84e73cd..91c8686399 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) -- GitLab